ERC-7533 Public Cross Port

Draft · Other · created 2023-10-11

A common cross-chain messaging standard in which cross-chain bridges connecting multiple EVM chains gather messages into a single shared contract per chain (SendPort) and move and verify only a single Merkle tree root.

Why it is needed

Currently there are official cross-chain bridges between L2 and L1, but not between L2s. With a push model where each chain sends messages to every other chain, a separate bridge is needed for each chain pair, so 10 chains would require 10 times 9, or 90 bridges. As the number of bridges grows, the burden of building and operating them and the gas costs increase. There is also a lot of redundant construction, with multiple bridge projects separately building the same route, and because each is built differently, this redundancy does not translate into improved security. Since the message collection window and verification criteria are not standardized, even when multiple bridges carry the same message, their results cannot be cross-checked against each other, and the failure of a single bridge directly becomes an incident.

What to implement

In depth

From push to pull, bridge count down to N

In the existing push model, each chain pushes messages to every other chain, requiring N x (N - 1) bridges for N chains. With 6 chains that is 30. In this standard's pull model, each chain pulls in the messages of the remaining chains in a single transaction and syncs them to its own chain, reducing the bridge count to N. Also, since Merkle tree compression turns any number of messages into a single byte32 root, carriers only need to move the root, keeping gas costs low.

The role of the SendPort contract

SendPort is a shared contract deployed on each chain that collects and packs cross-chain messages originating on that chain. It is public, permissionless, has no administrator, and operates automatically. Since multiple bridges can use it together, there is no need to redeploy it repeatedly per chain, and it is RECOMMENDED to have one per chain. A leaf is a hash computed from msgHash passed in by the external contract, the caller address sender that is recorded automatically, and the destination chain ID toChainId. After collecting leaves for a period of time, they are packed into a Merkle tree, and the next collection period begins.

Package structure and packing trigger

A Package consists of packageIndex (a zero-based index), root (the Merkle tree root built from the leaves), leaves, createTime (the time collection started, which is also the packing time of the previous package), and packTime (the packing time, after which no more leaves can be added). In the reference implementation, a new packing can begin once PACK_INTERVAL (6000) has elapsed, and packing executes immediately once MAX_PACKAGE_MESSAGES (100) messages have accumulated, with this condition taking priority over PACK_INTERVAL.

Root transport and multiple IReceivePorts

Once a new Merkle tree is packed, a carrier (typically a bridge project) pulls the root from multiple chains and stores it in the IReceivePort contract of each chain. Since a single root mixes messages going from one source chain to multiple destination chains, the carrier MAY decide at its discretion whether to move it to a particular chain based on relevance to itself. IReceivePort is not a single contract; each carrier implements it according to the interface, so if there are multiple carriers, multiple IReceivePort contracts exist as well.

Verification structure and multi-confirmation security

IReceivePort stores each chain's root and verifies authenticity when the full message and Merkle proof are presented. The root alone reveals nothing about the message content and only allows authenticity verification; the full message can be obtained from the source chain's SendPort. Since roots originate from the same SendPort, the roots held by different IReceivePorts SHOULD be identical, and a genuine message SHOULD verify as true at any IReceivePort. If multiple IReceivePorts verify it as true, it is likely genuine, and if some verify it as false, that can signal a hack or a malfunction of that particular bridge. Similar in principle to a multisig, this eliminates a single point of failure and turns redundant construction into improved security.

Data retention principle

SendPort preserves all roots and their sequential index numbers without deletion or modification. Each bridge's IReceivePort contract SHOULD follow the same approach. The reference implementation's ReceivePort refuses to accept a root if one already exists for the same fromChainId and packageIndex, preventing overwrites.

Three-layer ecosystem separation

This standard divides the cross-chain ecosystem into three layers and defines only the SendPort contract and IReceivePort interface at the bottommost foundational layer. Implementation of the remaining layers is left to projects participating in the ecosystem. On top of the message bridge, apps can build services such as token crossing, and if an NFT cross-chain app reuses a token message bridge or layers verification across multiple message bridges, it can significantly increase security at no extra cost. Since it does not change the consensus layer, there are no compatibility issues with Ethereum as a whole or with existing apps.

Proposal status

This proposal is still in Draft status. Its content may change, so the latest source should be checked before implementation.

Things to watch out for

Original ERC · ← ERCs