What Can Cross-Chain Message Relayers Earn?

User

These are Dapp users that send cross-chain messages. Users pay relayers a cross-chain fee.

A user can send a cross-chain message after paying a cross-chain fee (Billing Price) on the source chain, and then wait for message execution on the target chain.

These cross-chain messages will be delivered to the target chain by relayers.

Relayer

Relayers are those responsible for delivering cross-chain data to the target chain, and expect to earn profit by doing so. Being a permission-less role, anyone can be a relayer.

How to become a Relayer

  1. First, relayers must register in the fee market system. Each relayer should lock a sufficient amount of collateral on the chain to guarantee faithful execution of the deal.
  2. Run relayer client software.

Delivering Time Slot

Every message has n Delivering Time Slots. These slots start from the point in time the message is sent (after the transaction has been finalized), and each slot spans several blocks.

By default, each message has 3 Delivering Time Slots, and spans 300 blocks.

Assigned Relayers & Billing Price

Each slot is assigned a relayer, which is called the Assigned Relayer.

The assigned relayers are calculated when the message is sending. At that time, all quotes are sorted in ascending order. The lowest n quoted prices are then selected, and the related relayers will make up the assigned relayers. The last(highest) price of the selected n quoted prices is used as the Billing Price.

💡 The reason that we select n relayers as assigned relayers is to ensure redundancy while executing message delivery.

The assigned relayers are responsible for ensuring the success of cross-chain message delivery and need to monitor and run their relayer’s clients carefully.

If a message needs to be delivered to the target chain in one of the assigned relayer’s time slots, but is not, the assigned relayer is considered to have acted badly and will be slashed from the locked collateral, or even removed from the set of assigned relayers.

However, other assigned relayers can get rewards because they are guarding the cross-chain messaging service.

Reward And Slash Rules

Key Parameters

When calculating rewards and penalties, the following parameters are crucial.

  • GuardRelayersRewardRatio: 20% by default
  • MessageRelayersRewardRatio: 80% by default
  • ConfirmRelayersRewardRatio: 20% by default
  • AssignedRelayerSlashRatio: 20% by default
  • Slot: 300 blocks for each slot by default

Rules

After a user sends a cross-chain transaction, the fee market system calculates the slash or reward according to the time the cross-chain transaction is confirmed, with the following rules:

In-slot Delivery

As long as the order is confirmed before the last block of the nth slot, we consider it to be delivered on time, and the calculation of rewards and penalties varies depending on when the message is confirmed.

Suppose the cross-chain message has n slots, and the message is confirmed at the m(n ≥ m) slot. Pm denotes the quote price of m slot. Pn denotes the quote price of n slot that is also the Billing Price. At this point:

  • Slashes

Each of the assigned relayers from 1 ~ (m-1) slots will be slashed.

  • Rewards to assigned relayers

Each of the assigned relayers from m ~ n slots will receive a reward for ensuring the message is completed on time.

  • To Treasury

  • Reward to message delivery/confirm relayer

Pm plus the slashes for the other assigned relayers mentioned above will be distributed to the message delivery relayer and the message confirm relayer.

Out-of-slot Delivery

  • Slashes

When we believe that the cross-chain transaction is severely delayed, each of the assigned relayers will be heavily slashed.

DelayedBlocks is the number of blocks from the last block of slot n to the message confirmed block.

  • Reward to message delivery/confirm relayer

Pm plus the slashes for the other assigned relayers mentioned above will be distributed to the message delivery relayer and the message confirm relayer.

Example

  1. Assume that relayers R1, R2, R3, R4 and R5 have registered with the fee market and are all running relayer clients capable of delivering messages with quote prices of P1=10, P2=20, P3=30, P4=40 and P5=50 and are registered with locked collateral of 100.
  2. Assume that the n is 3.
  3. Assume that every time slot spans 50 blocks.
  4. Assume that the source chain accepted a cross-chain message at height 100.

So, in this case:

  • The delivery time slots are slot 1: [100, 150), slot 2: [150, 200), slot 3: [200, 250).
  • The billing price(cross-chain fee) is 30 . (10 < 20 < 30 < 40 < 50)
  • R1 is the assigned relayer of slot 1. R2 is the assigned relayer of slot 2. R3 is the assigned relayer of slot 3.

In-slot Delivery 1

The message was confirmed at block 110(within slot 1).

No assigned relayers will be slashed in this case.

Reward Summary:

  • To assigned relayers (R1, R2, R3): Floor((GuardRelayersRewardRatio * (30 - 10)) / 3)= 1
  • To treasury: 30 - 10 - 1 * 3 = 17
  • To message delivery relayer: 10 * MessageRelayersRewardRatio = 8
  • To message confirm relayer: 10 * ConfirmRelayersRewardRatio = 2

In-slot Delivery 2

The message was confirmed at block 160(within slot 2).

Since the message is confirmed at the second slot, the first assigned relayer will be slashed.

Slash Summary:

  • R1: 100 * AssignedRelayerSlashRatio = 20

Reward Summary:

  • To assigned relayers (R2, R3) = Floor((GuardRelayersRewardRatio * (30 - 20)) / 2) = 1
  • To treasury: 30 - 20 - 1 * 2 = 8
  • To message delivery relayer: (20 + 20) * MessageRelayersRewardRatio = 32
  • To message confirm relayer: (20 + 20) * MessageRelayersRewardRatio = 8

In-slot Delivery 3

The message was confirmed at block 210(within slot 3).

Since the message is confirmed at the third slot, the first two assigned relayers will be slashed.

Slash Summary:

  • R1: 100 * AssignedRelayerSlashRatio = 20
  • R2: 100 * AssignedRelayerSlashRatio = 20

Reward Summary:

  • To assigned relayers (R3) = Floor((GuardRelayersRewardRatio * (30 - 30)) / 1)= 0
  • To treasury: 30 - 30 - 0 = 0
  • To message delivery relayer: (30 + 20 + 20) * MessageRelayersRewardRatio = 56
  • To message confirm relayer: (30 + 20 + 20) * MessageRelayersRewardRatio = 14

Out-of-slot Delivery

The message was confirmed at block 260(out of slots).

All the assigned relayer will be slashed.

Slash Summary:

  • R1: 100 * AssignedRelayerSlashRatio + (260 - 250) * 2 = 40
  • R2: 100 * AssignedRelayerSlashRatio + (260 - 250) * 2 = 40
  • R3: 100 * AssignedRelayerSlashRatio + (260 - 250) * 2 = 40

Reward Summary:

  • To assigned relayers: 0
  • To treasury: 0
  • To message delivery relayer: (30 + 40 + 40 + 40) * MessageRelayersRewardRatio = 120
  • To message confirm relayer: (30 + 40 + 40 + 40) * MessageRelayersRewardRatio = 30

About Darwinia Network

Github | Website | Medium | Twitter | Telegram

Darwinia is a cross-chain messaging infrastructure, which provides a light client-based, programmable, universal cross-chain messaging network for decentralized applications. Now, we’ve successfully used Darwinia’s light-client cross-chain messaging protocol(LCMP) to bridge cross-chain messages between substrate-based chains, and even between substrate-based chains and EVM chains, meanwhile, Darwinia provides developers with an SDK, so they can easily integrate cross-chain capabilities into their Dapps. This will have profound implications for cross-chain interoperability, and Darwinia as a cross-chain messaging infrastructure will facilitate the building of a hybrid cross-chain network for Polkadot.

0
Darwinia NetworkPost author

Darwinia Network is a highly-secure programmable cross-chain messaging infrastructure for decentralized applications. Our light-client cross-chain messaging protocol (LCMP) supports arbitrary message passing between Substrate chains, and between Substrate and EVM chains, and SDK empower developers with the tools necessary to build the next generation of Web3 applications and seamless user experiences even when transacting across multiple chains or protocols.

Darwinia as a cross-chain messaging infrastructure will facilitate the building of a hybrid cross-chain network for Polkadot.

Follow us: linktr.ee/darwinianetwork

Darwinia Network is a programmable cross-chain messaging infrastructure for decentralized applications. Our light client-based cross-chain messaging protocol (LCMP) supports arbitrary message passing between Substrate and EVM chains, and SDK empowers developers with the tools necessary to build the next generation of Web3 applications, and create seamless user experiences, even when transacting across multiple chains.

Follow us: linktr.ee/darwinianetwork

0 comments

Darwinia Network is a programmable cross-chain messaging infrastructure for decentralized applications. Our light... Show More