Dear Bankless Nation,
Most blockchains don’t like each other. While bridges facilitate moving assets to other networks, there are a multitude of problems with the current cross-chain status quo.
Today, we take a look at LayerZero, an emerging protocol looking to help networks get cozy with each other. We look at the promises, pitfalls and potential competitors to their model.
– Bankless team
Contributing Writer: Paul Timofeev | disclosures
The reality is that blockchains don’t often play nice with one another.
Interoperability solutions come in different shapes and sizes, but they all have one common goal: enabling seamless communication between different blockchains. The ability for these networks to exchange information and transfer value among one another has become crucial for the long-term evolution of crypto.
Although there has been great innovation in the sphere of cross-chain solutions to date, there are still core issues within these present day solutions. Take the standard “lock and mint” bridge for example – the most frequently used solution for transferring tokens from chain A to chain B.
These wrapped assets lead to fragmentation of liquidity spread across many different chains, dApps, and ecosystems, which can undermine an asset’s collective power. Bridges have also been the target of some of the biggest exploits in DeFi. 2022 alone saw up to $2 billion of funds lost on bridges – 64% of all stolen funds in DeFi from that year!
The need for smooth blockchain interoperability, especially between EVM and non-EVM chains, will continue to grow as blockchains pick up adoption.
Today we’re looking at LayerZero, a particular type of cross-chain communication primitive which enables chains to communicate with one another without the use of wrapped assets, sidechains or other intermediaries. 👀
Intro to LayerZero ✨
Despite its name, LayerZero is not a blockchain, nor is it a new type of chain akin to L1s and L2s. Nor is it at all related to Bankless’s Layer 0 show 🙃
LayerZero is a cross-chain infrastructure protocol which provides a simple, modular framework for applications to build cross-chain solutions on top of. Formally, it can be defined as a generalized message passing bridge, which enables the native transfer of assets and other data across different chains.
It is the modularity of LayerZero which makes it unique – the protocol provides the necessary framework and tools to enable cross-chain messaging, but allows projects to make their own choices in implementation.
Ultimately, LayerZero aims to connect all chains, describing itself as “the network fabric underlying the fully connected omnichain ecosystem of the future”. While this is a tall order and only time will tell if it holds true, it is certainly an ambitious project that is worth digging into further!
How LayerZero works 🔬
LayerZero uses two independent entities, an Oracle and a Relayer, to transmit messages between chains, ensuring that they are valid and delivered to the destination chain. Chains which are supported by LayerZero use Endpoints to communicate with other LayerZero chains. Endpoints are essentially toolkits for chains that define how they handle cross-chain communications.
In the LayerZero transaction lifecycle, a transaction is split into two parts – the block header (this is the transaction ID), and the transaction proof (data which ensures a transaction is valid). The Oracle is responsible for receiving and forwarding the block header, while the Relayer is responsible for receiving and forwarding the transaction proof.
For full context, here is an example of a transaction lifecycle using LayerZero, in the the context of swapping an asset from chain A to chain B. (If this doesn’t mean much to you, don’t worry – all users need to know is that they can transfer assets across chains with one click)
- User initiates a transaction on application on chain A, which is split into a block header and transaction proof
- The transaction is sent through the Endpoint on chain A
- The Endpoint notifies the Oracle and Relayer of the transaction and its destination (chain B)
- The Oracle forwards the block header to chain B’s Endpoint, and the Relayer submits the proof
- Once the proof is validated on destination chain B, the message is forwarded to the destination address and the transaction is complete
Keep in mind that LayerZero has a reference Relayer and uses established oracles like Chainlink and Band by default, but applications building on top of LayerZero can use any oracle or relayer they wish. The ability for applications to make their own choices here is what makes LayerZero particularly unique.
Security 🔐
For starters, it is assumed that the Relayer and the Oracle must always be two independent entities – this division of labor is what signals that a transaction is valid and delivered. Neither the Oracle nor the Relayer have any knowledge about one another, therefore they can focus on doing their jobs (transmitting that data across chains!)
In the case that the Relayer and the Oracle are malicious and say, run by the same entity, this would still only be a security concern for applications using that specific Relayer or Oracle. Recall that applications building on top of LayerZero can use any Relayer or Oracle. This means that if there was an exploit by Oracle A and Relayer B, applications using Oracle X and Relayer Y are unaffected.
LayerZero also has a built-in feature for taking security one step further and preventing a hack before it happens. Pre-Crime is a feature which allows Relayers to essentially run a test of the transaction in a safe environment before passing it along to the destination. More specifically, this involves forking the destination chain and running the transaction locally.
Why is LayerZero important?
LayerZero envisions a world where all chains are connected seamlessly, and users can interact between different chains without even realizing it.
However, with 197 chains currently being tracked on DefiLlama, and an influx of new L1s and L2s in development, this begs the question of how realistic this vision is.
LayerZero’s approach is to keep things simple for developers and applications, providing them with an efficient cross-chain framework that they can configure to their own specific preferences. LayerZero enables dApps to use a single interface and code base for all its cross-chain pairs, instead of having to write individual codebases and develop ecosystems independently, which can quickly become unmanageable.
dApps only need to implement a send
function, to form a message for the destination chain, and a receive
function, for interpreting the message.
For developers, the modularity of LayerZero’s design means implementation is simple and intuitive. For users, this means interacting cross-chain is easier, cheaper, and more secure. A win-win situation.
Limitations & Alternatives
As with any new technical solution, LayerZero faces its own constraints. For starters, it must be noted that Oracles and Relayers run the process of fetching and storing transaction data off-chain. While this mechanism was designed to reduce the high costs required for this process on-chain, it creates additional trust assumptions as users can’t just “check the chain” to verify the transaction data for themselves.
While Chainlink and other established entities are unlikely to act maliciously, there is no inherent guarantee that smaller applications who opt to use their own Oracle/Relayer can be trusted not to act maliciously or deploy buggy code – putting their users at risk.
Given that the choice of Relayers is still rather limited, this creates a dilemma. While applications can implement their own Oracle and Relayer, this requires a great deal of resources and operational risk. And yet – LayerZero needs the number of Relayers to grow over time in order to actually be decentralized by nature. If the same few Oracles and Relayers are responsible for verifying the majority of transactions passing through LayerZero, the protocol is not that decentralized in practice.
The Uniswap Foundation called out this flaw in their recent Bridge Assessment Report, and therefore decided LayerZero does not currently satisfy their requirements for cross-chain governance. However, it’s worth noting that this assessment did not account for recent and upcoming upgrades that LayerZero is working on, and that the Uniswap Foundation says it will reassess “once the new configuration has been in operation for a period of at least three months and has attained sufficient usage.”
Other Messaging Protocols
There are a handful of messaging protocols besides LayerZero, which focus on providing an efficient and seamless cross-chain experience much like LayerZero does. Some of the most notable competitors include Axelar, Connext, and Celer.
While each of these come with their own strengths and weaknesses, it’s worth pointing out that LayerZero is the only protocol which is neutral to the consensus mechanism used for validating transactions, meaning:
a) there is no intermediary chain involved in transmitting messages between the source and destination chains
b) there is no specific consensus or network design which is exclusive to running on LayerZero (unlike fast-finality chains on Cosmos’ IBC, for example).
Current State of Adoption
While the decentralization and security of Oracles and Relayers will determine the longevity of the LayerZero protocol over time, the key to staying ahead in DeFi is adoption. Since launch in 2022, LayerZero has:
It is worth noting that a lot of activity has picked up since April of this year, likely driven by speculation around an airdrop for the $ZRO token, a usage pattern similar to what Arbitrum and other likely airdrop targets have experienced.
But quality trumps quantity when it comes to adoption, and LayerZero has developed strong partnerships with a number of reputable members in the space:
Also keep in mind that Chainlink and Band are default oracle providers for LayerZero.
New Innovation
Although Stargate Finance has been the flagship LayerZero application, the throne is still up for grabs in the ecosystem as new applications continue to emerge with innovative solutions. Altitude DeFi is building a unified liquidity bridge similar to Stargate but with enhanced security, performance, and utility. Tapioca Dao is building an omnichain money market, where users will be able to seamlessly borrow/lend across different chains using native assets.
As blockchains grow and evolve, interoperability will continue to be a crucial factor in the overall success of the industry. The customizability of LayerZero’s simple framework, in addition to a handful of big-name partnerships could enable LayerZero to be a foundational part of this vision. But only time will tell! 🥂
Action steps
Read More: www.bankless.com