fourpillars
thubmnail
InfrastructureWeb3

LayerZero: Pushing the Boundary of the Cross-Chain Capabilities

June 04, 2024·17 min read
Key Takeaways
1. On LayerZero: Its Journey
1.1 Initiation
1.2 Development
1.3 The Next Phase, LayerZero V2
2. So how does LayerZero Work?
2.1 Core Architecture Components
2.2 Transaction Lifecycle
3. What Can Be Done with LayerZero?
3.1 General Messaging
3.2 Omnichain Standard
3.3 Token Bridging on LayerZero
4. Past Criticisms and Path Forward
Researcherresearcher-profile
xpara
researcher-profile
ISKRA

Key Takeaways

  • Founded in 2021, LayerZero addressed blockchain interoperability with secure, fast, and affordable cross-chain messaging.

  • Key imporvements in LayerZero V2 include a programmable security stack, simplified protocol interfaces, and horizontal composability.

  • Important primitives LayerZero enabled include general messaging, omnichain standards, and token bridging, with applications such as Clusters for name services and Iskra for gaming tokens.

  • Despite past criticisms, LayerZero has incorporated feedback to improve security, user control, and customization in V2, enhancing reliability and addressing past issues.

Blockchain by its nature is inherently isolated, equipped with its own state machine, storage, and execution logic for state changes. A fitting real-world analogy is a country with its unique language and territory. This isolation has historically posed challenges in creating systems capable of transmitting messages or tokens across different blockchains. Key concerns include whether a native asset retains its status when transferred to another blockchain and the risk of malicious actions by the transferring party.

To mitigate blockchain fragmentation, numerous teams have initiated efforts ranging from creating distinct infrastructures with trusted intermediaries like Wormhole to incorporating interoperability solutions directly within Layer 1 frameworks, such as IBC.

LayerZero, founded in 2021, has been working on reducing this fragmentation. It has been the leading project to build important primitives in the interoperability landscape. The features LayerZero built have always been in the frontier and are well adopted. In this article, let's look into LayerZero's journey, its architecture, and what can be possible with LayerZero.

1. On LayerZero: Its Journey

1.1 Initiation

Source: New Partnership: The Legend of LayerZero | Sequoia Capital

Previously, interoperability issues between blockchains were not adequately addressed, as most use cases involved sending tokens as wrapped tokens. Bryan Pellegrino, Ryan Zarick, and Caleb Banister, co-founders of LayerZero, began developing a protocol designed to enable smooth communication between blockchains. Their solution facilitates the transfer of assets or information across different chains, emphasizing affordability, speed, and security. The trio, who became friends during their time in the computer network research labs at the University of New Hampshire, named their enterprise LayerZero. This name reflects its essential role in underpinning applications, emphasizing its foundational importance in the blockchain ecosystem.

LayerZero introduced a novel, user-centric method to consolidate data at the application level. If successful, It could enhance the crypto landscape. However, at that stage, many new primitives needed to be developed, as the research in interoperability itself was very early.

1.2 Development

In 2021, the concept of interoperability was limited, referring to the bridging of assets between chains. LayerZero, along with a few other teams, introduced the idea of arbitrary message delivery, which allows applications to send any type of information (data, token, logic, etc) between chains. This led to the development of primitives like Omnichain Fungible Tokens (OFT) — which extend any ERC20 token across many chains at once, natively and Omnichain Applications — allowing developers to build on many chains at once.

1.3 The Next Phase, LayerZero V2

LayerZero has experienced consistent growth and launched several initiatives in the past, and are now indisputably leading the interoperability space. The protocol has also made significant changes since its launch.

1.3.1 V2 Launch

Several key improvements were made in LayerZero V2 compared to V1:

  • New Security & Execution: V2 introduced a programmable security stack using different Decentralized Verifier Networks (DVNs) for message verification. Message verification and execution are now separated, with the Security Stack handling verification and Executors handling execution.

  • Simplified Protocol Contract Interfaces: It reduces complexity in sending and receiving messages. Path-Specific Libraries enable developers to configure different MessageLibs for specific pathways. Horizontal Composability allows external calls to be containerized into new message packets, ensuring clear separation between message receipt logic and external call logic.

2. So how does LayerZero Work?

2.1 Core Architecture Components

There are three main components in the architecture of LayerZero V2:

  1. Endpoint Contracts: These act as an entry point for cross-chain messages.

  2. DVN (Decentralized Verifier Network): This manages the integrity and security of cross-chain message delivery between blockchains.

  3. Executor: This executes the messages sent to the other blockchain, according to the instructions in the message.

2.1.1 Endpoint Contracts

Source: LayerZero Endpoint | LayerZero

The Endpoint contract is a key component in the LayerZero architecture that enables cross-chain communication between different blockchain networks. It acts as a gateway for sending and receiving messages across chains. The Endpoint contract provides functions for sending messages, which include the necessary parameters such as the destination chain, recipient address, and payload data. It also handles incoming messages, validates their integrity and authenticity, and processes them by executing associated actions or callbacks on the receiving chain.

The Endpoint contract integrates with the configured Security Stack of the OApp (Omnichain Application), which consists of required and optional Decentralized Verifier Networks (DVNs) that verify the payloadHash of the message. Each message sent through the Endpoint contract is assigned a unique nonce representing the state of the message verification process. When a message is verified and ready to be executed, it is committed to the corresponding messaging channel, and any caller, such as an Executor, can retrieve the message and trigger its execution on the destination chain. The Endpoint contract abstracts the complexities of cross-chain communication and provides a standardized interface for OApps to send and receive messages across different blockchain networks.

2.1.2 DVN

Source: Security Stack (DVNs) | LayerZero

The Decentralized Verification Network (DVN) in LayerZero's architecture is pivotal for securing and validating messages across different blockchains. LayerZero's V2 update has enhanced this aspect by transitioning from a model relying on application-selected Oracles and Relayers to a more robust system that includes modular Security Stacks and permissionless Executors. These Security Stacks are configurable combinations of DVNs, which can include native bridges, third-party bridges, oracles, and other verification entities. This allows applications to select a tailored set of DVNs to ensure the integrity of cross-chain messages before they are executed on the destination chain.

The flexibility of the DVN setup allows for varying levels of redundancy and security checks, enhancing the protocol's adaptability to different security needs and potential threats. By allowing permissionless participation in the verification process, LayerZero ensures a wide and diverse set of validators, increasing the decentralization and robustness of message verification. This approach is fundamental to maintaining high security and trust across transactions in the LayerZero ecosystem, emphasizing its commitment to providing a scalable and reliable cross-chain communication protocol

Here's a detailed exploration of how DVNs function within LayerZero’s architecture:

  1. Message Integrity Checks: Each DVN is tasked with validating the payloadHash of messages. The payloadHash is essentially a cryptographic digest of the message content, ensuring that the information has not been tampered with during transit.

  2. Decentralized Verification: DVNs operate independently to check the payloadHash using their distinct verification schemas. This decentralized mechanism ensures that the verification process is not reliant on a single point of failure, enhancing the security of cross-chain communications.

  3. Threshold Consensus: LayerZero allows for the configuration of both required and optional DVNs within an OApp’s (omnichain application) Security Stack. A message can be committed as verified on the destination chain not just based on a singular DVN approval but often requires meeting a specified threshold of agreement among multiple DVNs.

2.1.3 Executor

In the LayerZero protocol, an Executor is a critical component responsible for processing and executing the actions specified in cross-chain messages once they have been verified and authorized. The Executor functions as the final actor or agent that carries out the commands within a message after all security verifications via the Decentralized Verifier Network (DVN) and any other necessary checks are complete. These are main roles of the Executor:

  1. Acting on Verified Messages: Once a message's integrity and authenticity are confirmed by the required threshold of DVNs, it is the Executor’s role to take this verified message and act upon it. This involves performing the actual operations dictated by the message on the destination chain.

  2. Interacting with Smart Contracts: Typically, executors interact with specific smart contracts on the destination blockchain. They call functions or methods of these contracts as specified by the incoming messages, effectively translating verified cross-chain data into actionable changes on the destination chain.

The execution component essentially bridges the gap between message verification and final transaction or state change execution on a blockchain. Without the Executor, even perfectly verified messages would remain unexecuted, resulting in no real-world effect despite the successful cross-chain communication.

2.2 Transaction Lifecycle

Source: What is LayerZero V2? | LayerZero

The lifecycle of a LayerZero message involves a sequence of well-defined steps to enable cross-chain communication from a source to a destination blockchain through an Omnichain Application (OApp). Here’s a explanation of each step on the transaction lifecycle:

2.2.1 Message Initiation

  • A user initiates cross-chain communication by invoking the _lzSend method in the OApp, which triggers the send method on the LayerZero Endpoint. It provides information such as message parameters and the refund address for fee management.

  • Fee Calculation and Submission: If the transaction fees are to be paid in lzToken and if lzToken is unavailable (address set to 0x0), the transaction will revert. The user or the OApp needs to ensure the correct amount of fees in native or lzToken currency is provided to cover the estimated costs.

  • Message Generation and Emission: After processing the fees and ensuring all parameters are correctly set, the Endpoint's on-chain Message Library (MessageLib) generates a Message Packet. This packet is constructed according to the configuration specified by the OApp owner and is emitted as an event, which includes data like the target blockchain, recipient address, and the actual message content.

2.2.2 Message Security and Verification

  • Event Listening: In this stage, a Security Stack, where the DVN infrastructure is included, listens for the emitted event.

  • Block Confirmations and Verification: Here, the system waits for a predetermined number of block confirmations to ensure transaction finality. After this, it proceeds to verify the message's integrity.

  • Payload Verification: This step involves the verification of the payloadHash on the destination chain's MessageLib. It confirms that the received message matches the sent packet.

2.2.3 Message Execution

  • Message Receipt: A caller, usually an executor or a designated smart contract, calls the lzReceive function on the destination Endpoint.

  • Execution of Message: The destination Endpoint now triggers the defined _lzReceive function in the OApp contract at the destination, where the actual logic specified by the message is executed.

  • Validation of Execution Context: The receiving endpoint executes the message and may validate any untrusted extra data provided by the executor, ensuring the sender and any additional context meets the security requirements.

  • Confirmation and Completion: The operation concludes with emitting a PacketDelivered event, confirming the successful delivery and execution of the message.

3. What Can Be Done with LayerZero?

LayerZero has built a robust cross-chain standards and infrastructure that enables dapps and users to seamlessly expand their activities across multiple blockchains. Over the years, as LayerZero has been operating, the number of projects leveraging its infrastructure has grown significantly. This growth is particularly evident in the DeFi sector, where projects are utilizing LayerZero to tap into liquidity and user bases from various chains, enabling cross-chain yield farming, lending, and trading.

In the following sections, let’s explore the potential use cases and examine how different projects are utilizing LayerZero's cross-chain infrastructure.

Source: LayerZero V2 Deep Dive. Everything you need to know about V2

3.1 General Messaging

LayerZero emerged as the early pioneer allowing GMP, also known as AMB (Arbitrary Messgage Passing) which is the capability to send message and execute it in the other blockchain. The architecture resembles that of IBC in Cosmos, but their ultra light client (ULN) allowed to be more cost-effective and usable in the other ecosystem including Ethereum. This opened up possibilities to allow more general usage of interoperability solutions.

3.1.1 Clusters, Universal Name Service

Source: LayerZero V2 Case Study: Clusters

Clusters is the first cross-chain name service that simplifies managing multiple wallets on various blockchains by allowing users to use a single universal name across all platforms. It addresses the issue of wallet fragmentation experienced by users who operate several wallets on different blockchains. This functionality is facilitated by LayerZero, which ensures that a name registered on one blockchain is recognized on all other LayzerZero’s supporting blockchains. It leverages the GMP functionalities of LayerZero for this operation.

3.2 Omnichain Standard

LayerZero has developed unique cross-chain standards known as "Omnichain Standards." This includes a token standard called OFT (Omnichain Fungible Token) and OApp (Omnichain App), which provides a GMP interface for cross-chain activities.

The OFT Standard allows for the smooth transfer and composition of assets across various blockchain networks. This is achieved through a mint-and-burn mechanism, where tokens are initially burned on the source blockchain and then an equal quantity is minted on the target blockchain. This mechanism ensures a consistent token supply across all connected chains, removing the need for wrapped assets or additional liquidity pools for bridging. Currently, several omnichain tokens such as xERC20, NTT by Wormhole, ITS by Axelar, and CAT by Nexa utilize this mechanism. However, the OFT Standard is the most widely adopted.

Source: Explaining the OFT Standard. OFTs are tokens that move across… |

3.2.1 ISKRA, The Gaming Token Hub in Ethereum

ISKRA, through LayerZero, aims to become the gaming token hub for other gaming chains. Given that games require custom infrastructure, there will be a need to build its own rollup. This could lead to fragmentation in liquidity and user experience. To counter this, ISKRA is constructing a liquidity hub with LayerZero. All gaming chain tokens will be issued natively on their respective chains and will have an OFT-Adaptor. This adaptor will allow the tokens to be natively transferred to the ISKRA Hub Chain. Also, the DEX and Bridge contract in the Hub Chain will make overall interaction seamless.

Iskra is a web3 gaming community platform designed to integrate blockchain technology into the gaming experience. It has a vision to serve as a single destination for both players and developers, offering unique rewards based on community participation. They raised around $50M from prominent investors in Korea and are posed to build and bring high-quality games on-chain.

3.2.2 Ethena

Source: Ethena: Growing a Synthetic Dollar into the billions | Four Pillars

Ethena.fi is a DeFi platform that focuses on offering a synthetic dollar solution called USDe, which operates on the Ethereum blockchain. Unlike traditional fiat stablecoins, USDe is a crypto-native, dollar-denominated instrument designed to function without reliance on the conventional banking system. The platform aims to provide a scalable and accessible financial solution by utilizing delta-hedging strategies with Ethereum and Bitcoin as collateral. This approach helps maintain the stability of USDe's value against the dollar. One of the unique offerings of Ethena is the "Internet Bond," which integrates yield from staked assets and the gains from futures and perpetual markets. This method creates a robust onchain monetary system intended to support both stability and yield generation. Ethena's platform enhances transaction efficiency through the use of layer 2 scaling solutions and advanced smart contract optimizations, addressing common scalability issues faced by the Ethereum network. Moreover, it prioritizes security by implementing measures such as continuous vulnerability monitoring and smart contract audits.

The platform enhances its capabilities with cross-chain interoperability for its native synthetic dollar (USDE and sUSDE) and governance token (ENA), utilizing the OFT standard from LayerZero, allowing for seamless asset transfers across different blockchain networks. This feature broadens the scope of asset and liquidity access for users, facilitating more diverse investment and financial activities in the DeFi space.

3.2.3 Angle Protocol

Source: Angle Integrates with LayerZero to Make agEUR Chain Agnostic

Angle Protocol has integrated with LayerZero to have its stablecoin, agEUR, as a OFT. This allowas agEUR to be transferred across multiple blockchains with a mint and burn mechanism via the Angle web interface. This also unifies all existing liquidity pools of agEUR, ensuring that the stablecoin maintains deep liquidity across all supported blockchains.

3.2.4 EtherFi

Etherfi has partnered with LayerZero to leverage its interoperability solutions for bridging its native token, weETH, across multiple blockchain networks. This collaboration utilizes the OFT standard, which allows Etherfi to extend the reach of weETH across different chains effectively. Initially, weETH is set to go live on Mode and Blast, with plans to expand to additional chains supported by LayerZero.

Furthermore, the integration with LayerZero enables Etherfi to explore more innovative use cases. For example, the partnership is set to facilitate the launch of eETH, a liquid restaked token on EigenLayer, allowing users to earn higher yields on their staked ether and leverage their stakes within DeFi protocols more effectively.

3.3 Token Bridging on LayerZero

Another core feature emerged with message passing - bridging. Bridges like Stargate, Aptos Bridge, and Gas.zip, along with being the default bridge for CoreDAO and Harmony, represent innovative applications of the LayerZero protocol, each serving distinct functions within the realm of cross-chain interactions.

3.3.1 Stargate

Source: The Bridging Trilemma.

Stargate utilizes the LayerZero protocol to facilitate seamless cross-chain liquidity transfers, addressing the common bridging trilemma of instant finality, unified liquidity, and native asset support. Stargate's innovative approach allows users to perform single-transaction swaps of native assets across multiple blockchain ecosystems, enhancing user experience by eliminating the need for manual token conversions on different chains.

The Stargate V2 was released to solve the pain points in Stargate V1; expensive onchain accounting, static credit mechanism, and slow expansion to new chains. Stargate V2 introduced transaction batching in order to provide the absolute cheapest bridging experience across all pathways. It also introduced dynamic credit allocation to better handle volume surges across particular pathways, managed by an AI Planning Module. Hydra was introduced as Stargate’s expansion into Bridging as a Service, allowing new chains to access almost functionally limitless liquidity across all Stargate chains.

3.3.2 Aptos Bridge

Source: The Aptos Bridge by LayerZero.

The Aptos Bridge, developed using the LayerZero protocol, enables direct asset transfers between the Aptos blockchain and other blockchains by employing a mint-and-burn mechanism. This bridge functions by locking tokens in escrow on a source blockchain, such as Ethereum, while simultaneously minting an equivalent number of tokens on the destination blockchain, Aptos. This process ensures fluid asset movement across blockchain networks. The mechanism enhances security and maintains asset integrity by using decentralized oracles and relayers. Oracles verify the blockchain data's accuracy, and relayers facilitate the actual transfer of assets, ensuring the tokens are only active on one blockchain at a time, thereby preserving the tokens' total supply integrity.

4. Past Criticisms and Path Forward

LayerZero has faced its fair share of criticisms, notably for launching the Wrapped Staked Ether (wstETH) without the explicit approval of the Lido DAO, which was perceived as creating a proprietary standard and raised concerns about centralization and security risks. Additionally, LayerZero's approach to bridging testnet tokens to mainnet, enabling the swap of Goerli ETH for mainnet ETH, led to a spike in the value of gETH. This unexpected increase in value drew speculators and created a highly valued market for what were supposed to be intrinsically worthless tokens used solely for testing purposes, and sparked a debate within the Ethereum community.

However, LayerZero has continued working on and has put in the spotlight many interesting primitives in the space such as GMP, native token bridging, and the OFT standard. It has embraced the lessons from past challenges, incorporating this invaluable feedback while bolstering the development of the enhanced LayerZero V2. This updated version emphasizes improved security and greater user control, reflecting the team's commitment to addressing community concerns and enhancing platform reliability, and opens up more customization opportunities for developers.

Thanks to Kate for designing the graphics for this article.

Related Articles

We produce in-depth blockchain research articles