Layerzero: The Possible Future of Blockchain Interoperability

Giovanni Zaarour
Blockchain@USC
Published in
9 min readMay 7, 2022

--

By Lin, Joon Sung Park, Zain Merchant, and Giovanni Zaarour

As of now, most would say that crypto is not a zero-sum game, and the future will entail the success of multiple tokens, chains, and ecosystems. However, as blockchain adoption increases, there has been a rising issue regarding the high barrier to entry for new users trying to understand the vast and complex world of DeFi — with so many products on various blockchains coming out every day, it’s hard to keep up. The overall simplification and unification of web3 ecosystems is indubitably a prospective benefit to the entire space, hence the innovation of “layer 0” interoperability protocols, which attempt to link them all together. Examples of layer 0 solutions include Polkadot, Cosmos, and the recent “LayerZero” which is a new innovation by LayerZero Labs that aims to finalize the pursuit of omnichain DeFi. LayerZero is new and early, but its potential market share is massive if it can succeed as the primary interoperability protocol. An analysis of LayerZero as well as its first DApp, Stargate, a bridging-free cross-chain swapping and exchange platform created by LayerZero Labs, will help us show some potential concerns with the protocol, and contrarily why LayerZero is a serious contender in the pursuit of blockchain unification.

1 Introduction : Basic Overview of LayerZero

LayerZero, which claims to seamlessly connect blockchains, is an application that enables users to send transactions over different blockchain protocols and only pay the source fee. Unlike traditional bridging, which requires users to lock their assets, or blockchain networks that utilize a single relayer or facilitate transactions between fast-finality chains, LayerZero is generalizable enough to run on any chain across the full spectrum of security and scalability assumptions. As the name suggests, the protocol aims to be the backbone interoperability infrastructure for current layer 1 blockchains, such as Ethereum and Solana.

In the current market, there are generally two ways users can transfer tokens from one blockchain to another.

Utilizing Centralized Exchanges (eg. Binance/Kraken) to transfer tokens cross-chain:

  • The user will first deposit tokens from the original chain to their wallet on a centralized exchange, and the number of tokens will appear on their exchange account.
  • The user then withdraws from the exchange, designating another chain as the withdrawal chain, and thus transfer asset from one chain to another
  • The user will need to trust the centralized exchange, as the process is not decentralized and truly cross-chain, since exchanges have pools for the same asset on different blockchains.

Utilizing decentralized cross-chain bridges (eg. Mdex) to transfer tokens cross-chain

  • The user utilizes wallet applications and authorizes the decentralized application to move such assets in order to grant them the assets on another chain.
  • The user still needs to trust the intermediate decentralized protocol as an agent to bring assets cross-chain.

1.1 LayerZero Protocol Mechanism

LayerZero aims to provide a trustless cross chain protocol to help developers make cross-chain applications. LayerZero Protocol contains three main components: LayerZero Endpoint, Oracle and Relayer.

LayerZero Endpoints are the user-facing interface to LayerZero. LayerZero Endpoint is split into four modules: Communicator, Validator, Network, and Libraries. The first three components comprise the core functionality of the Endpoint, while each new chain supported by LayerZero is added as an additional Library. This design allows LayerZero to add support for new chains just in the library, without modifying the three core modules (high scalability because it is very easy to add a new chain).

An oracle is a third party service that provides a mechanism to, independently of the other LayerZero components, read a block header from one chain and send it to another chain. LayerZero currently uses Chainlink for this, but it can be any third party, theoretically.

The relayer is an off-chain service that is similar in function to an oracle, but instead of fetching block headers it fetches the proof for a specified transaction. Currently, LayerZero provides its own relayer service.

The Oracle and Relayer work independently to receive the message/argument and block header, then corroborate with each other to validate the message and execute.

With these mechanisms, LayerZero acts as the infrastructure for cross-chain applications and allows their users to operate on them without realizing they are using resources and assets from different blockchains. The LayerZero protocol still utilizes Solidity as its primary programming language, making it accessible to existing Ethereum Virtual Machine (EVM) DApp developers. In short, LayerZero has the potential to become a cross-chain infrastructure that seamlessly connects various existing public blockchains and one that offers a better experience to end users.

2 Current Usage of LayerZero: Stargate Finance

As more and more L1 blockchains are created every day, demand to transfer assets across chains increases. However, there are no existing adequate solutions for cross-chain bridging that solves the following three problems with current options:

  1. Relying on intermediate/wrapped tokens
  2. Lack of expansion
  3. Cannot apply smart contracts on each destination chain.

These problems usually result in a poor user experience, such as paying multiple gas fees for transactions in each chain, unnecessary loss from a lagging bridge and exchanging the intermediate/wrapped tokens.

In order to solve these problems, LayerZero lab has presented an omnichain DeFi service called Stargate Finance. Stargate Finance is a fully composable liquidity protocol that provides

  1. Instant guaranteed finality: guarantee that any transfer request that is committed on the source chain will be successfully committed on the destination chain as well.
  2. Cross-chain composability: allowing cross-chain transfer to be composed with smart contracts on the destination chain.
  3. Unified liquidity: All transactions related to liquidity pools occur purely with native assets, and no intermediate tokens are minted at any point during the process.

2.1 Delta(Δ) Algorithm

Stargate finance could provide such a composable liquidity protocol by using its unique delta algorithm. Here is a simple explanation on how Delta Algorithm creates unified liquidity in order to provide seamless transactions across the chains.

Figure 1: Delta Algorithm Design

When a user provides $100 worth of liquidity in the liquidity pool of X, (1, 2) the delta algorithm soft-partition a certain amount of liquidities into chain Y and chain Z (3). Now chain Y and chain Z have a balance of $50 each corresponding to the liquidity provided in chain X. (4) We make a connection between each chain to create unified liquidity (6) which has a $100 worth of liquidity provided and has $200 worth of balance. (5) In order for this algorithm to run successfully, it has to follow a few simple rules:

  1. If any channel on chain X has a deficit, distribute all or part of the newly deposited funds to close the deficit.
  2. Any remaining funds after closing all deficits are distributed across all channels based on the associated weight.

In addition to these rules, the delta algorithm can fully function by ensuring that the balance never exceeds the actual liquidity provided. In the case of Figure 1, as long as each of Chain Y and Chain X’s balance does not exceed $100, the protocol can guarantee instant finality.

However, there is one possible problem that can occur in the delta algorithm. What if so many users try to execute a transaction at once, which leads to the exhaustion of available balance in the remote chains? Stargate Finance applies equilibrium fees to balance this problem in a cost-effective way. If too many users want to transfer funds from Chain Y to Chain X, while chain Y has a high chance of running out of the balance, the protocol incentivizes users with a low transaction fee to make transactions from Chain X to Chain Y, and make users who try to transfer more funds from Chain Y to Chain X to pay a higher fee compared to the regular rate.

2.2 Successful launch of Stargate Finance

Stargate Finance launched its service in March 2022, and has attracted more than $1.9 billion in total value locked (TVL) in six days after its official launch, and topped for $4.1 billion, which is one of the fastest growing rates of DeFi in history. This could be possible because Stargate Finance can attract funds from six different chains (Ethereum, Binance Smart Chain, Polygon, Avalanche, Arbitrum, Fantom and Optimism). As of April 27th 2022, Stargate Finance is maintaining $1.7 billion TVL.

Figure 2: Stargate Finance Ecosystem Table 1: Value Locked in Each Chain

2.4 Other Use Case of LayerZero

2.4.1 Omnichain NFTs (Gh0stly Gh0sts / Tinydinos)

After the successful implementation of the LayerZero protocol, many interesting projects have risen to the surface, including Omnichain NFTs. Since the protocol supports any EVM blockchain, the smart contracts are compatible with many different chains. While existing NFT projects only exist in a single main network, Omnichain NFTs can be sent to/received from any of the LayerZero-supportive networks. Early in April 2022, Gh0stly Gh0sts, the first omnichain NFT, was launched using the LayerZero protocol through the stealth mint method. Buyers could mint the collection with cheaper gas fees using the Polygon network while acquiring the same collection of NFTs on another network, such as Ethereum mainnet. Another NFT collection called ‘Tiny Dinos’ could manage a contract to generate a trait that marks which network the NFT was minted originally. (Figure 3)

Many blockchain games on the market had difficulty in choosing between high transactions per second (tps) and high security when transferring contract messages and NFTs to run the games. What if they were built on the Omnichain? They will not only be able to reap the benefits from different chain networks, but also be able to enjoy the larger market share that is currently divided across each of the networks.

Figure 3: NFT originally minted on Avalanche chain, and trading on Ethereum Network

3 Problems and Drawbacks with LayerZero

LayerZero shows great promise for the future. But, as with all technologies, it comes with its own set of drawbacks. The main issue with LayerZero is that of oracle and relayer independence. As discussed above, LayerZero approves transactions through its relayer and oracle both agreeing. From the whitepaper, “To ensure valid delivery, the only requirement is that for any given message sent using the LayerZero protocol, the Oracle and Relayer must be independent of each other. The protocol itself does not require any specific implementation of a Relayer, and in theory the users of LayerZero could even implement their own Relayer service.” The benefit of this is that people are able to make decisions for themselves on how they want to implement this protocol. The downside is that there are no real restrictions to the relayer, which can be problematic. Leaving it up to the users to implement their own secure relayer seems dangerous. In a Medium article, the Co-Founder and CTO of LayerZero addresses this problem and states, “For example, in the most extreme case where the Oracle A’s consensus is corrupted and the Relayer A is colluding, all of this risk is only borne by those User Applications accepting messages from Oracle A and Relayer A. All User Applications using Relayer B-Z, running their own Relayer, or using Oracle B-Z remain completely unaffected.” The issue with this is that it assumes many different oracle and relayer pairings. If there aren’t different sources of oracles and relayers, as is likely to be the case with most people starting out with LayerZero and implementing their own relayer, suddenly collusion becomes more likely. A possible solution to this would be to create some sort of tool to verify this independence. If users are able to run this tool on their LayerZero instances and verify independence, it could alleviate security concerns. Another potential drawback to consider is that much of the work when using LayerZero is going to be performed on-chain. LayerZero uses an “Ultra-Light Node” which is supposed to have high security and low costs, but validation is still occurring on-chain, so it will likely be more expensive than other intermediate solutions. Any work on-chain is expensive, especially if it comes to validating proofs and transactions. With that being said, decentralization is a key aspect to LayerZero creating a fully reliable omnichain protocol

4 Conclusion

Layer 0 solutions make us confident to say that the future is definitely multichain — the crypto industry no longer needs to bicker about which blockchain protocol will come out on top at the end, and maximalists are losing their footing. As long as technical concerns are considered, LayerZero Labs has serious potential to continue capturing increasing L0 market share from other cross-chain infrastructure protocols such as Polkadot and Cosmos; it is one of the most “hyped” upcoming protocols, and to have accumulated almost $2 billion in TVL less than a year after launching is a strong testament to that. There is no doubt that simplifying cross-chain solutions to eliminate unnecessary bridging, wrapped tokens, and centralized implementations is in high demand, and LayerZero has serious prospects to unify DeFi in this way. With DApps and use cases such as Stargate Finance and highly promising omnichain NFTs, LayerZero Labs can definitely win the race with its competitors to provide seamless interoperability — all they need to do is continue building in these early stages and refine the protocol they have.

--

--