LayerZero 백서

LayerZero

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 3쪽 중 1쪽

LayerZero Ryan Zarick Bryan Pellegrino Isaac Zhang Thomas Kim Caleb Banister LayerZero Labs Abstract In this paper, we present the first intrinsically se- cure and semantically universal omnichain interoper- ability protocol: LayerZero. Utilizing an immutable endpoint, append-only verification modules, and fully- configurable verification infrastructure, LayerZero pro- vides the security, configurability, and extensibility nec- essary to achieve omnichain interoperability. LayerZero enforces strict application-exclusive ownership of proto- col security and cost through its novel trust-minimized modular security framework which is designed to univer- sally support all blockchains and use cases. Omnichain applications (OApps) built on the LayerZero protocol achieve frictionless blockchain-agnostic interoperation through LayerZero’s universal network semantics. 1 Introduction Blockchain interoperability represents an ever-growing challenge as the diversity of chains continues to grow, and the importance of connecting the fragmented blockchain landscape is increasing as applications seek to reach users across a progressively wider set of chains. We present LayerZero, the first omnichain messaging protocol (OMP) to achieve a fully-connected mesh net- work that is scalable to all blockchains and use cases. In contrast to the monolithic security model of other cross-chain messaging services, the LayerZero protocol uses a novel modular security model to immutably im- plement security. This approach can still be extended to support new features and verification algorithms. In- trinsic security against censorship, replay attacks, de- nial of service, and in-place code modifications is de- signed into immutable Endpoints. Less fundamental ex- trinsic aspects of security (e.g., signature schemes) are Copyright © 2023 LayerZero Labs Ltd. All rights reserved. (2024-01-23) Version 1.1: Fix typos. (2024-03-07) Version 1.2: Fix figure typo. (2025-05-13) Version 1.3: Fix typo in Table 3 Cross-chain Compatibility Group A Compatibility Group B Extrinsic Security Network Semantics Omnichain Compatibility Group A Compatibility Group B Figure 1: The omnichain fully-connected mesh network has universal network semantics for all connected chains and security specialized to each link. isolated into independently-immutable modules. As a protocol, LayerZero is not bound to any infrastructure or blockchain; all components other than the endpoint can be interchanged and configured by applications built on LayerZero. We illustrate the omnichain fully-connected mesh net- work in Figure 1. Each chain is directly connected to every other chain, and while the extrinsic security (Sec- tion 2.1) may be different for different chain pairs (il- lustrated by the colored solid lines), the guarantees of eventual, lossless, exactly-once packet delivery should be uniform and never change. LayerZero’s network channel semantics, including ex- ecution features, configuration semantics, censorship re- sistance, and failure model, are universal. These uni- versal semantics allows application developers to easily architect secure, chain agnostic omnichain applications (OApps). 1 Integrity Layer Failure model OMP    Channel validity Packet censorship Packet replay Buggy updates Invalid reconfiguration Channel liveness Denial of service Infrastructure health Administrator health Data validity Cryptographic attack Malicious infrastructure Data liveness Data loss on blockchain Table 1: We divide protocol integrity into four properties. Data liveness depends on the underlying blockchains and cannot be secured by the OMP. The remainder of this paper is organized as follows. First, Section 2 explains the overarching fundamental principles underlying the LayerZero protocol. Section 3 describes the protocol design and highlights how each component is architected for security. Finally, Section 4 presents examples of how LayerZero can easily be ex- tended to support a wide range of additional features in a blockchain-agnostic manner. 2 Principles The responsibilities of an OMP can be condensed into two requirements: intrinsic security and universal se- mantics. Existing messaging services fail to implement one or both of the above requirements and thus suffer from two fundamental deficiencies: monolithic security and overspecialization. In the remainder of this section, we contextualize security and semantics within the cross- chain messaging paradigm, describe how existing cross- chain messaging systems fall short of these goals, and outline how LayerZero is designed from the ground-up to overcome these shortcomings. 2.1 Security The first and most important requirement of OMPs is that they should be secure. We divide security into intrinsic and extrinsic security, and while all messaging systems implement extrinsic security, few provide intrinsic secu- rity. Intrinsic security refers to protocol-level invariants of lossless (censorship resistance), exactly-once (no re- play), eventual (liveness) delivery. Extrinsic security en- compasses all other security properties, such as signature and verification algorithms. Most existing messaging services have taken an ad- hoc approach to security, continuously updating a single monolithic end-to-end security model to accommodate Extrinsic Security Cost Current Future Figure 2: The pareto frontier of extrinsic security vs cost continually changes due to advancements in technology. chains as they are added to their network. These services invariably utilize forced, in-place updates to a shared se- curity model, and thus cannot provide long-term security invariants for OApps to build upon. To provide long- term security invariants in LayerZero, we chose instead to modularize security and enforce strict immutability for all modules. Table 1 illustrates how we divide protocol integrity into channel and data integrity. Each of these integrity layers is further subdivided into validity and liveness properties. We more formally define intrinsic security to cover channel validity and liveness, and extrinsic se- curity to cover data validity. In this paper, we refer to the extrinsic security configuration as the Security Stack. Monolithic shared security systems force the same Se- curity Stack on all applications, while isolated security systems allow a different Security Stack per OApp. Intrinsic security can and should be universally se- cured based on first principles. In contrast, optimal, trustless communication across blockchains is impossi- ble, and the continuous advancement in verification al- gorithms and blockchain design necessitatesextensibility and configurability of extrinsic security. This is true even in special cases such as L1–L2 rollups; the possibility of hard forks necessitates L2 contract upgradability, thus making the L2 contract owner a trusted entity. It is infeasible to formally verify the extrinsic security of any nontrivial code given the many underlying lay- ers of execution and the reliance of cryptographic algo- rithms on the computational intractability of NP prob- lems. As a result, the most practical measure of security is an economic one: a non-upgradable smart contract’s security is directly proportional to how many assets it has secured and for how long. Thus, the implications of extrinsic security isolation are clear: OMPs must guar- antee indefinite access to well-established, extrinsically secure code while still allowing protocol maintainers to 2 extend the protocol. The impossibility of trustless com- munication thus implies that extrinsic security exists on a constantly shifting pareto frontier (Figure 2) and should be customizable to OApp-specific requirements. To provide intrinsic security, the OMP must guarantee that an OApp’s Security Stack only changes when the OApp owner opts in to the change. This implies that sys- tems designed to allowin-place code upgrades can never be intrinsically secure. Replaceability of existing code permits the permanent deprecation of well-established extrinsically secure code and the potential introduction of vulnerable code. Current approaches to in-place se- cure upgrades involve careful testing and audits, but his- tory has shown [1, 3, 4] that this process is not foolproof and can overlook severe vulnerabilities. To guarantee long-term security invariants, OMPs must be architected to isolate each OApp’s Security Stack from software up- dates and other OApps’ configurations. 2.2 Universal Semantics The second requirement of OMPs is universal semantics, or the ability to extend and adapt the network primitive to all additional use cases and blockchains. Execution semantics (i.e., feature logic) should be both chain-agnostic and sufficiently expressive to allow any OApp-required functionality. A key insight we had when designing LayerZero is that feature logic (execu- tion) can be fully isolated from security (verification). This not only simplified protocol development, but also eliminates concerns about impact to protocol security when designing and implementing execution features. The other aspect of universal semantics is universal compatibility of the OMP interface and network seman- tics with all existing and future blockchains. The impor- tance of semantic unification cannot be understated, as OApps cannot scale if every additional blockchain in the network incurs significant engineering cost to accommo- date different interfaces and network consistency mod- els. In practice, an OMP must have a unified interface, transmission semantics, and execution behavior regard- less of the source and destination blockchain character- istics. 3 Core protocol design We divide LayerZero into four components (Figure 3): an immutable Endpoint that implements censorship re- sistance, an append-only collection ( MessageLib Reg- istry) of onchain verification modules ( MessageLibs), a permissionless set of Decentralized Verifier Networks (DVNs) to verify data across blockchains, and permis- sionless executors to execute feature logic in isolation to the cross-chain message verification context. Tying the Verification Layer Execution Layer Transport Executors (Permissionless) Sender OApp Receiver LayerZero Endpoint Lossless Channel Immutable MessageLibMessageLib Append-Only Immutable Immutable Datalink (DVNs)Permissionless Executors Permissionless DVN
 K of N consensus DVN
 Native Bridge DVN
 Zero-Knowledge Endpoint.send emit MessageLib.send lzReceive verify commitVerification MessageLib Manager OApp Config MessageLib Registry Figure 3: LayerZero is divided into execution and veri- fication layers. The verification layer securely transmits data between blockchains, and the execution layer inter- prets this data to form a secure, censorship resistant mes- saging channel. components together is the OApp Security Stack, which defines the extrinsic security configuration of the proto- col and is modifiable exclusively by the OApp owner. Messages in LayerZero are composed of a payload and routing information (path). These messages are serial- ized into packets before they are transmitted across the mesh network. Packets are verified by the verification layer on the destination blockchain before they are com- mitted into the lossless channel. The packets are then read from the channel and delivered by executing the lzReceive callback on the destination OApp contract. The LayerZero Endpoint secures channel validity through OApp-exclusive Security Stack ownership in conjunction with an immutable channel that implements censorship resistance, exactly-once delivery, and guaran- teed liveness. Endpoint immutability guarantees that no external entity or organization can ever forcibly change the security characteristics an OApp’s Security Stack. Individually immutable MessageLibs collectively form the MessageLib Registry, and each MessageLib is an extrinsically secure interface that verifies packet data 3 Security Stack Security Stack ULN MessageLib Registry Source Destination Sender OApp Receiver OApp LayerZero Protocol LayerZero Protocol LayerZero Endpoint LayerZero Endpoint MessageLib Registry Lossless Channel Lossless Channel 1 lzSend ExecutorsExecutors DVNs commitVerification lzReceive 4 3 verify2 MessageLib Version
 DVN Addresses
 OptionalThreshold MessageLib Version
 DVN Addresses
 OptionalThreshold ULN Encode
 Packet PacketSent PacketReceived PacketVerifiedAssign
 Nonce Enforce
 losslessness PayloadVerified Figure 4: Steps to send a message using LayerZero. integrity before allowing messages to be committed to the Endpoint. Existing MessageLibs cannot be modified, thus making the MessageLib Registry append-only, and each Security Stack specifies exactly one MessageLib. Security Stack ownership semantics in conjunction with MessageLib immutability enable applications to poten- tially use the same Security Stack forever. Each DVN is an aggregation of verifiers that collec- tively verify the integrity of data shared between two independent blockchains. DVNs can include both of- fchain and/or onchain components, and each Security Stack can theoretically include an unbounded number of DVNs. The underlying DVN structure can leverage any verification mechanism, including but not limited to zero-knowledge, side chains, K-of-N consensus, and na- tive bridges. For brevity, we refer to the abstract collec- tion of MessageLib, DVNs, and other hyperparameters as the Security Stack, and a serialized form of the Secu- rity Stack is assumed to be written to each chain. Channel liveness (eventual delivery) is guaranteed through permissionless execution in conjunction withSe- curity Stack reconfiguration . Assuming the liveness of the source and destination blockchains, LayerZero chan- nel liveness can only be (temporarily) compromised if (1) the DVNs in the Security Stack experience faults, or (2) the configured executor stops delivering messages. If too many configured DVNs stop verifying messages, the OApp can regain liveness by reconfiguring its Security Stack to use different DVNs. Packet delivery (execution) is permissionless, so any party willing to pay execution gas costs can deliver packets to restore channel liveness. Interaction between LayerZero components is mini- mized and standardized to reduce software bug surfaces (Figure 3). LayerZero’s modularization and configura- bility also enables quick prototyping of the protocol on new chains. Using a simple whitelist as a placeholder for MessageLib allows parallel development and testing of all components, expediting expansion of the mesh net- work to new chains. 3.0.1 LayerZero packet transmission Before describing each component in detail, we present an overview of how packets are transmitted in LayerZero as shown in Figure 4. The LayerZero mesh network is formed by the deployment by a protocol administrator of a LayerZero Endpoint on each connected blockchain. In this example, the OApp sends a LayerZero message from a sender contract to a receiver contract across the LayerZero mesh network. For illustration purposes, the MessageLib we use in this example is the Ultra Light Node [6] (Section 3.2.1). During initial setup, the OApp configures its Security Stack on the LayerZero Endpoint on the source and desti- nation blockchains. The MessageLib version configured in the Security Stack determines the packet version. In step 1⃝, the sender calls lzSend on the source chain LayerZero Endpoint, specifying the message pay- load and the path. This path is associated with an inde- pendent censorship resistant channel, and is composed of the sender application address, the source Endpoint ID, the recipient application address, and the destination Endpoint ID. The source Endpoint then assigns a gapless, 4 Field name Type Header    Packet version uint8 Nonce uint64 Source Endpoint ID uint32   PathSender uint256Destination Endpoint ID uint32Receiver uint256 GUID uint256 Message Payload bytes[] Table 2: LayerZero packets are composed of a header and body. The header includes the packet version and path. The body is composed of the actual message pay- load. Packets are identified by their globally unique iden- tifier (GUID). monotonically-increasing nonce to the packet. This nonce is concatenated with the path, then the result is hashed to calculate the global unique ID (GUID) of the packet. This GUID is used by offchain and onchain workers (e.g., executors, DVNs) to track the status of LayerZero messages and trigger actions. The source Endpoint reads the OApp Security Stack to determine the correct source MessageLib (ULN in this example) to encode the packet. The source MessageLib processes the packet based on the configured Security Stack, rendering payment to the configured DVNs to ver- ify the message on the destination MessageLib and op- tionally specified executors to trigger offchain actions. These DVN and executor identifiers along with any rele- vant arguments are serialized by MessageLib into an un- structured byte array called Message Options. After the ULN encodes the packet and returns it to the Endpoint, the Endpoint emits the packet to conclude the LayerZero send transaction. In step 2⃝, the configured DVNs each independently verify the packet on the destination MessageLib; for ULN, this constitutes storing the hash of the packet pay- load. After a threshold of DVNs verify the payload (see Section 3.2.1), a worker (e.g., executor, DVN, user) com- mits the packet to the Endpoint in step 3⃝. The Endpoint checks that the payload verification reflects the OApp- configured Security Stack before committing to the loss- less channel. Finally, in step 4⃝, an executor callslzReceive on the committed message to execute the Receiver OApp logic on the packet. Step 4⃝ will revert to prevent censorship if the channel cannot guarantee lossless exactly-once de- livery. 3.1 LayerZero Endpoint The LayerZero Endpoint, implemented as an immutable open-source smart contract and deployed in one or more instances per chain, provides a stable application-facing interface (Table 3), the abstraction of a lossless network channel with exactly-once guaranteed delivery, and man- ages OApp Security Stacks. The immutability of the LayerZero Endpoint guarantees long-term channel valid- ity by enforcing update isolation, configuration owner- ship, and channel integrity. The Security Stack is key to LayerZero’s channel liveness guarantee, as it mediates the trust–cost relationship between OApps and the per- missionless set of DVNs. OApps call send on the Endpoint to queue a message to be sent through LayerZero, specifying the path (Ta- ble 2), the message payload, and an optional byte array (Message Options) containing serialized options to be in- terpreted by MessageLib. Message Options is purposely unstructured, improving extensibility as we discuss in Section 4. The complement to send is lzReceive, which is executed on the destination chain to consume the message with the specified GUID. On the destina- tion chain, the Endpoint handles calls to lzReceive and getInboundNonce, enforcing lossless exactly-once de- livery to protect the integrity of the message channel. lzReceive delivers the verified payload of this mes- sage to the OApp, provided the message can be losslessly delivered. getInboundNonce returns the highest loss- lessly deliverable nonce, computing the highest nonce such that all messages with preceding nonces have been verified, skipped, or delivered. To handle erroneously sent messages or malicious packets, OApps either call clear to skip delivery of the packet in question or skip to skip both verification and delivery. In addition to clear and skip, the Endpoint provides two convenience functions nilify and burn. Nilify in- validates a verified packet, preventing the execution of this packet until a new packet is committed from Mes- sageLib; this function can be used to proactively inval- idate maliciousl
프로젝트로 돌아가기