Skip to main content
Version: Endpoint V2 Docs

Executors

Executors ensure the seamless execution of messages on the destination chain by following instructions set by the OApp owner on how to automatically deliver omnichain messages to the destination chain.

After the Security Stack has verified the message payload, the Executor invokes the lzReceive function in the Endpoint contract, initiating message delivery.

Role of Executors

When tracking cross-chain messages, you need to confirm a transaction on both the source and the destination chain, which can be challenging when trying to build an application that must seamlessly log messages across chains.

The Executor addresses this problem by quoting users in the source chain's native gas token and automatically calling the destination chain, thereby eliminating the need to obtain destination chain gas tokens and allowing for the seamless execution of destination transactions.

This feature extends even further via Message Options, which control how the Executor delivers different destination transactions:

  • lzReceiveOption - handles setting gas and msg.value amounts when calling the destination contract's lzReceive method.

  • lzComposeOption - handles setting gas and msg.value amounts when calling the destination contract's lzCompose method.

  • lzNativeDropOption - handles sending an amount of native gas to a receiver address on the destination chain.

  • lzOrderedExecutionOption - enforces the nonce ordered execution of messages by the Executor.

Advantages of Executors

  • Automated Execution on the Destination Chain: An Executor automatically triggers the execution of transactions on the destination chain after a packet's payloadHash has been verified. This feature ensures a smooth, uninterrupted omnichain experience for users.

  • Gas Management: An Executor simplifies gas payments for omnichain transactions by letting users pay for the end-to-end packet emission and delivery with the source chain's gas token. This mechanism ensures that transactions are executed without any gas-related issues on the destination chain.

  • Customizable Gas Settings: An Executor also provides flexibility in terms of gas usage. Developers can specify different gas settings for various types of omnichain messages by passing different Message Options. This feature is particularly useful for fine-tuning gas consumption based on the specific requirements of different transaction types.

Default and Custom Executors

Developers have the ability to Configure Executors based on their application's needs, ranging from:

  1. Custom Executor: OApps can freely choose between multiple existing Executor implementations for automatic message execution.

  2. Build Executor: Developers can build and run their own Executor. See Build Executors to learn more.

  3. No Executor Option: Applications can operate without an automated Executor by requiring users to manually invoke lzReceive with transaction data on the destination chain, either using LayerZero Scan or the destination blockchain block explorer.


note

See Executor Configuration to learn more about configuring your OApp to use a non-default Executor.