Is LayerZero Susceptible to the Same "Force Majeure" That Multichain Was?

By Michael @ CryptoEQ | CryptoEQ | 29 May 2023


You are reading an excerpt from our free but shortened abridged report! While still packed with incredible research and data, for just $20/month you can upgrade to our FULL library of 50+ reports (including this one) and complete industry-leading analysis on the top crypto assets. 

67cbbf4723857b85c151585aa280e6d940346c501cef75bafd7dea02b44b24c9.png

Becoming a Premium member means enjoying all the perks of a Basic membership PLUS:

  • Full-length CORE Reports: More technical, in-depth research, actionable insights, and potential market alpha for serious crypto users
  • Early access to future CORE ratings: Being early is sometimes just as important as being right!
  • Premium Member CORE+ Reports: Coverage on the top issues pertaining to crypto users like bridge security, layer two solutions, DeFi plays, and more
  • CORE report Audio playback: Don’t want to read? No problem! Listen on the go.

 

Overview

LayerZero serves as an all-encompassing, interoperable protocol with the goal of integrating every smart contract across all blockchain networks. By employing an Ultra Light Client architecture, LayerZero is capable of establishing a universal messaging protocol that spans multiple chains, thereby facilitating more cost-effective validation of Ethereum and other high-throughput blockchains.

Fundamentally, LayerZero functions as a generalized communication protocol, eschewing a narrow focus on cross-chain decentralized exchanges (DEX) in favor of a more expansive vision. Its design as a foundational messaging protocol allows higher-level applications to build on top of it, thereby providing a variety of functionalities. LayerZero's innovative cross-chain communication primitive paves the way for an array of omnichain applications to be developed on its platform. Some potential use cases include:

  1. Cross-chain decentralized exchanges
  2. Cross-chain yield aggregators
  3. Cross-chain lending platforms

It's important to note that LayerZero merely serves as the communication foundation for these applications and operates at different levels within the implementation stack. Its scope extends to support all layers, including direct messaging between Layer 1 and Layer 2 chains.

Presently, when a DEX aims to expand its reach to multiple chains, liquidity is fragmented across these networks. Consequently, DEXs, such as Sushi, though deployed on 25+ chains, are unable to compete with native DEXs on other chains due to lower volumes and fragmented total value locked (TVL). This fragmentation of liquidity leads to elevated fees, increased slippage, reliance on third parties, and various other challenges for end-users attempting to bridge across chains.

l0 diagram Source

LayerZero addresses these issues by using a fundamental concept known as "valid delivery" to facilitate cross-chain communication. This mechanism allows for cross-chain token transfers or arbitrary data exchange by providing two essential guarantees:

  1. Every message transmitted across the network is accompanied by a transaction on the sender's chain.
  2. A message is delivered to the recipient if, and only if, the associated transaction is valid and has been committed on the sender-side chain.

To ensure "valid delivery," LayerZero mandates that the oracle and relayer involved in the process be independent entities. Additionally, LayerZero has recently integrated Inter-Blockchain Communication (IBC) to offer a robust set of communication and token standards built atop LayerZero's transport layer.

Abandoning the need for a central chain, LayerZero relies on off-chain entities—oracles and relayers—to facilitate message transmission between chains. When a request is received by LayerZero's smart contracts on chain A, the relayer forwards the transaction proof to chain B, while the oracle submits the current block header of chain A. Validators on chain B then verify the compatibility of the transaction proof and block header before directing the request to its intended destination on chain B.

Background, Definitions, and Scope

Cross-chain

In blockchain technology, cross-chain refers to any technologies that actively enhance the connection and interoperability between independent blockchain networks to facilitate the transfer of digital assets, information, and value. Initially, numerous blockchain networks were designed as siloed, self-sufficient ecosystems with little need to have interconnectivity between ecosystems. Users would exist and manage digital assets solely within the system.

With the onset and expansion of DeFi and other decentralized applications (dApps), blockchain network utility has grown substantially. Higher user demand for utilities has also resulted in demand for a presence in multiple ecosystems, leading to the necessity of cross-chain technologies in which users can interact across multiple blockchains. Cross-chain technology essentially creates messaging or communication rails between blockchains and can execute asset swaps or transfers, allowing users to exchange digital assets between blockchains.

Users leveraging this technology helps to remove the isolated and siloed nature of blockchains, resulting in the creation of an interconnected, diverse, distributed internet of blockchains. This can materialize in different ways depending on the needs of each individual user but typically comes from things such as yield opportunities across ecosystems, demand for governance of differing protocols, or taking advantage of varying consensus algorithm designs to reap the benefits of multiple ecosystems at once. As of 2023, cross-chain technologies operate mostly independently of the blockchain ecosystems themselves, meaning the platforms being connected are operating through separate systems from the interfaced networks. Alternatively, there are entire projects, such as CosmosPolkadotAvalanche, and others, that are architected to create (somewhat) frictionless interoperability across sub-layers within their own ecosystem to avoid outside, third-party solutions. 

Cross-chain technology is widely considered one of the most fundamentally important developments in the entire crypto economy, as success in this area creates an entire interconnected system that streamlines financial applications, utilities, interoperability, and overall ease of adoption.

L0 cross chain diagram Source

A major subsection of cross-chain technology is conceptualized via the blockchain bridge, an independent protocol that creates a connection (or bridge) between two different blockchain networks. This allows users to swap or transfer digital assets between networks using various methods depending on the bridge’s underlying design. However, blockchain bridges don’t physically transfer digital assets or tokens. 

Instead, blockchain bridges operate by using two separate smart contracts on each side of the bridge: one containing the tokens and the other to determine where the value of those tokens needs to end up. Messages containing cryptographic signatures facilitate the transfer of this information between smart contracts, telling the destination chain of the appropriate value that needs to be released to the user on that chain, pending the transfer. Blockchain bridges carry the responsibility of maintaining the legitimacy and integrity of these messages, ensuring security for the user in that the funds will be appropriately and safely transferred.

As of Q2 2023, the TVL in bridges is only ~$7 billion, a fraction of the ~$50+ billion locked in DeFi protocols. The ability to source liquidity across the entire ecosystem would instantly improve most blockchains’ liquidity by orders of magnitude.

Shortcomings of Cross-Chain Technology

Mainstream cross-chain technologies have not yet been perfected. Multiple shortcomings that plagued users in 2022, mainly stemming from centralization issues, security flaws resulting in loss of funds, and problems with high fees. Generally, blockchain bridges operate as independent third parties. This typically means the blockchain bridge is centralized around a few external entities. This introduces a high degree of centralization and increased trust in an independent party beyond what decentralized blockchain networks provide for users. Blockchain bridges act as custodians of digital assets in their present form. 

When there’s a security flaw, user funds being transferred are at their highest risk. Centralized bridges initiate user fund transfers by taking custody of the assets, sending a message across the bridge to the other smart contract that a transfer’s been initiated, and then releasing the equivalent tokens on the destination chain. However, this doesn’t mean the tokens were actually transferred. It means the destination chain simply released an equivalent token on its own network with the user’s actual tokens being held on the bridge. This is where a high degree of trust is needed on the user’s part for the independent bridge.

Use Case

LayerZero is the first trustless omnichain interoperability protocol, providing the base infrastructure (blockchain primitive) for low-level communication between blockchain networks. At its core, LayerZero is a messaging protocol that allows for communication between apps across blockchains. It enables dApp developers to turn their once-isolated and fragmented projects into omnichain-applications that can communicate and transact across multiple chains all from one interface.

L0 use case tech stack diagram Source

The project was founded by a core team of three co-founders, one of which is 0xMaki. The protocol itself went live in March 2022, launching on the following blockchains:

This project attempts to resolve the bottleneck with current bridge technologies, which requires users to trust a third party to bridge funds between networks. This problem has led to the theft of over $2 billion through bridge hacks.

It employs a straightforward concept consisting of one on-chain endpoint smart contract, one on-chain relayer, and one off-chain oracle. The protocol uses Chainlink as an oracle provider while running its relayer as a public good, shifting the task of selecting oracle and relay providers to the applications using it. Currently, Sequoia and Polygon's oracles are used by LayerZero.

Essentially, LayerZero improves upon the middleman of trusted custodians, such as Wormhole and ChainBridge, allowing for trust-minimized communication between apps. This is possible due to omnichain, a new concept of inter-blockchain communication enabling dApps to exist simultaneously across multiple blockchains. Most bridging solutions focus solely on asset transfers between chains, but LayerZero aspires to achieve true composability by serving as a generic cross-chain messaging platform. This means that contracts on one chain can connect with any other contract on a different chain, leading to a wide range of new functionalities (a couple of examples below).

It's important to note that LayerZero itself doesn’t handle any of the creation, burning, or transfer of tokens, but rather simply employs the most efficient communication between different blockchain networks.

Cross-chain DEXs

Unlike existing DEX designs that use wrapped tokens or intermediaries, such as sidechains, a DEX built on LayerZero can be designed in such a way that liquidity pools exist on both chains, allowing users to deposit native assets on one chain and withdraw native assets from another chain. Managing state sharing for protocols that operate across multiple chains, such as DEXs and aggregators, can be challenging as they typically require separate sets of codes for each chain and bridge. However, LayerZero offers a single interface and codebase for all cross-chain protocols, eliminating the need for multiple sets of codes. Additionally, LayerZero enables existing automated market makers (AMMs) to execute cross-chain swaps without having to modify their codebase.

LayerZero's messaging feature can support direct bridges (1:1 pricing), automated market maker (xy = k pricing), and other pricing models, such as those used by Curve DAO

Most yield aggregators currently operate within a single-chain ecosystem, such as Yearn Finance. However, single-chain yield aggregation systems can't take advantage of yield opportunities outside of their ecosystem (hence, the name). A yield aggregator that uses LayerZero for cross-chain transactions would be able to execute strategies that tap into the best opportunities across all ecosystems, increasing access to high-yield opportunities and allowing users to take advantage of market inefficiencies.

Multichain Lending

Currently, it's difficult for users to benefit from opportunities on different blockchain networks where they don't hold their assets. Suppose you have assets on Ethereum and want to take advantage of an opportunity on Polygon. You can either transfer all of your assets to another chain and convert it to the native token ($MATIC in this case), or to lend your assets on Ethereum, borrow the desired asset, and then transfer it to the destination chain. LayerZero introduces a lending protocol, allowing users to keep their assets on Ethereum, lend them out, and then borrow the $MATIC directly on Polygon. This removes the need for any intermediaries, such as cross-chain bridges and swap fees.

Modular Approach (Including Security)

LayerZero is a versatile framework designed to promote generalized interoperability, empowering applications to make trust-based decisions for individual transactions. Its streamlined architecture consists of a single off-chain oracle, an off-chain relayer, and on-chain Endpoint smart contracts. Applications using the framework are responsible for specifying their preferred oracle and relay providers. To facilitate this decision-making process, LayerZero recommends delegating oracle responsibilities to Chainlink and operating its relayer as a public service. At present, Polygon and Sequoia operate the oracle used by LayerZero.

L0 modular spectrum Source

Endpoints facilitate the exchange of arbitrary messages between them, allowing applications to select third-party services for the actual transmission of messages (block headers and transaction proofs) across endpoints. Applications can choose oracle/relay services according to their specific cost and security requirements or configure custom settings within the messaging library employed for sending and receiving verified messages. This design strategy also simplifies the process for LayerZero to introduce new proof validation libraries in the future, potentially enabling applications to use zero-knowledge proofs to enhance security or performance.

L0 architecture Source: LayerZero

The Endpoint comprises four modules: Communicator, Validator, Network, and Libraries (not shown). The Communicator, Validator, and Network form the Endpoint’s core functionality, while additional chains are incorporated as Libraries. This modular design allows LayerZero to effortlessly integrate new chains without altering the core modules. Each chain within the network possesses its unique Library, and every Endpoint retains a copy of all Libraries, enabling seamless communication between two chains with only their respective libraries on both ends.

For cross-chain transactions, the workflow is as follows: 

messages from the sender side are passed down the stack through Communicator -> Validator -> Network, and then up the stack on the recipient side via Network -> Validator -> Communicator.

LayerZero ensures scalability without incurring excessive costs through its Ultra Light Node (ULN) design. It accomplishes this by assigning the task of obtaining cross-chain headers and transaction proofs to off-chain entities, namely, the relayer and oracle. 

The oracle streams block headers on-demand, enabling the desired full header sync state more efficiently. The submitted header is cross-verified with the transaction proof provided by the relayer, thus offering the security of a light node while maintaining cost-effectiveness.

Initiating a message transfer request begins with applications sending transactions to a chain's Endpoint. The Endpoint then requests the chosen oracle provider to retrieve the corresponding block header from the source chain and transmit it to the Endpoint on the destination chain. 

Simultaneously, the source chain's Endpoint generates a transaction proof, which the relayer conveys to the destination chain's Endpoint. The block header and transaction proof are verified and matched by the destination chain's Endpoint before the message is submitted on-chain. Both the oracle and relayer are compensated per transaction by the requesting user on the source chain.

While LayerZero markets itself as the first "trustless interoperability protocol," this claim is contingent on the assumption that the oracle and relayer don't conspire to compromise the security of the sender's message. An attacker who infiltrates the oracle network could operate their own relayer to undermine safety, meaning that the message sender must trust the oracle provider for security. Although an application could operate its own relayer to ensure proper delivery, this would negate the cost benefits of using a third-party service.

L0 messaging diagram How messages get sent via LayerZero. Source: Messari

Competitive Advantages

Most bridge exploits in the cryptocurrency space from 2020-2023 have been caused by compromised relayers/external validators and liquidity being stored in a single pool. Bridges add trust assumptions and carry additional risks, such as:

  • Centralization/Censorship/Custodial Risk Some bridges have a small set of operators that can censor and, in the worst cases, steal user funds.
  • Poor Security Practices - Trusted third parties are human and make mistakes. As in the Ronin hack (discussed later), the Sky Mavis team had poor multi-sig security practices, and one individual was the victim of a social engineering hack.

LayerZero looks to address these issues by siloing risk into "application-specific risk," which requires collusion between a specific oracle and relayer for an attack to occur. This means that only protocols using the rogue oracle-relayer pair may be vulnerable, minimizing the damage to specific liquidity pools. However, the overwhelming majority of projects using LayerZero use the default oracle-relayer setup.

How do you rate this article?

52


Michael @ CryptoEQ
Michael @ CryptoEQ

I am a Co-Founder and Lead Analyst at CryptoEQ. Gain the market insights you need to grow your cryptocurrency portfolio. Our team's supportive and interactive approach helps you refine your crypto investing and trading strategies.


CryptoEQ
CryptoEQ

Gain the market insights you need to grow your cryptocurrency portfolio. Our team's supportive and interactive approach helps you refine your crypto investing and trading strategies.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.