Skip to main content
OP Stack interop goes live with the Lagoon hardfork.
This is an explanation of how interop works. You can find a step by step tutorial here.
The low-level CrossL2Inbox contract handles basic message execution. It verifies whether an initiating message exists but does not check the message’s destination, processing status, or other attributes. The L2ToL2CrossDomainMessenger contract extends CrossL2Inbox by providing complete cross-domain messaging functionality. For high-level interoperability, both messages use the L2ToL2CrossDomainMessenger contract on their respective chains.

Initiating message

  1. The application sends a transaction to a contract on the source chain.
  2. The contract calls L2ToL2CrossDomainMessenger.sendMessage. The call requires these parameters:
    • _destination: The chain ID of the destination blockchain.
    • _target: The address of the contract on that blockchain.
    • _message: The actual message.
    This message is provided to _target as calldata, which means it includes a function selector and the parameters for that function call.
  3. L2ToL2CrossDomainMessenger on the source chain verifies the message is legitimate:
    • The destination chain is not the source chain.
    • The target is not L2ToL2CrossDomainMessenger, L2CrossDomainMessenger or L2ToL1MessagePasser.
    sendMessage does not check that the destination chain is in the same interop cluster as the source chain. If the destination is outside the interop cluster, nobody can relay the message and nobody can expire it. Any assets that the send burned or locked are lost, for example ETH sent through SuperchainETHBridge. Applications must check the destination chain ID before they send.
  4. L2ToL2CrossDomainMessenger emits a log entry. In addition to the parameters, the log entry also includes:
    • _nonce: A nonce value to ensure the message is only executed once.
    • _sender: The contract that sent the cross domain message.

Executing message

  1. Before the executing message is processed, the log event of the initiating message has to reach the destination chain’s node before the expiry window of 7 days.
  2. The autorelayer, the application, or a contract calling on the application’s behalf calls L2ToL2CrossDomainMessenger.relayMessage. This call includes the message that was sent (_sentMessage), as well as the fields required to find that message (_id).
    A deposit transaction cannot relay a message. CrossL2Inbox.validateMessage reverts when a deposit calls it. Send the relay as a normal L2 transaction. If the destination’s sequencer does not include the relay within 7 days, nobody can relay the message. Then the application can expire the message and undo the send.
  3. The L2ToL2CrossDomainMessenger uses CrossL2Inbox to verify the message was sent from the source.
  4. L2ToL2CrossDomainMessenger on the destination chain verifies the message is legitimate:
    • _destination: Chain ID of the destination chain.
    • _nonce: Nonce of the message sent
    • _sender: Address that sent the message
    • _target: Target contract or wallet address.
    • message: Message payload to call target with.
  5. If everything checks out, L2ToL2CrossDomainMessenger calls the destination contract with the calldata provided in the message.

Next steps