LayerZero's multi-chain ambition: a brief technical analysis and a list of ecological projects
W3.Hitchhiker
2022-09-21 10:30
本文约4694字,阅读全文需要约19分钟
LayerZero is a cross-chain communication protocol, which can"information"LayerZero is a cross-chain communication protocol, which can

Original Author: Tiga

first level title

LayerZero Labs Raises $135 Million to Create Omnichain Crypto Networks |  Business Wire


Brief Analysis of LayerZero Technology

LayerZero is a cross-chain communication protocol, which can"information"passed to another chain. Layerzero completed a $2M seed round in April 21, followed by $6.3M in September 21 and $135M in March 22. Participating institutions include Binance Labs, Multicoin, Delphi, A16Z, Uniswap, Polygon, Coinbase and many other institutions. The investment lineup can be said to be top-notch.

LayerZero implements decentralized information cross-chain services by deploying a series of smart contracts (Endpoints) on the chain. The ultra-light node is running on Endpoint, and the "ultra-light" two fonts now only provide the Block header of the specified block. During the transmission process, Oracle and Relayer ensure the validity and security of information transmission.


Endpoint is a contract deployed on the chain, which is responsible for sending and receiving messages. The functional responsibilities of the Relayer and the Oracle are the same, they both play the function of the oracle, but the content of the transmission is different, the two operate independently of each other, and then the Endpoint of the receiving chain verifies and matches the information sent by the Relayer and the Oracle, Improve the security redundancy of LayerZero.


Specifically, LayerZero divides Endpoint into three parts, namely Communicator, Validator, and Network:

  • Communicator: Dapp-oriented interface,

  • Validator: The recipient is responsible for verifying the information,

  • Network: It is an interface for receiving or sending information to the Network of other chains.

The specific steps are as follows:

  • Step 1: The Dapp on the A chain interacts with the Endpoint on the A chain to generate a transaction TTT, which will generate 4 parameters, which will be sent to the Communicator through LayerZero. The four parameters are:

    t: the only transaction proof of transaction T

    dst: the identifier of the target chain Endpoint

    payload: the data to be sent by the Dapp of chain A to chain B

    relayer_args: Relayer parameters that A wants to use

  • Step 2: Communicator packs these parameters into Packet(dst,payload), and sends it to Validator together with t and relayer_args.

  • Step 3: Validator passes t and dst to Network.

  • Step 4: Validator sends Packet(dst,payload), t and relayer_args to Relayer together. Step 4 and Step 3 happen at the same time

  • Step 5: Network sends dstdstdst and the ID (cur_blk_id) containing the current transaction block to Oracle.

  • Step 6: Oracle gets the block header from the A chain

  • Step 7: The Relayer obtains the transaction proof t of the transaction T from the A chain and stores it off the chain.

  • Step 8: After Oracle confirms that the transaction T has been submitted on the A chain, it sends the block header to the Network of the B chain.

  • Step 9: The Network of the B chain will receive the block hash (recorded as blk_hdr_hash) and send it to the Validator of the B chain

  • Step 10: Validator sends blk_hdr_hash to Relayer

  • Step 11: After receiving the blk_hdr_hash sent by the B-chain, the Relayer returns the data matching the blk_hdr_hash to the Validator of the B-chain.

  • Step 12: The Validator of the B chain matches the blk_hdr obtained from the Oracle with the transaction proof t obtained from the Relayer, and if the match is passed, it will send the Packet (dst, payload) to the Communicator. If the matching fails, ignore this transaction directly.

  • Step 13: The Communicator sends the Packet(dst,payload) data to the Dapp of the B chain to complete the information cross-chain

Simply put, the Dapp of the A chain tells LayerZero to deploy at the Endpoint of the A chain: "I want to send a XXX message to the B chain". The process of sending a message can also be regarded as a transaction. When the transaction is on the A chain, the Oracle will go directly to the A chain to check whether it is really on the chain, and the Relayer will also go to the A chain to obtain the proof of the transaction, and the Oracle and the Relayer will send the content they have obtained to The Endpoint of the B chain, if the content of the two matches, the message of the A chain is sent to the B chain. Conversely, if the contents obtained by the Oracle and the Relayer do not match, the transaction will be ignored directly.

At the security level, LayerZero disperses security defenses to four points, namely Endpoint, Oracle, Relayer, and the chain itself. They are mutually coupled, and this decentralized structure can make LayerZero more secure. When a part of it is attacked maliciously, other parts will block the process of LayerZero and isolate the maliciously supplied part. Among these four parts, the weakest link is Oracle and Relayer, because the difficulty and cost of 51% attack on the mainstream chain are very high, and 51% attack is not something that LayerZero considers and defends against. Endpoint is essentially a smart contract, which can minimize security risks through security audits. If Oracle and Relayer are not attacked at the same time, LayerZero can guarantee its security.

In the worst case, when Oracle and Relayer are hijacked at the same time and collude with each other, Oracle provides a malicious block header, Relayer provides a malicious transaction proof, and the content provided by the two matches. First of all, the probability of this situation is very small, because Oracle and Relayer are independent components, and the oracle service used by LayerZero is provided by Chainlink, so the security is still very guaranteed. Second, it is impossible to verify transaction proofs against a block header without knowing the specific block header. Conversely, the block header cannot be reversed based on a transaction proof. This is fundamental to guarantee the security of Oracle and Relayer, and it is also the guarantee to guarantee the security of LayerZero.

LayerZero ecosystem at a glance

Stargate

Stargate is the first project based on Layerzero, dedicated to building a fully composable native asset cross-chain bridge protocol. Currently Stargate supports Ethereum, BSC, AVAX, Matic, Arbitrum, Optimism and Fantom chains, and only supports four tokens: USDC, USDT, ETH and STG.

pledge"pledge"Assets, in the B-chain liquidity pool"redemption"Assets, without the participation of intermediate assets, the message exchange between A and B chains is realized through LayerZero.

as LayerZero's"pro son", Stargate’s role is far more than a cross-chain bridge. From Stargate’s documentation, it can also be seen that Stargate’s goal is to serve as a technology provider for cross-chain assets, so that more projects can easily use Stargate to achieve cross-chain functions. Therefore, Stargate's business needs to be divided into 2B and 2C. The 2B business model is far more imaginative than the 2C model. Based on Stargate, more complex Dapps can be built upwards.

Hashflow

Hashflow is a cross-chain DEX with zero slippage and MEV protection, which realizes cross-chain message passing by using LayerZero. Hashflow currently supports Ethereum, BSC, AVAX, Polygon, Arbitrum and Optimism chains.

As a DEX, Hashflow does not use the AMM model. Hashflow uses the request-for-quote (RFQ) method for token exchange, which is very similar to the order book method. The specific mechanism is: the trader quotes to exchange 1 ETH of the A chain into 1000USDC of the B chain, and the market maker sends the trader's 1 ETH in the A chain to the liquidity pool on the A chain, and then triggers the B chain's The contract remits 1000USDC to the trader's B-chain wallet.


RadiantCapital

Radiant is a LayerZero/Stargate-based multi-chain lending project deployed on Arbitrum, currently only supports five Tokens: USDC, USDT, DAI, BTC and ETH. Users can choose to mortgage the above five assets on Arbitrum to lend other assets. Currently Radiant only supports USDT and USDC cross-chain lending, that is, users can mortgage assets on one chain and lend USDT or USDC on another chain.


SushiXSwap

SushiXSwap is a cross-chain DEX launched by SushiSwap, the world's first cross-chain AMM. Based on LayerZero's Stargate protocol, it currently only supports the ETH mainnet, Arbitrum, AVAX, Polygon, Fantom, BSC and Optimism networks. The SushiX transaction process is shown in the figure below. Stargate's cross-chain function will realize cross-chain DEX with Sushiswap's multi-chain liquidity.


Other Layerzero ecological projects (some are not yet online)

  • @OmniBTC: Three-in-one dex built on DEX+Lend+Bridge of Sui and Aptos

  • @rage_trade: Decentralized Contracts on Arbitrum

  • @MugenFinance: RealYield based on Layerzero

  • @InterSwap: Swap based on LayerZero

  • @CashmereLabs: Full chain DEX

  • @holographxyz: Mint, Bridge protocol for full-chain NFT

  • @OmniX_NFT: Full chain native NFT platform and trading market

  • Moonbeam: LayerZero integrated

  • Clearpool: will be integrated with LayerZero

  • Angle Protocol: Integration with LayerZero

The items listed here are incomplete, and the rest are listed items for readers to explore by themselves.

LayerZero Outlook

What needs and can be cross-chain is not only Token, but also the functions and services of each protocol. With the development of crypto, the current blockchain world already has a bunch of truly innovative projects/protocols worthy of praise. Their mechanisms are mature and their operation is stable, and they can be used as a bottom layer"Component"to be used by other protocols. These protocols themselves are also programmable, composable, and interactive, and web3 is far more open and inclusive than web2. Smart contracts naturally expose APIs. If the gap between chains can be broken, liquidity and users can freely and conveniently shuttle between various protocols and chains, developers can create more and more imaginative"thing", DeFi can also evolve further, constantly broadening the boundaries of crypto/web3.

What will the future blockchain world look like? What changes will LayerZero make to the blockchain and what impact will it have? I don’t know, but what is certain is that the future development of blockchain must be in the direction of interconnection, which is convenient for users and developers. The inventor of the World Wide Web, Tim Berners-Lee, said of design principles: "Simplicity and modularity are the cornerstones of software engineering; distribution and fault tolerance are the lifeblood of the Internet". Using the mature protocol modules on each chain in series and parallel, the killer app of web3 will burst out in the future. Geniuses need a stage as well as a hammer and nails, and LayerZero can be used as the hammer and nails for web3 geniuses.

It is reasonably and conservatively estimated that the gas fee of the future blockchain will be reduced by several orders of magnitude, and the number of DeFi users will also increase by several orders of magnitude. The marginal effect is infinitely close to 0. Cost reduction is a necessary condition for scale expansion, just as the price of power batteries has dropped by 10 times in ten years, and electric vehicles have become popular in millions of households.

  • 202209: LayerZero update V2 version:

    Will support non-EVM chains

    Introducing Layer Zero Scan

    20% lower gas fee

    references:

references:

W3.Hitchhiker
作者文库