Blockchain & Web3. LayerZero v2 Protocol Architecture. Part 1
LayerZero is an immutable, censorship-resistant, and permissionless protocol that allows any blockchain user to send, verify, and execute messages on a supported destination network.
The documentation says that, but what that means is hard to understand. LayerZero is NOT a separate blockchain or a bridge between them. Moreover, as Brian Pellegrino (CEO of LayerZero Labs) states, it is not a standard for exchanging messages between blockchains but a protocol for transferring data (which is transmitted as messages). In addition to exchanging data, the protocol provides the infrastructure for executing and verifying this data in transit.
Globally, the protocol offers its vision of a decentralized solution to the problem of blockchain interoperability. It emphasizes extensibility, flexibility in security settings, and separation of data verification and execution functionality, distinguishing it from other solutions. The second version of the protocol positions itself as an omnichannel solution (Omnichain Messaging Protocol—OMP).
Interoperability is the ability of a product or system with completely open interfaces to interact and function with other products or systems without restrictions on access and implementation.
In short, cross-chain is about the interaction of two different blockchains via bridges; multichain implies the deployment of a specific DApp in other blockchains, which also includes modular blockchains; omnichain is the creation of a base layer (Layer 0) on top of which various blockchains and DApps can be located. The advantage of omnichain solutions is the universal logic of message transmission and flexible security settings for each network.
Cross-chain (left): Networks are connected via separate bridges between chains. The critical point is that each link must be configured individually, and interactions between different compatibility groups (e.g., “Compatibility Group A” and “Compatibility Group B”) require additional layers of security and integrations. These are essentially disjointed connections between chains, which increases the complexity of managing connections and security.
Omnichain (right): In this approach, each chain can directly interact with any other in the network via unified network semantics. In LayerZero, each link between chains is unified, but the security for each link can be configured individually.
LayerZero Principles
The OMP (Omnichain Messaging Protocol) is based on two main principles: security and universal semantics.
Security
Security is divided into internal (or built-in) and external. Most protocols implement only external security, ignoring internal security.
Internal Security includes several key invariants:
- Lossless (censorship-resistant) — a guarantee that the message will retain its integrity and be delivered without losing or changing data.
- Exactly-once (impossibility of re-execution) — one message can be processed by the recipient only once.
- Eventual delivery (survivability) — the message will be delivered eventually, even if temporary failures occur at any stage.
External security covers other aspects, such as signature and verification algorithms. This layer can be customized and changed depending on the needs of a specific application.
Protocol integrity is divided into two levels: integrity of the data transmission channel and integrity of the data itself. Each level includes correctness (validity) and survivability (liveness). Internal security is responsible for the correctness and survivability of the channel, and external security is responsible for the correctness of the data. The whitepaper contains the following table.
All this forms a modular Security Stack, configured individually for each OApp (omnichain application). This is done in contrast to monolithic systems, where changing one code can compromise the entire protocol.
Another advantage is that changes to the security stack are made only by the OApp owner's decision. Such updates are isolated, which prevents failures of the entire system in the event of errors and vulnerabilities in updates. LayerZero uses the immutability approach — updates are rolled out through new versions of modules that are implemented securely, and old versions remain in working order and are never removed.
Universal semantics
The protocol must be universal in its structure to support any blockchain and provide a uniform behavior for all interactions. LayerZero aims to standardize interactions between blockchains. Applications running on LayerZero should be independent of the specifics of individual blockchains, whether EVM or non-EVM compatible chains. Universal semantics includes two key aspects
- Execution semantics (OApp function logic): The execution semantics must be chain-independent and expressive enough to allow any functionality OApp requires. This makes the protocol independent of the specifics of each chain.
- Interface unification: A unified interface for passing messages between blockchains must exist. This will eliminate the need to develop unique solutions for each new chain and allow OApp to scale faster.
The lack of unified interfaces and message-passing semantics complicates the development of applications that work on multiple blockchains. LayerZero solves this problem by allowing developers not to consider the specifics of each chain separately.