A watcher listens for a certain event and creates proper jobs in the queue. These jobs contain the transaction data (without the nonce) and the transaction hash for the related event. The watcher runs on a given frequency, keeping track of the last processed block.
There are three Watchers:
- Signature Request Watcher: Listens to
UserRequestForSignatureevents on Home network. - Collected Signatures Watcher: Listens to
CollectedSignaturesevents on Home network. - Affirmation Request Watcher: Listens to
UserRequestForAffirmationevents on Foreign network.
A sender subscribes to the queue and keeps track of the nonce. It takes jobs from the queue, extract transaction data, adds proper nonce and sends it to the network.
There are two Senders:
- Home Sender: Sends transaction to Home network.
- Foreign Sender: Sends transaction to Foreign network.
-
Deploy bridge contracts
- Clone repo:
$ git clone git@github.com:InfoCorp-Technologies/sentinel-bridge-rsk.git $ cd sentinel-bridge-rsk- Go to contract folder:
$ cd contracts - Compile contracts:
$ truffle compile - Go to deploy folder:
$ cd deploy - create a
.envfile:$ cp .env.example .env(look at.env.exampleto see the variables that need to be present) - Execute
$ node deploy.js
- Clone repo:
- RabbitMQ version:
3.7 - Redis version:
4.0
- Edit the
.envfile and fill in the information using the output data from previous deploy step. Check the.env.examplefile to see the required variables.
$ npm run watcher:signature-request$ npm run watcher:collected-signatures$ npm run watcher:affirmation-request$ npm run sender:home$ npm run sender:foreign
To send deposits to home contract run $ node tests/sendUserTxToHome.js
To send withdrawals to foreign contract run $ node tests/sendUserTxToForeign.js
Make sure your HOME_MIN_AMOUNT_PER_TX and FOREIGN_MIN_AMOUNT_PER_TX is same as in your .env deployment contract
On .env file set BRIDGE_MODE=ERC_TO_ERC
$ npm run watcher:signature-request$ npm run watcher:collected-signatures$ npm run watcher:affirmation-request$ npm run sender:home$ npm run sender:foreign
To send deposits to home contract run $ node tests/sendUserTxToErcHome.js
To send withdrawals to foreign contract run $ node tests/sendUserTxToErcForeign.js
| Command | Description |
|---|---|
rabbitmqctl list_queues |
List all queues |
rabbitmqctl purge_queue home |
Remove all messages from home queue |
Use redis-cli
| Command | Description |
|---|---|
KEYS * |
Returns all keys |
SET signature-request:lastProcessedBlock 1234 |
Set key to hold the string value. |
GET signature-request:lastProcessedBlock |
Get the value of key. |
DEL signature-request:lastProcessedBlock |
Removes the specified key. |
FLUSHALL |
Delete all the keys of all the existing databases |
| Variable | Description | Values |
|---|---|---|
ALLOW_HTTP |
Explicitly allows the usage of http connections instead of https. |
yes / no |
