Architecture: Five Independent Layers
Each layer has one job. They work together but remain independent.
1. Business Logic Interface (OApp)
Omnichain Applications (OApps) are LayerZero’s definition for smart contracts that use LayerZero to send and receive crosschain messages. Building on Module 1’s data messaging concepts, the LayerZero protocol allows applications to define any custom data as bytes and send them as crosschain messages. The OApp standard provides a consistent application interface for invoking the LayerZero protocol with this custom business logic:endpoint.send() and endpoint.lzReceive() directly, OApps use _lzSend() and _lzReceive() which handle common patterns like fee quoting, message validation, and error handling.
Your application code focuses on business logic (encoding/decoding custom data, state transitions, etc.) while the OApp facade manages protocol interaction.
2. Protocol Interface (Endpoint)
The LayerZero Endpoint serves as the single entrypoint and exitpoint for all crosschain messaging on a blockchain. Each chain has one LayerZero Endpoint contract that can send and receive messages between any other LayerZero Endpoint contract on any supported chain. The Endpoint provides the universal, immutable protocol interface:- Universal: Same interface on every supported chain
- Immutable: Cannot be upgraded or changed
- Permissionless: Anyone can call (with proper fees)
- Chain-agnostic: Works across EVM, Solana, Aptos, etc. (see non-EVM sections for specific sister implementations)
Channels: OApp-to-OApp Communication
A channel in LayerZero is uniquely defined by four components:- Sender OApp: The contract initiating the message
- Source Endpoint: The LayerZero endpoint on the source chain
- Destination Endpoint: The LayerZero endpoint on the destination chain
- Receiver OApp: The contract receiving the message
Note: Channel 3 shows the pull messaging pattern where data is queried directly from target contracts without involving the destination chain’s LayerZero endpoint. We’ll expand on this lzRead functionality in future modules.
Channel Identification
In practice, each channel can be identified from a source chain using only the destination Endpoint ID (EID) and receiver contract address. The source EID is already known (stored in the local Endpoint) and the caller is the OApp making the request, simplifying pathway management:Channel-Specific Nonce Tracking
Each channel maintains its own independent nonce sequence, enabling parallel messaging without ordering conflicts: Benefits of Per-Channel Nonces:- Parallel messaging: No ordering dependencies between different channels
- Independent scaling: High-traffic channels don’t block low-traffic channels
- Replay protection: Each channel has its own sequence for security
- Channel isolation: Message ordering only matters within the same communication pathway
Message Packet Generation Per Channel
When applications send messages, the Endpoint wraps the raw message data in a standardized packet container with channel-specific metadata. Based on the EndpointV2 implementation:- Nonce: Sequential per channel for ordering and replay protection - each channel maintains its own nonce sequence
- GUID: Globally unique identifier generated from channel components + nonce
- Channel identification:
(sender, srcEid, dstEid, receiver)uniquely identifies the communication pathway - Message isolation: Raw application data separated from protocol metadata
Managing Channel Configuration
The Endpoint provides the interface for managing channel configurations via modular Message Libraries:3. Configurable Protocol Libraries (Message Libraries)
Message Libraries are onchain rulesets that handle how messages are sent off-chain and arrive onchain between Endpoints. They define the complete workflow: message processing, verification requirements, and delivery coordination while maintaining the universal Endpoint interface.Message Library Types & Workflows
Message Libraries can define different workflows and have specialized roles, such as Sending, Receiving, or Reading crosschain state:Push Messaging Workflow (Send/Receive ULN)
Pull Messaging Workflow (Request/Response lzRead)
Different libraries enable OApps to handle different channel types with distinct behaviour, security, and delivery characteristics. Each channel represents a unique communication pathway between specific OApps with configurable message processing rules. LayerZero Labs may deploy new libraries with different workflows, features, or versions to enable developers to opt into new changes per channel.
Channel-Specific Library Configuration
Each channel gets unique settings through a two-step process from the Endpoint:- Library Selection: Use
setSendLibrary/setReceiveLibraryto assign specific libraries per channel - Library Configuration: Use
setConfigto customize each library’s settings per channel
What Can Be Configured Per Channel
Message Libraries enable three main types of configuration for each channel:- Finality: How many block confirmations are required before verification begins
- Verification: Which verifier networks must verify messages and in what combinations
- Execution: Which execution services deliver messages and with what parameters
X-of-Y-of-N Verification Coordination
LayerZero libraries today use an X-of-Y-of-N configuration pattern for verification, where:- X: Required verifier networks that MUST always verify (non-fungible)
- Y: Total verifications needed (required + threshold of optional)
- N: Total pool of available verifier networks
- 2 specific networks must always verify (X = required)
- 4 total verifications needed (Y = required + optional threshold)
- 6 networks available in the pool (N = total options)
- Any 2 of the remaining 4 optional networks can provide the additional verifications
Example: 2-of-2-of-2 Verifier Networks
This simple 2-of-2-of-2 configuration shows two required verifier networks with no optional networks.
1-of-2-of-3 Verifier Networks
This 1-of-2-of-3 configuration shows 1 required verifier network (solid border) and 2 optional verifier networks (dashed borders). Only 1 of the 2 optional networks needs to verify, providing flexibility while maintaining the required verification.
Configuration Per Channel
Message Libraries enable each channel to specify different X-of-Y-of-N configurations based on security requirements:Each channel’s Message Library enforces these X-of-Y-of-N requirements onchain, ensuring that the specified verification pattern is met before message execution.
Configuration Structures
Message Libraries define specific configuration structures for the three configurable aspects:Note: The configuration structures reference “DVNs” (Decentralized Verifier Networks) and “Executors”. You don’t need to understand their implementation details yet - just know that DVNs help determine which verifier networks to select, and Executors handle message delivery. Both will be explained in detail in Module 4: Verification & Execution Services.
Push Messaging Configuration (ULN)
Pull Messaging Configuration (lzRead)
Crosschain Services (Workers)
Message Libraries coordinate two types of off-chain worker services that handle verification and execution:4. DVNs (Decentralized Verifier Networks)
DVNs are LayerZero’s official term for the “verifier networks” discussed in previous sections. Each DVN is an independent verification service that implements one of the verification approaches from Module 1 (ZK proofs, committee consensus, light clients, middlechains, etc.). Key Properties:- Independent operation: Each DVN runs its own verification logic
- Configurable per pathway: Different DVN sets per channel
- X-of-Y-of-N coordination: Multiple DVNs work together via Message Library rules
- Verification diversity: Different DVNs use different trust models and verification methods
5. Executors
Executors are permissionless services that deliver verified messages to destination chains. Anyone can run an executor, making message delivery competitive and censorship-resistant. Key Properties:- Permissionless: Anyone can operate an executor
- Competitive: Multiple executors compete on speed and cost
- Optional: Applications can opt out and execute manually
- Separation from verification: Executors deliver, DVNs verify
Worker Service Architecture
Exit Criteria
Before proceeding to Module 4, you should be able to:- Describe the four layers (application, endpoint, libraries, workers)
- Explain what DVNs do and how to configure them
- Show how to set different verification per route
See Also
- Module 2: Verification & Interface Coupling - The problem LayerZero solves
- Module 5: Application Design Patterns - Building on the interface
- Security Stack & DVNs - Deep dive on DVN configuration
- Message Libraries - Technical library details