Skip to main content
Version: Endpoint V2 Docs

Solana Execution Options

Because the source chain has no concept of the destination chain's state, you must specify the amount of gas you anticipate will be necessary for executing your lzReceive or lzCompose transaction on the destination chain.

LayerZero provides robust Message Execution Options, which allow you to specify the gas_limit and msg.value used in the Executor's transaction for message delivery on EVM chains, an amount of native gas token to airdrop to any destination address, or whether messages should be executed in a specific order.

The most common options you will use when building are lzReceiveOption, lzComposeOption, and lzNativeDropOption.

Options Builders

An off-chain SDK has been provided to build specific Message Execution Options for your application.

Generating Options

Since both the EVM and Solana versions use the same Options SDK, review the EVM section for all of the Available Options Types.

Sending Outbound to EVM Chains

When sending messages from Solana to an EVM chain, you will supply:

  • Gas Limit and Message Value necessary to execute the destination transaction in wei.
Options.newOptions().addExecutorLzReceiveOption(gas_limit, msg.value);

These execution options will be charged to the payer when quoting a cross-chain send transfer on Solana.

Sending Outbound to Solana

When sending to Solana, instead of supplying the gas_limit and msg.value, you will supply:

  • Compute Units: a unit of compute, per Solana-BPF instruction, intended to approximate the cost to execute the instruction. Similar to gas units on Ethereum.

  • Lamports: the smallest atomic unit of SOL. 1 SOL is equal to one billion (10⁹) lamports.

Options.newOptions().addExecutorLzReceiveOption(compute_units, lamports);
Options.newOptions().addExecutorNativeDropOption(lamports, receiver);

Because Solana programs pull the necessary SOL from the sender’s account rather than pushing it with the transaction like msg.value, the lzReceiveOption will drop the amount of lamports specified into the destination OApp's account before executing the transaction logic.

caution

You must send at least 0.0015 SOL (1500000 lamports) in your lamports field of execution options when sending to Solana.

Unlike EVM addresses, every Solana Account requires a minimum balance of the native gas token to exist rent free. To send gas, therefore, you will need a minimum amount of lamports to execute and initialize the account within the transaction.

Further Reading