Federator

Presents the event and necessary information to validate it on the other network The federator is an off-chain process which performs voting actions to validate transactions between a Mainchain (source) and a Sidechain (target) network. These transactions are obtained from the Bridge contract on the Mainchain using event logs and voted in the Sidechain through a Federation contract. Once all required signers (federators) vote for a transaction the Federation contract starts the process to release the funds on the Sidechain. The federators will be the owners of the contracts willing to allow to cross their tokens, and by doing so staking they reputation.

Config

Go to /federator/config, copy config.sample.js file, and rename it to config.js. Set mainchain and sidechain to point to the JSON files of the networks you are using, for example rsktestnet-kovan.json and kovan.json. Make sure to set the host parameter of those files. Create the file federator.key inside the config folder, and add the private key of the member of the Federation contract. The members of the federation are controled by the MultiSig contract, same that is owner of the Bridge and AllowedTokens contracts.

Usage

Run npm install to install the dependencies, make sure you followed the previous config step. Then to start the service run npm start which will start a single federator that listen to both networks. Check the logs to see that everything is working properly.

Test

You can run unit tests using npm test. To run an integration test use npm run integrationTest. The integration test will use a preconfigured private key (from config.js) which is assumed to be the only member of the Federation contract. In order to test with multiple federators, ensure they’re added as members of the Federation contract and pass their private keys as a comma separated string for both chains as arguments of the integration test script. For instance: node integrationTest.js "privKeyM1, privKeyM2, privKeyMN" "privKeyS1, privKeyS2, privKeySN"