Closed kilrau closed 5 years ago
@michael1011 Here are some tips for raiden channel management:
Seperate the bot tasks into 3 different, separated, and unrelated tasks:
if possible query xud for supported raiden currencies (I don't think there is a an RPC for this). If not, use config file. You need to know which tokens to use and the deposit amount for each token. It can also be hard coded for now.
channels opening for this, hold in-memory data structure of peers for which you already tried to open a channel. This data structure should prevent a loop of failed open channel and also prevent an overrun of two open channel. you can populate the data structure with all existing channels so you will not need to query raiden every time. Data structure should automatically cleaned and rebuild every N (24) hours.
detection - when you see an xud peer with raiden address that is not in the data structure: --add the peer to the data structure (to prevent overrun and repeats) --do the rest in a go routine (can take long time): --send some ETH to the node (0.1 ETH should be good) - for the gas needed to close a channel --notify via slack --open channel with the node. deposit the amount --notify via slack
channel balancing - go over all open channels (raiden). when you see a channel with all/most of the tokens on this node side: --use payment api to push half of the balance to the peer --notify via slack
channel balancing - Later stage
if possible query xud for supported raiden currencies (I don't think there is a an RPC for this)
I believe you can use https://api.exchangeunion.com/#listcurrencies and just discard btc & ltc.
--notify via slack
Good point, bot notifications are still in slack. Should all be switched to discord, @michael1011 has experience in doing this. I propose to have a NOTIFICATIONS
channel section with channels for simnet, testnet, mainnet same as in the other project. We'll have some statistics & similar from xud instances we run ourselves pushing into testnet / mainnet.
Looks like https://api.exchangeunion.com/#listcurrencies doesn't return everything we need (token address, digits). So I suggest to hardcode for now. Opened an issue to enhance the listcurrencies call, once that's done the raiden open channel bot can use it: https://github.com/ExchangeUnion/xud/issues/1067
Raiden bot needs to open direct channels from and to all 3 cloud nodes, to support direct channel check for raiden. Also simplifies things, since there is no need for raiden channels between the 3 cloud instances and rebalancing. See https://github.com/ExchangeUnion/xud/pull/1065#issuecomment-505861669.
We need raiden nodes between the seed servers since the seed server may also swap between them. This will happend automatically once the bot knows how to deal with raiden channels.
To have the 3 nodes opening channels we somehow need to move WETH and DAI from test1 to test2 and test3. This can be added as a task in the list above (@kilrau )
Data structure should automatically cleaned and rebuild every N (24) hours.
Why should we do that? Unless someone manually opens a channel the data structure should contain all data and by rebuilding it we could loose some channels that are pending during the cleanup process.
To avoid the need to restart the bot if something went wrong.
On Wed, Jun 26, 2019 at 9:31 PM michael1011 notifications@github.com wrote:
Data structure should automatically cleaned and rebuild every N (24) hours.
Why should we do that? Unless someone manually opens a channel the data structure should contain all data and by rebuilding it we could loose some channels that are pending during the cleanup process.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ExchangeUnion/xud-simnet/issues/28?email_source=notifications&email_token=ACKDI4STOVKS47TJ2CCDVNDP4OYXBA5CNFSM4HWUMBD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYUNTQY#issuecomment-505993667, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKDI4Q4XC3NLOTKKUPSNETP4OYXBANCNFSM4HWUMBDQ .
@offerm in order to send the ETH I would like to use this API endpoint of geth: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
Will this be possible on the seed nodes? Do the geth instances have the private keys of the addresses to which you send the mined coins?
We have a single geth instance running in our simnet cluster. I see no reason why you should not be able to sign a transaction and provide to geth for execution.
geth don't have the private keys of the other nodes. Why should it have them?
On Thu, Jun 27, 2019 at 10:27 PM michael1011 notifications@github.com wrote:
@offerm https://github.com/offerm in order to send the ETH I would like this API endpoint of geth: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
Will this be possible on the seed nodes? Do the geth instances have the private keys of the addresses to which you send the mined coins?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ExchangeUnion/xud-simnet/issues/28?email_source=notifications&email_token=ACKDI4RWKI32ADHXQO6M2ZDP4UIBLA5CNFSM4HWUMBD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYYEFIA#issuecomment-506479264, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKDI4SSKOUI7VEYJKZRTFDP4UIBLANCNFSM4HWUMBDQ .
@offerm So if there is just a single geth instance in the cloud: does that instance have the private key for the address to which you send the mined coins? Can the aforementioned API endpoint be used on that instance in the cloud or do I have to sign the transactions with the geth golang library in order to send a transaction?
The geth instance don't the the private keys of the seed nodes and/or the remote nodes. It has the address (public key) of test1 that gets all the block rewards coins. I believe that you need to sign the transaction locally before you send it to geth for execution. Only the local instance has access to the private key so it must be done locally.
Note that the geth instance mine ETH for test1. test1 is also the owner (and main holder ) of WETH and DAI. We need to find a way for one time transfer part of these tokens to test2 and test3 so they will be able to open the channels
Honestly, we can also just shutdown xud2 & 3..
Since everything depends on one miner and xud1 to distribute funds, xud2 & 3 don't make much sense after all. If it makes things easier - just go ahead and shut them down. @michael1011 @offerm
No need to do that. Channels should be with test1 only.
On Sun, 30 Jun 2019 at 13:46 Kilian Rausch ⚡️ notifications@github.com wrote:
Since everything depends on one miner and xud1 to distribute funds, xud2 & 3 don't make much sense after all. If it makes things easier - just go ahead and shut them down. @michael1011 https://github.com/michael1011 @offerm https://github.com/offerm
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ExchangeUnion/xud-simnet/issues/28?email_source=notifications&email_token=ACKDI4WQECIF4YM2XGLICT3P5CFJXA5CNFSM4HWUMBD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4JWRY#issuecomment-507026247, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKDI4SVUPZQYJKOEK7O5WLP5CFJXANCNFSM4HWUMBDQ .
Then https://github.com/ExchangeUnion/xud/pull/1065 direct channel check would need to be switched off for simnet. @michael1011
Reminder: we decided to go with config option, checks on by default, clear warnings on this restriction in setup (https://github.com/ExchangeUnion/xud/wiki/docker#beware)
Raiden channel check not important enough. Closing.
[x] deploy and use sha256 raiden contracts (test registering dai, test higher limits) @offerm
[x] sha256 raiden @offerm
[x] auto open raiden channel (direct channel) @michael1011 (https://github.com/ExchangeUnion/xud-tests/pull/7) to be tested and potentially fixed by @offerm
[ ] add raiden channel check to
xud-simnet-start
script[x] on-demand mining for raiden channel opening and closing to speed it up @offerm
[x] increase raiden log level on cloud instances and simnet setup, as of now it doesn't contain too many useful things