Verus Bridgekeeper is a node js application passing transactions between Verus and Ethereum blockchains.
To install Verus Bridgekeeper complete the following steps:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
# you may need to log out and log back in or source your shell profile at this step
nvm install 18
npm install -g pm2 yarn
cd ~
git clone https://github.com/VerusCoin/Verusbridgekeeper.git
cd ~/Verusbridgekeeper
yarn install
Then after the installation run the following to create the initial configuration file
yarn start
It will exit with an error after creating a template configuration file for you to edit/populate.
delegatorcontractaddress= The bridge delegator contract address provided after the contracts have been launched
ethnode=wss:// to a websocket address for an Ethereum node
Only for witnesses:
privatekey= the private key (in hex, no leading 0x) of an ethereum account on the mainnet (goerli on testnet) chain with sufficient funds, to provide gas for calls to the contracts.
(mainnet)
Apple: /Library/Application Support/Verus/pbaas/52c7a71ed15802d33778235e7988d61339b84c45/52c7a71ed15802d33778235e7988d61339b84c45.conf
Linux: ~/.verus/pbaas/52c7a71ed15802d33778235e7988d61339b84c45/52c7a71ed15802d33778235e7988d61339b84c45.conf
Windows: %appdata%\Verus\pbaas\52c7a71ed15802d33778235e7988d61339b84c45\52c7a71ed15802d33778235e7988d61339b84c45.conf
(testnet)
Apple: /Library/Application Support/Verustest/pbaas/000b090bec6c9ff28586eb7ed24e77562f0c4667/000b090bec6c9ff28586eb7ed24e77562f0c4667.conf
Linux: ~/.verustest/pbaas/000b090bec6c9ff28586eb7ed24e77562f0c4667/000b090bec6c9ff28586eb7ed24e77562f0c4667.conf
Windows: %appdata%\Verustest\pbaas\000b090bec6c9ff28586eb7ed24e77562f0c4667\000b090bec6c9ff28586eb7ed24e77562f0c4667.conf
To set the wallet not to spend (but still enable revoke) please edit the above *.conf file and add:
nowitnesssubmissions=true
The following command will start the bridgekeeper from the command line
yarn start -log [-debug] [-debugnotarization] [-testnet]
Optional flags:
-debug Shows extra information
-debugnotarization Shows debug information
-testnet Runs the Bridgekeeper for the Verus testnet
cd ~/Verusbridgekeeper; pm2 start start.js --name bridgekeeper -- -consolelog
or create a shell script (in ~/bin
) for convenient starting and start that using ~/bin/startbridge.sh
:
cat << EOF > ~/bin/startbridge.sh
#!/bin/bash
cd ~/Verusbridgekeeper; pm2 start start.js --name bridgekeeper -- -consolelog
EOF
chmod +x ~/bin/startbridge.sh
When using PM2, console logs are stored in ~/.pm2/logs/bridgekeeper-out.log
and the errors in ~/.pm2/logs/bridgekeeper-error.log
This will result in the service running on port 8002 it can be queried using the following examples:
curl -u userXXX:passXXX --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8002
curl -u userXXX:passXXX --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getcurrency","params":["iCtawpxUiCc2sEupt7Z4u8SDAncGZpgSKm"]}' -H 'content-type:text/plain;' http://127.0.0.1:8002
As root user, create a file called /etc/logrotate.d/verusd-rpc with these contents:
/home/verus/.komodo/VRSC/debug.log
/home/verusd-rpc/.pm2/logs/verusbridge-out.log
/home/verusd-rpc/.pm2/logs/verusbridge-error.log
{
rotate 14
daily
compress
delaycompress
copytruncate
missingok
notifempty
}
======= #Updgrading contracts utility
Run yarn run getcontracthash
from the main directory.
In the /utiliites folder there is a file called upgrade.js . It handles contract upgrades and also revoking and recovering identities. For it to be able to revoke it needs to be able to interact with the contract and send a transaction using the notaries main key.
Your private key in you veth pbaas conf file should be your main spend address.
node upgrade.js -revoke
Setup a connection between the utility and the verus daemon. The daemon needs to have the R address in its wallet for the current
recovery address in the notary setup on Ethereum. (The utility will look in the verus.conf file for the RPC connection details).
e.g. in /.komodo/VRSC/VRSC.conf
node upgrade.js -recover 'notaries i-address' 'ETH address of main signer' 'ETH address of recover' 'R-address of current ETH recovery' [-testnet]
e.g.
node upgrade.js -recover iKjrTCwoPFRk44fAi2nYNbPG16ZUQjv1NB 0xD3258AD271066B7a780C68e527A6ee69ecA15b7F 0x68f56bA248E23b7d5DE4Def67592a1366431d345 RH7h8p9LN2Yb48SkxzNQ29c1Ltfju8Cd5i
For the notaries, a quorum is required to revoke or recover another notary. The notaries first have to agree on the new notaries signing and recover ETH addresses.
Once they are decided each notary can make a packet of information that when put together it makes a upgrade script that the contract can accept and upgrade.
(see recovermutisig.json and revokemultisig.json for examples)
node upgrade.js -createmultisigrevoke 'your notaries i-address' 'notary to be revoked' 'R-address of your notaries primary key' [-testnet]
e.g.
node upgrade.js -createmultisigrevoke iKjrTCwoPFRk44fAi2nYNbPG16ZUQjv1NB iChhvvuUPn7xh41tW91Aq29ah9FNPRufnJ RLXCv2dQPB4NPqKUweFx4Ua5ZRPFfN2F6D
node upgrade.js -createmultisigrecover 'your notaries i-address' 'notary to be revoked' 'R-address of your notaries recovery' 'notaries new main ETH address' 'notaries new recovery ETH address' [-testnet]
e.g.
node upgrade.js -createmultisigrecover iKjrTCwoPFRk44fAi2nYNbPG16ZUQjv1NB iChhvvuUPn7xh41tW91Aq29ah9FNPRufnJ REXBEDfAz9eJMCxdexa5GnWQBAax8hwuiu 0x68f56bA248E23b7d5DE4Def67592a1366431d345 0xD010dEBcBf4183188B00cafd8902e34a2C1E9f41
As above there needs to be a connection from the utility to a verus daemon running with the R address that can sign for the notaries recover key.
node upgrade.js -revokemultisig [-testnet]
As above there needs to be a connection from the utility to a verus daemon running with the R address that can sign for the notaries recover key.
node upgrade.js -recovermultisig [-testnet]
node upgrade.js -getcontracthash -contracttype 0 -contractaddress 0xe20Aa3a102e4326B1D86683d493E854A792baB41 [-testnet]
NOTE: the upgraded contract MUST have a initialize()
function in it as below to be able to upgrade.
function initialize() external { }
node upgrade.js -upgradecontracts -contracttype 0 -contractaddress 0xf2bF96D603b54f96a0BF6F72305A84813C90b345 [-testnet] -salt 0xaae83c4ccbadca1ce6478b031bb4444ac0d375a56886a9d4a8dfe2116763dcbf
Only put the -burn
flag on to actually execute the transaction.
node burndai.js [-burn]