Rukh step-by-step

Oracle submit message proofs and relayer delivers messages after the dispute period

Step 1: An application registers with the endpoint, designating the Rukh library and providing some configuration, including addresses for:

  • the Recs Contract

  • Oracle Fee Collector

  • Oracle

  • Relayer Fee Collector Relayer

  • Dispute Contract

  • Dispute Resolver

Step 2: Sending a message

  1. An application sends a message to the Endpoint address.

  2. The Endpoint routes the message to the Rukh library’s Send Module.

  3. The Rukh library’s Send Module asks the Oracle Fee Collector and Relayer Fee Collector selected by the Application for the appropriate fees to charge the application for delivering the message.

  4. Earlybird charges the Application the amount indicated by the Oracle and Relayer. That fee is sent to the Oracle Fee Collector and Relayer Fee Collector addresses.

  5. The Send Module broadcasts the message by emitting an event.

  6. The off-chain oracle and relayer then pick up this message and deliver it to the destination chain.

Step 3: Receiving a message

  1. The application’s selected oracle and relayer wait for the transaction containing the message to be finalized on the source chain.

  2. Once it has been finalized, the Oracle checks the destination Application’s Recs Contract to determine the dispute period for the message broadcasted. The Oracle encodes that value into the message proof.

  3. The message proof is delivered to the Rukh library’s Receive Module.

  4. The Rukh library’s Receive Module starts the dispute timer when it receives this message proof.

  5. Until the dispute timer reaches the designated dispute period, Disputers and Dispute Resolvers may dispute messages and resolve disputes, respectively. Note, by selecting its own Disputer and Dispute Resolver, the application is in control of how it wants to handle to handle disputes.

    1. Off-chain dispute services read the message proof and verify that there is a corresponding message on the source chain. These services will call the application's selected Dispute Contract to dispute the message proof via the Rukh Receive Module if they think the message proof is invalid.

    2. The Dispute Resolver verifies whether each dispute is valid by confirming whether a message corresponds to this proof on the source chain. Dispute resolvers may change their verdict up until the dispute resolution period has passed. Every time the verdict changes, the timer for the dispute resolution period restarts.

    3. The Rukh library’s Receive Module keeps track of how many valid disputes have been made. If there have been more than the max set in the Application's AppConfig, the module pauses message delivery to the application in fear of a compromised Oracle and Relayer.

  6. Once the dispute and dispute resolution periods end for the message proof, the Application's Relayer delivers the message corresponding to the message proof delivered by the Oracle to the Receive Module on the destination chain.

  7. The Receive Module on the destination chain verifies that the message matches the message proof and sends the message to the Endpoint.

  8. The Endpoint verifies that the Application is configured to receive messages from the Rukh library and then calls a receive function on the Application (see: the IReceiver interface implemented by the Application)

Last updated