| 
 | 1 | +---  | 
 | 2 | +title: Interop message passing overview  | 
 | 3 | +lang: en-US  | 
 | 4 | +description: Learn about cross-chain message passing in the Superchain.  | 
 | 5 | +---  | 
 | 6 | + | 
 | 7 | +import { Callout, Steps } from 'nextra/components'  | 
 | 8 | + | 
 | 9 | +# Interop message passing overview  | 
 | 10 | + | 
 | 11 | +<Callout>  | 
 | 12 | +  Interop is currently in active development and not yet ready for production use. The information provided here may change. Check back regularly for the most up-to-date information.  | 
 | 13 | +</Callout>  | 
 | 14 | + | 
 | 15 | +This guide provides an overview of cross-chain message passing in the Superchain.  | 
 | 16 | + | 
 | 17 | +## Overview  | 
 | 18 | + | 
 | 19 | +The Superchain uses a pull-based event system for cross-chain communication. Messages are sent through the `L2ToL2CrossDomainMessenger` contract, which provides a secure and standardized way to pass information between chains.  | 
 | 20 | + | 
 | 21 | +## How it works  | 
 | 22 | + | 
 | 23 | +The following diagram illustrates how messages flow between chains through the `L2ToL2CrossDomainMessenger` contract, which acts as a bridge for cross-chain communication. When a contract on the source chain initiates a message, it's processed through several stages before reaching its destination, ensuring secure and reliable message delivery.  | 
 | 24 | + | 
 | 25 | +```mermaid  | 
 | 26 | +sequenceDiagram  | 
 | 27 | +    participant Source as Source Chain  | 
 | 28 | +    participant Messenger as L2ToL2CrossDomainMessenger  | 
 | 29 | +    participant Dest as Destination Chain  | 
 | 30 | +      | 
 | 31 | +    Note over Source,Dest: Message Creation  | 
 | 32 | +    Source->>Messenger: Emit message event  | 
 | 33 | +    Note over Source,Dest: Message Serialization  | 
 | 34 | +    Messenger-->>Messenger: Convert to standard format  | 
 | 35 | +    Note over Source,Dest: Identifier Creation  | 
 | 36 | +    Messenger-->>Messenger: Generate unique ID  | 
 | 37 | +    Note over Source,Dest: Message Execution  | 
 | 38 | +    Messenger->>Dest: Process message  | 
 | 39 | +```  | 
 | 40 | + | 
 | 41 | +Cross-chain messaging involves four main phases:  | 
 | 42 | + | 
 | 43 | +1.  **Message Creation**: The source chain contract emits an event containing the message data and destination information. This event serves as the initiating message that will be relayed across chains.  | 
 | 44 | + | 
 | 45 | +2.  **Message Serialization**: The messenger contract converts the event data into a standardized format that can be consistently processed across different chains in the Superchain.  | 
 | 46 | + | 
 | 47 | +3.  **Identifier Creation**: A unique identifier is generated for the message, containing information about its `origin`, `timestamp`, and other `metadata`. This identifier helps track and verify the message.  | 
 | 48 | + | 
 | 49 | +4.  **Message Execution**: The destination chain receives and processes the message, executing any associated actions or state changes specified in the original message.  | 
 | 50 | + | 
 | 51 | +For detailed implementation steps and code examples, see our [message passing implementation guide](https://supersim.pages.dev/guides/interop/relay-using-viem.html).  | 
 | 52 | + | 
 | 53 | +## Common Use Cases  | 
 | 54 | + | 
 | 55 | +*   Simple messages between identical contracts  | 
 | 56 | +*   Complex multi-contract interactions  | 
 | 57 | +*   Cross-chain state synchronization  | 
 | 58 | +*   Token transfers and bridging  | 
 | 59 | + | 
 | 60 | +For a practical example, see our [cross-chain ping pong tutorial](https://supersim.pages.dev/guides/interop/cross-chain-contract-via-l2cdm).  | 
 | 61 | + | 
 | 62 | +## Next steps  | 
 | 63 | + | 
 | 64 | +*   Read about the [anatomy of a cross-chain message](/stack/interop/cross-chain-message)  | 
 | 65 | +*   Try [Supersim](supersim) for testing cross-chain messages locally  | 
 | 66 | +*   Learn about [manually relaying messages](https://supersim.pages.dev/guides/interop/manually-relaying-interop-messages-cast)  | 
0 commit comments