Mastering DVNs
In LayerZero V2, security is handled by Decentralized Verifier Networks (DVNs). Instead of relying on a single oracle, developers can require a 'quorum' of multiple verifiers to attest to a message.
For example, a high-value DeFi protocol might require 3 out of 5 verifiers (e.g., Google Cloud, Animoca, and a local node) to agree before a transaction is executed, significantly raising the cost of an exploit.
The Pre-Crime Framework
Pre-Crime is a proprietary security layer that allows a Relayer to stop a transaction before it happens. It simulates the state change on the destination chain and checks it against a set of 'Pre-Crime' conditions defined by the developer.
If the simulation results in an illegal state—such as a vault becoming undercollateralized or a total supply mismatch—the message is never delivered, preventing the exploit from ever touching the destination chain.
Cross-Chain Invariants
When building at the advanced level, you must maintain global invariants. A common pattern is 'Global Debt Tracking'.
Essential security patterns:
- Rate Limiting: Cap the total value that can flow out of a chain within a specific timeframe.
- Circuit Breakers: Implement a pause mechanism that can be triggered if the DVN detects suspicious volume.
- Message Path Isolation: Ensure that a compromise on one minor chain cannot affect the liquidity or state on a major chain.
Watch & Learn
LayerZero V2 Security Deep Dive
Explaining the modular security stack and DVN configurations.
Challenge
Final quiz
Earn up to 150 points
2 questions · Advanced
How does Pre-Crime prevent a cross-chain exploit?