Skip to main content
Version: Endpoint V2 Docs

Protocol Overview

To send a cross-chain message, a user must write a transaction on both the source and destination blockchains.

At its core, the LayerZero protocol defines a channel between a sender and a receiver smart contract by leveraging two key components:

  • Source and Destination Endpoints:
    Each supported blockchain deploys an immutable, permissionless Endpoint contract. On the source chain, a smart contract calls the Endpoint’s entry function (endpoint.send()) to send a message. On the destination chain, a smart contract authorizes the Endpoint to act as an exit point to receive and process that same message (endpoint.lzReceive()).

  • Channel Definition:
    A unique messaging channel in LayerZero is defined by four specific components:

    1. Sender Contract (Source OApp): The contract initiating the cross-chain communication.

    2. Source Endpoint ID: The identifier for the Endpoint on the source chain.

    3. Destination Endpoint ID: The identifier for the Endpoint on the destination chain.

    4. Receiver Contract (Destination OApp): The contract designated to receive and process the message on the destination chain.

Within each channel, message ordering is maintained through nonce tracking. This ensures that messages are delivered exactly once.

For example, if a token bridge on one chain sends a message to its counterpart on another chain, the messages flow through a dedicated channel — distinct from all other application pathways between those chains — preserving the integrity and sequence of communication.

How the Protocol Works

Protocol V2 Light Protocol V2 Dark

  1. Message Dispatch on the Source Chain:
    A smart contract on the source blockchain initiates the process by calling the Endpoint's entry function. This call includes an arbitrary message payload, details of the destination Endpoint, and the receiver's contract address. The Endpoint then uses a configurable Message Library to generate a standardized Message Packet based on the sender contract’s configuration.

  2. Establishing a Secure Channel:
    The generated Message Packet is emitted as an event by the source Endpoint. This packet contains critical information—including source and destination Endpoint IDs, the sender's and receiver’s addresses, and the message payload—which collectively define a unique messaging channel.

  3. Verification and Nonce Management:
    On the destination chain, the configured Security Stack (Decentralized Verifier Networks) deliver the corresponding payload hash to the receiver contract's configured Message Library. Once the threshold of DVN verifications satisfies the X of Y of N configuration, the Message Packet can be marked as verified and committed to the destination channel, ensuring exactly-once delivery.

  4. Message Execution on the Destination Chain:
    Finally, a caller (typically an authorized smart contract like the Executor) calls the Endpoint’s exit function lzReceive to trigger the execution of the verified message. This call delivers the message payload to the receiver contract, which can then execute its defined logic based on the incoming data.

Security and Flexibility

  • Immutable and Permissionless Design:
    The core Endpoint contracts are immutable and permissionless. This ensures that the protocol remains secure and resistant to unauthorized changes, regardless of which virtual machine (VM) or blockchain environment is used.

  • VM-Agnostic Integration:
    The LayerZero protocol itself is designed to be VM agnostic. The same fundamental principles apply whether you’re working with Solidity on Ethereum, Rust on Solana, Move on Aptos, or any other supported environment.

  • Independent Channel Management:
    Each channel between a given pair of endpoints maintains its own independent message sequence. This means that multiple applications can communicate across the same chain pairs without interference, providing scalability and flexibility in designing cross-chain solutions.

Further Reading

For more detailed technical insights into the protocol contracts for each specific virtual machine, please refer to the following overviews:

  • EVM Technical Overview:
    Learn how LayerZero’s protocol contracts are implemented for EVM-based chains, covering the Endpoint architecture, Message Libraries, and Workers.
    Read the EVM Protocol Overview

  • Solana Technical Overview:
    Discover the adaptations made for Solana’s runtime, including cross-chain messaging through the LayerZero Endpoint and integrations with Solana’s unique architecture.
    Read the Solana Protocol Overview

  • Aptos Technical Overview:
    Explore how LayerZero leverages the Aptos Move language and framework to implement secure and efficient cross-chain messaging on Aptos-based networks.
    Read the Aptos Protocol Overview