Search…
Overview
The LayerZero protocol requires two parties to independently relay information from the source chain to the destination chain. In the UltraLightNode design, we refer to these entities as the Oracle, which relays generic block information like block header, and the Relayer, which relays transaction proofs against the relayed information by the Oracle. User Applications may set a block confirmation requirement to indicate how finalized they want the relayed block information to be. In addition, LayerZero will improve the proof efficiency over time by providing more gas-efficient proof libraries.

Relayer

The primary responsibility of a Relayer is to relay transaction proofs and user payloads from the source chain to the destination chain, collecting fees for doing so. Each Relayer has an owner who can withdraw any accrued fees--managing ownership of a Relayer is a concern external to LayerZero, and one Relayer could conceivably approve multiple accounts as owners. The relayer must deploy a contract on each source chain in order to interact with UA and collect native token fees at the source chain.
The message adapter parameters (adapterParam) can be used by Relayers to provide custom functionality when passing messages. However, the adapter services are not enforceable on-chain and any misbehavior can only be arbitrated by the LayerZero DAO. Ultra-light node provides a default adapterParam if none was specified in the send() function argument as follows:
1
// bytes [2 32 ]
2
// fields [txType extraGas]
3
uint16 txType;
4
uint extraGas;
5
assembly {
6
txType := mload(add(_adapterParameters, 2))
7
extraGas := mload(add(_adapterParameters, 34))
8
}
Copied!
If the relayer does not provide the agreed-upon gas for contract execution at the destination chain, the misbehavior is easy to prove and be governed by the LayerZero Dao. It is straightforward for the Relayers to provide more adapter services based on the bytes input after 34 bytes. For example, the LayerZero Relayers can fund some native tokens to a designated account at the destination chain with the following adapterParams:
1
// txType 1
2
// bytes [2 32 ]
3
// fields [txType extraGas]
4
// txType 2
5
// bytes [2 32 32 bytes[] ]
6
// fields [txType extraGas dstNativeAmt dstNativeAddress]
Copied!
LayerZero will publish an adapter marketplace for all registered typed adapter services. Note that if a UA uses an unregistered adapter service, the LayerZero Dao won't be able to arbitrate the transaction and slash the relayers accordingly.

Oracle

The primary responsibility of an Oracle is to relay generic block data (e.g. header, receipts root) from the source chain to the destination chain, and collect fees for doing so just like the Relayer. The Oracle's interaction with the Ultra-Light Node is relatively straight forward and yet the implementation of the Oracle itself can be arbitrary.
Copy link