ERC-6170 Common interface for cross-chain messaging (Cross-Chain Messaging Interface)

Draft · Other · created 2022-12-19

A common interface that specifies that bridges sending and receiving messages between different blockchains use the same function signatures, allowing apps to call any bridge in the same way.

Why it is needed

For blockchains to exchange data with each other, they must go through a message bridge (Arbitrary Message Bridge, AMB). But right now bridges like Layerzero, Hyperlane, Axelar, Wormhole, and Matic State Tunnel are each built in their own way, so there is no standard. Their security mechanisms also differ: some bridges use a nonce to prevent replay attacks, others use a Merkle root hash. Developers have to write separate code for each bridge, and it is difficult to use multiple bridges together. Also, a bridge with off-chain components lacks censorship resistance and can halt, and an app built on top of it has no option but to migrate its entire state to a different bridge. For large apps, such a migration is effectively impossible.

What to implement

In depth

IEIP6170, which every compatible bridge must implement

A cross-chain arbitrary message bridge (AMB) that follows the standard must implement the IEIP6170 interface. It consists of two functions, sendMessage and receiveMessage, and two events, MessageSent and MessageReceived. A notable feature is that every parameter is of type bytes, to support non-EVM chains as well. Even if address formats differ across chains, they can all be encoded as bytes.

Parameters and return value of sendMessage

sendMessage(chainId_, receiver_, message_, data_) sends a message to a receiving address on another blockchain. chainId_ is the unique identifier of the receiving chain, receiver_ is the recipient address, message_ is the arbitrary message to deliver, and data_ is bridge-specific encoded data for off-chain relayer infrastructure. It is a payable function and returns a bool indicating the processed status on the sending chain. It is designed to support both EVM and non-EVM chains.

receiveMessage and the pre-verification requirement

receiveMessage(chainId_, sender_, message_, data_) receives a message sent by a sender on another blockchain. chainId_ is the identifier of the sending chain, sender_ is the sender's address, and message_ is the arbitrary message sent by the sender. data_ is an additional parameter used for security purposes; for example, Layerzero can carry a nonce in it. It specifies that sender verification or message verification must be performed before the message is processed. The return value is the message's processed/stored status.

Event emission rules

MessageSent(to, toChainId, message, extraData) must be emitted whenever a message is sent, with no exception for sending zero bytes. MessageReceived(from, fromChainId, message) must be emitted every time a call to receiveMessage(bytes chainId, bytes sender, bytes message) succeeds. Because both events use bytes-type parameters, addresses and identifiers from non-EVM chains can be recorded as is.

Proposed approach to chain identifiers

The original text proposes encoding each chain's native token name string as bytes for use as the chain identifier (chain-id), for example as abi.encode("ETH") or abi.encode("SOL"). This approach assumes these names cannot collide. It is a proposal to point to any chain, including non-EVM chains without a numeric chain ID, under a single rule.

Why the interface was designed to be minimal

This standard aims to optimize the cross-chain interoperability layer with a minimal, lightweight interface while still providing the necessary functionality. By fixing only the interface and leaving relayer-level implementation free, it leaves room for bridges to innovate on technical merit. The goal is to enable cross-chain apps not just between Ethereum and compatible L2s, but between any two chains, for example Ethereum and Solana. It also reduces single point of failure (SPOF) risk, since an app can continue operating just by changing its AMB address.

A proposal still at the draft stage

This proposal was created on December 19, 2022, and is currently in Draft status. Its content may change going forward and it has not been finalized as a standard, so the latest original text should be checked before implementing or integrating it.

Things to watch out for

Original ERC · ← ERCs