Maybe a LayerZero?
In one of the previous posts, we presented a ChainBridge solution for bridging on EVM (and Substrate) compatible blockchains, which we find as an alternative to the Polymer bridging solution from the IBC and Cosmos realm. This post will stick to the EVM-compatible chains and present a new bridging solution called LayerZero.
What is LayerZero?
The LayerZero is a trustless omnichain interoperability protocol. With a focus not only on bridging multiple chains but also on enabling developers to build seamless inter-chain applications like a cross-chain DEX without trusted custodians or intermediate transactions. The project’s goal is to make the inter-chain applications as easy as possible for the end users, which should also save a lot of your time and clicks!
With what blockchains LayerZero work?
Currently, only EVM is supported, so one can freely interconnect all EVM-compatible blockchains. The project plans to expand also to Cosmos, Solana, Terra, and Substrate — according to the Interfaces list from the guide. And probably, LayerZero will integrate more blockchains in the future.
Is LayerZero trusted?
No, the LayerZero is trustless, which is the key advantage of the LayerZero over the ChainBridge. The trustlessness of the LayerZero is based on the assumption that the set of Oracles and Relayers, key off-chain actors of the protocol, are independent of each other. Meaning that if there is no collusion between Oracles and Relayers, then the trustlessness is given by the fact of their separation.
How does LayerZero work?
- A user interacts with a Source Bridge Contract or any user application that uses the bridging library.
- The Source Bridge Contract invokes the Communicator Smart Contract with a description of a transaction.
- The Communicator constructs a LayerZero packet based on the data provided by the Source Bridge Contract. Then the packet is relayed to the Validator Smart Contract.
- The Validator informs the Network Smart Contract that the block header for the current block on Blockchain A needs to be sent to Blockchain B.
- The Validator forwards the packet to the Relayer, which informs the Relayer that a transaction proof must be prefetched and relayed to Blockchain B. The Relayer stores the packet. This happens at the same time as step 4.
- The Network notifies the Oracle to fetch the block header for the current block on Blockchain A and send it to the destination blockchain.
- The Oracle reads the block header from Blockchain A, which includes the transaction in transit.
- The Relayer reads the transaction proof from Blockchain A and stores it off-chain.
- The Oracle, independently from the Relayer, confirms that the block associated with the previously delivered block header is indeed committed on Blockchain A. About which, the Oracle informs the Network on Blockchain B.
- The Network forwards this block header confirmation to the Validator.
- The Validator relays the block header confirmation to the Relayer.
- The Relayer receives the confirmation and replies to the Relayer with the transaction, its packet (from step 5), and its proof (from step 8) for all packets that match the block header confirmation.
- The Validator receives and validates the transaction data received from the Relayer and compares them with the block header information stored by the Network and previously delivered by the Oracle (in step 9). If everything is valid, then the packet is sent to the Communicator (on Blockchain B).
- The Communicator relays the packet to the Destination Bridge Contract.
- The Destination Bridge Contract parses the packet and executes its logic which settles the cross-chain transaction.
Uff… That is one of the most complex designs we have ever described in this series! Nevertheless, we hope that you have enjoyed it. We also wish that we have been able to give enough details to understand the general design of the LayerZero, and still be able to make the reading experience digestible. Till the next one!