LayerZero Documentation
LayerZero is an omnichain interoperability protocol that enables smart contracts to read from and write state to different blockchains. Developers can build omnichain applications (OApps) that can send state transitions, value transfers, and call smart contracts on other networks as if they were on a single blockchain. These operations can be defined simply as messages between blockchains, often referred to as generic message passing (GMP), which bridges the state information available from blockchain to blockchain.
LayerZero's design ensures that the core protocol contracts are immutable and non-upgradeable, ensuring your application continues to operate as expected indefinitely, while your contracts stay easily configurable and flexible to define each part of the protocol's message passing rails. This enables you to optimize the security, cost, and execution of messages according to your specific needs.
Why LayerZero?
Before LayerZero, users of blockchains were isolated per network, limiting the ability for decentralized applications (dApps) to share information, value, and composability. Message and value based bridges evolved from the necessity to reduce friction when moving state information between chains. Many early cross-chain solutions, however, relied on centralized services, a collection of fixed validators, or both to witness state transitions on a source blockchain before writing the corresponding updates on the destination network.
When hundreds of dApps rely on the same small validator set, one compromise puts every contract at risk. Attacks on fixed validator set bridges have been responsible for over $2 billion dollars of user funds lost.
LayerZero solves these problems by providing a secure, efficient, and user-friendly smart contract framework for building omnichain applications.
With LayerZero, you have access to:
- Immutable protocol / configurable edge: LayerZero’s transport layer is immutable, audited, and battle-tested; securing over $50 billion in transfer volume. Your own smart contracts stay configurable on top of this framework so you can ship features without directly modifying the transport layer.
- Dial-in security per message: pick which decentralized verifier networks secure each message between blockchains. You control the trust assumptions, not someone else.
- Expand instantly: ship to over 120+ different EVM, Solana, Move, TON compatible blockchains, with the same contract business logic.
- Unify liquidity: Omnichain Fungible Token (OFT) & Omnichain NFT (ONFT) standards: have one canonical supply, transport wherever it’s needed. No wrapped “IOU” tokens, so TVL stays in one global mesh.
- Simplify development: One framework, one mental model, every chain:
lzSend(_destination, _message, _options)
andlzReceive(_origin, _guid, _message)
using Solidity, Vyper, Rust, Move, or funC. - Invisible UX: users sign one tx; your contract handles cross-chain gas, swapping, and final settlement under the hood. OApps have moved > $50 billion without forcing users to understand the complexities of "the bridge.”
Ready to try sending your first message? Jump to the Quick Start below and send your first cross-chain message in under 2 minutes.
Use Cases
LayerZero unlocks a wide range of possibilities for decentralized applications, including:
- Omnichain tokens: Create and manage tokens that are available on multiple chains with a unified supply.
- Cross-chain lending and borrowing: Lend on one chain and borrow on another, all within a single transaction flow.
- Unified liquidity DEXes: Aggregate liquidity from multiple chains to provide deeper liquidity and better prices.
- Omnichain NFTs: Mint, transfer, and manage NFTs across different chains while preserving ownership records.
- Cross-chain governance: Allow governance protocols to operate across multiple chains for broader participation.
- Cross-chain gaming: Build games that leverage assets and functionalities from different chains, enriching gameplay experiences.
- Cross-chain data queries: Securely read real-time state from multiple networks, such as price feeds or contract balances, to trigger onchain operations like rebalancing liquidity pools, adjusting lending parameters or executing conditional logic across chains.
Quick Start Guide
Ready to start building with LayerZero? Here’s your roadmap:
1. Choose Your Environment
2. Choose a Starting Contract Standard
3. Understand Core Concepts & Architecture
- What is LayerZero?: Understand what LayerZero fundamentally solves and why it exists.
- Protocol Overview: Understand how messages flow between chains.
- Security Stack (DVNs): Learn about decentralized verifier networks that validate cross-chain messages.
- Executors: Discover how messages are delivered and executed on destination chains.
4. Dive Deeper
- Omnichain Application Standard for generic message passing.
- Omnichain Tokens for moving fungible and non-fungible asset value transfers between blockchains.
- Omnichain Composability for how LayerZero connects smart contracts via cross-chain calls.
- Omnichain Queries: Learn how to query external on-chain data from another blockchain for use in another blockchain's smart contract.
- Security & Executor Config to lock in your DVNs and message libraries.
- Gas Fees & Options for cross-chain transaction execution settings.
Key Concepts
Below are common terms you’ll encounter in the docs. A more detailed listing can be found in the Glossary.
- OApp (Omnichain Application): A smart contract that uses LayerZero to send and receive messages across different blockchains.
- Endpoint: Immutable smart contracts deployed on each supported chain that serve as the entry and exit points for LayerZero messages.
- Endpoint ID (EID): A unique identifier for each LayerZero Endpoint contract, used for routing messages between chains.
- Decentralized Verifier Networks (DVNs): Independent entities that validate messages between chains for security and integrity.
- Executor: An off-chain service that executes messages on the destination chain after verification.
- Message Library (MessageLib): Smart contracts for packing message payloads on the source chain and verifying them on the destination.
- Security Stack: The combination of DVNs and other parameters that an application configures for message authenticity.
- Composed Message: A cross-chain message that triggers another cross-chain message (nested calls).
Developer Tooling
LayerZero offers a suite of tools to streamline your development experience:
- LayerZero Scan: Comprehensive block explorer for tracking and debugging cross-chain messages.
- TestHelper (Foundry): Simulate cross-chain transactions in Foundry tests.
- Hardhat Toolbox: A framework for building, configuring, and deploying OApps locally.
Community and Support
Join our community to connect with other developers, ask questions, and share your projects:
Start Building
You are now ready to build the next generation of omnichain applications with LayerZero. Dive into the documentation, explore the examples, and join our community to unleash the full potential of cross-chain development!
Your Feedback Shapes This Documentation
If anything is unclear or missing, we invite you to open an issue on GitHub, ask in Discord, or get in touch with the team. Happy building!