layerzero

Implement LayerZero V2 cross-chain messaging, OFT tokens, and DVN security configuration.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill layerzero-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layerzero
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/layerzero
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill layerzero-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI agents frequently confuse LayerZero V1 and V2 architectures, hallucinate contract addresses, misuse chain IDs instead of endpoint IDs, and misconfigure peers or fees — causing reverted transactions and failed cross-chain messages. This Skill provides verified V2 contract addresses, correct OApp/OFT patterns, and debugging workflows for building reliable omnichain applications. ## Core Features & Use Cases - OApp Development: Complete patterns for sending and receiving cross-chain messages via _lzSend/_lzReceive, including fee quoting, message options, and composed messages. - OFT & OFTAdapter Deployment: Deploy new Omnichain Fungible Tokens or wrap existing ERC-20s for cross-chain transfers, with shared decimals handling and rate limiting examples. - DVN Security Configuration: Configure required and optional Decentralized Verifier Networks per pathway with verified addresses for LayerZero Labs, Google Cloud, Polyhedra, and Animoca DVNs. - Use Case: Deploy an OFTAdapter on Ethereum for an existing ERC-20 and an OFT on Arbitrum, set peers bidirectionally, configure a 1-required + 1-of-2-optional DVN stack, and send tokens cross-chain with correct fee quoting. ## Quick Start Ask the agent to deploy a LayerZero V2 OApp on Ethereum and Arbitrum with bidirectional peers and send a test cross-chain message.

Frequently Asked Questions about layerzero

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I send a cross-chain message with LayerZero V2?

Inherit from OApp, build message options with OptionsBuilder including an lzReceive gas limit, quote the fee with _quote(), then call _lzSend with the destination endpoint ID, payload, options, and fee. The destination contract receives the message in its _lzReceive override.

What is the difference between LayerZero V1 and V2?

V2 replaces V1's monolithic oracle-plus-relayer model with modular DVNs and Executors, and uses OApp/EndpointV2 instead of LZApp/ILayerZeroEndpoint. Use @layerzerolabs/oapp-evm for V2; the solidity-examples package is V1 and should not be imported.

How do I bridge an existing ERC-20 token cross-chain with OFT?

Deploy OFTAdapter on the token's home chain to lock the existing ERC-20, and deploy OFT contracts on remote chains that mint representations. Set peers bidirectionally between all deployments, then call send() with a quoted MessagingFee.

Why does my LayerZero transaction revert with NoPeer or OnlyPeer?

NoPeer means the sending OApp has no peer registered for the destination endpoint ID; OnlyPeer means the receiving OApp does not recognize the sender. Call setPeer on both chains with the counterparty address left-padded to bytes32.

Why is my LayerZero message stuck at Verifying on LayerZero Scan?

DVNs wait for the configured block confirmations before verifying, so Ethereum messages typically need about 15 confirmations. Also verify your DVN configuration is valid for that chain pair, since not all DVNs support every pathway.

How do I configure DVNs for a LayerZero OApp?

Call setConfig on EndpointV2 with an encoded UlnConfig specifying confirmations, required DVNs, and optional DVNs with a threshold, for both the send and receive libraries. DVN address arrays must be sorted in ascending order or the transaction reverts.