Pallet Relayer
The Hyperbridge protocol is uniquely enabled by cryptographic proofs which certify the integrity of cross-chain transactions. These proofs can be generated by anyone, as they are freely provided by its connected chains. However, the Hyperbridge protocol provides a mechanism to incentivize the generation and submission of these proofs. This is where relayers come in.
Relayers are responsible for collecting and transmitting proofs of cross-chain messages across connected chains. In return, relayers are rewarded with the associated transaction fees that were provided by users and applications. The pallet-ismp-relayer
module is responsible for tracking the accrued fees and distributing them to the relayers. The module permits relays to withdraw their fees at any time, the module works in conjunction with the pallet-host-executive
to perform fee withdrawals on the destination chain.
The relayer module is responsible for the following:
Fee Accumulation
Once a relayer successfully completes a delivery, after winning the "relay race". The relayer immediately becomes eligible to collect the associated fees. First the relayer must perform a fee accumulation. This works by providing the pallet-ismp-relayer
module with a proof of the delivery. This proof of delivery consists of:
-
State proofs of initial request/response: Recall that users or applications can opt to provide a fee to incentivize the delivery of their cross-chain message. The relayer must provide state proofs of the initial request/response that was dispatched on the source chain. The state proof must reveal the associated fees that was provided by the user or application.
-
State proofs of the request/response delivery: Successful deliveries are stored in the
IsmpHost
alongside the account of the responsible relayer. This allows thepallet-ismp-relayer
module to verify the delivery of the message and its associated relayer.Once the
pallet-ismp-relayer
module verifies these proofs and confirms them to be valid, the module will "accumulate" the fees associated with the delivery. Storing the fees in the relayer's account. The relayer can then withdraw these fees at any time.
Withdrawals
If a relayer wishes to withdraw their fees, they can do so at any time. They simply need to sign a transaction to the relayer module showing that they possess the private key of the account in question. Recall that their account on the delivery chain is associated with any fees that they may have accumulated. This account scheme may be different from the Hyperbridge account scheme. To allow for this, the relayer can sign a withdrawal request with the private key of the account in question. The pallet-ismp-relayer
module will then verify the signature and if it is valid, the module will dispatch a request to the HostManager
to perform the withdrawal on the destination chain.