Documentation
Explore our guides and examples to build omnichain applications with LayerZero.
Quick Start
Blockchain Support
Try it out●
Explore LayerZero's cross-chain capabilities with these interactive examples.
/// @notice Send a string to a remote OApp on another chain
function sendString(uint32 _dstEid, string calldata _string, bytes calldata _options) external payable {
// 1. (Optional) Update any local state here.
// e.g., record that a message was "sent":
// sentCount += 1;
// 2. Encode any data you wish to send into bytes
bytes memory _message = abi.encode(_string);
// 3. Call _lzSend to dispatch the message
_lzSend(
_dstEid,
_message,
combineOptions(_dstEid, SEND, _options),
MessagingFee(msg.value, 0),
payable(msg.sender)
);
}
About LayerZero
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.
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.
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.
- Dial-in security per message: Pick which decentralized verifier networks secure each message between blockchains.
- 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.
- Simplify development: One framework, one mental model, every chain:
lzSend(_destination, _message, _options)
andlzReceive(_origin, _guid, _message)
. - Invisible UX: Users sign one tx; your contract handles cross-chain gas, swapping, and final settlement under the hood.
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.
Community and Support
Join our community to connect with other developers, ask questions, and share your projects:
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!