Executors
Executors provide Execution as a Service for omnichain messages, automatically delivering and executing calls on the destination chain according to specific resource settings provided by your OApp directly or via call parameters.
Automatic execution abstract away the complexity of managing gas tokens on different networks and invoking contract methods manually, enabling a more seamless cross-chain experience.
What “Execution” Means
In the LayerZero protocol, execution refers to the invocation of the LayerZero Endpoint methods on the destination chain after a message has been verified:
lzReceive(...)
: Delivers a verified message to the destination OApp, triggering its logic.lzCompose(...)
: Delivers a composed message (e.g., nested calls) after the initial receive logic has triggered.
Both methods are permissionless on the endpoint contract, meaning anyone can call them once the message has been marked as verified.
Executors: Execution as a Service
While you could manually call lzReceive(...)
or lzCompose(... )
and pay gas on the destination chain directly, Executors automate this process:
Quote in Source Token: Executors accept payment in the source chain’s native token and calculate the cost to deliver the destination chain's gas token based on the instructions provided and a pricefeed formula.
Automatic Delivery: After verification, the Executor invokes the appropriate endpoint method (
lzReceive(...)
orlzCompose(...)
) with the specified resources and message.Native Token Supplier: Executors are responsible for sourcing the native gas token on the destination chain, making them a resource for users needing to convert chain-specific resources.
Fee for Service: Executors charge a fee for relaying and executing messages.
Permissionless Functions
Because the endpoint methods are open, your application remains decentralized and trust-minimized, as any party can run an Executor or call the endpoint directly.
Message Options
Use Message Options to pass execution instructions along with your payload. Available options include:
lzReceiveOption
: Specifygas
andmsg.value
when callinglzReceive(...)
.lzComposeOption
: Specifygas
andmsg.value
when callinglzCompose(...)
.lzNativeDropOption
: Drop a specifiedamount
of native tokens to areceiver
on the destination.lzOrderedExecutionOption
: Enforce nonce-ordered execution of messages.
These options let you fine-tune gas usage and value transfers for each message type. More information can be found under Message Options.
Default vs. Custom Executors
Choose the executor strategy that fits your application:
Default Executor: Use the out-of-the-box implementation maintained by LayerZero Labs.
Custom Executor: Select from third-party Executors or deploy your own variant.
Build Your Own: Follow Build Executors to implement a bespoke message Executor.
No Executor: Opt out of automated execution entirely; users can manually call
lzReceive(...)
orlzCompose(...)
via LayerZero Scan or a block explorer.
See Executor Configuration for details on wiring up a non-default Executor in your OApp.