Validators and Relayers
Validators and relayers are an essential part of the infrastructure layer
Validator is a verification node whose purpose is to track events on our Cross-Chain Routing contract, and report them to the Relayer.
The message to the Relayer contains transaction data (information about the completed transaction in the source network and the parameters with which to send the transaction to the target network). The validator signs this data with its private key.
Relayer is a node whose purpose is to collect the necessary number of messages from validators, and to send the transaction.

The role of Validators and Relayers on the example of a transaction

1) User makes a transaction on Blockchain 1 — sends tokens to the contract.
2) Contract in Blockchain 1 emits the event.
3) The Validator scanner catches this event from Blockchain 1.
4) The Validator verifies that the transaction was created by the Cross-Сhain Routing contract, and verifies that it has made a correct event.
5) The Validators sign, by their own private key, a unique hash calculated by the recipient’s user address, token amount, transaction hash from Blockchain 1, and the blockchain number from the contract in the target blockchain.
6) The Validators sign messages to the Relayer.

Why is Rubic using more than one Relayer?

We have created several extra relayers in order to maintain our continuous improvements and growth of Rubic’s Cross-Сhain Routing feature. Validators will scan the final blockchain, for the event of sending tokens from a smart contract using a unique hash (the event is generated when the function of the swap contract is called — sending tokens to the user). If no tokens are sent after a specified period of time, Validators send a message to another Relayer. The smart contract will reject the duplicated transactions with the same unique hash from the Relayers if they were already sent.