This page provides development guidance for building on Solana. While some entries are LayerZero-specific, others cover general topics and tooling relevant to the Solana ecosystem.Documentation Index
Fetch the complete documentation index at: https://docs.layerzero.network/llms.txt
Use this file to discover all available pages before exploring further.
Deploying Solana programs with a priority fee
This section applies if you are unable to land your deployment transaction due to network congestion. Priority Fees are Solana’s mechanism to allow transactions to be prioritized during periods of network congestion. When the network is busy, transactions without priority fees might never be processed. It is then necessary to include priority fees, or wait until the network is less congested. Priority fees are calculated as follows:priorityFee = compute budget * compute unit price. We can make use of priority fees by attaching the --with-compute-unit-price flag to our solana program deploy command. Note that the flag takes in a value in micro lamports, where 1 micro lamport = 0.000001 lamport.
For example:
--with-compute-unit-price flag.
Previewing Solana rent costs
Most of the SOL you spend during a program deployment goes toward rent so the program account can remain rent-exempt. This cost scales with the size (in bytes) of the compiled.so artifact, while the additional accounts you create (for example, PDAs or configuration accounts) typically contribute only a small fraction of the total.
You can preview the rent-exempt minimum required for your compiled program with the Solana CLI:
Transferring OFT ownership on Solana
There are six roles regarding OFT ownership/authority on Solana:- owner
- delegate
- upgrade authority
- token metadata update authority
- (if applicable) mint authority
- (if applicable) anchor IDL authority
- (if applicable) freeze authority
Transferring Owner and Delegate
The transfer of both require modifying your LZ Config file and running helper tasks. Overall, you should carry out these steps:- Modify LZ Config to include only the new delegate address
- Run
pnpm hardhat lz:oapp:wire --oapp-config layerzero.config.ts - Modify LZ Config to include the new owner address
- Run
pnpm hardhat lz:ownable:transfer-ownership --oapp-config layerzero.config.ts
Transferring the OFT Program Upgrade Authority
The steps vary based on whether the current Upgrade Authority is your local keypair or a Squads Multisig.When the current Upgrade Authority is your local keypair
The steps for when the current Upgrade Authority is your local keypair then also differ depending on whether (1) the new upgrade authority is a regular account that you control or whether (2) the new upgrade authority is a Multisig or an account that you do not control. They differ in whether the new upgrade authority’s keypair is included or whether you use the--skip-new-upgrade-authority-signer-check param.
The new upgrade authority is an account that you control
Run the follwowing:The new upgrade authority is a Squads Multisig or an account that you do not control
The steps below are identical whether your new upgrade authority is a Squads Multisig or whether it’s an account that you do no control. If it is a Squads Multisig, note that the address you want to pass in is the Vault Account address.
This differs from the current --multisig param required by LayerZero helpers which requires the Multisig account address
With the correct new upgrade authority address prepared, run the following:
When the current Upgrade Authority is a Squads Multisig
Refer to the Squads documentation on updating the Upgrade Authority.Transferring the Token Metadata Update Authority
The Token Metadata Update Authority is able to update the Solana token’s metadata such as name, symbol, uri and creators information. To transfer the Update Authority, you can use the setUpdateAuthority helper script:<ENDPOINT_ID>-30168for Solana Mainnet,40168for Solana DevnetRead more on what the Update Authority can do here: https://developers.metaplex.com/token-metadata/update
(if applicable) Transfer the Mint Authority
This section only applies if the Solana OFT was created with Additional Minters. You can verify this by viewing the Solana OFT’s Mint Authority. If it is an SPL Multisig with more than 1 address, then there are additional minters. If the Mint Authority is a single PDA and not an SPL Multisig, then the Mint Authority is the OFT Store and no transfer steps are necessary for the Mint Authority. SPL Multisigs can only be created and not be edited. If your current Solana OFT has an additional minter and you need to change the additional minter address, then a new 1 of N SPL Multisig needs to be created. For this, you can simply run the setAuthority helper:If you no longer need additional minters:
<ENDPOINT_ID>-30168for Solana Mainnet,40168for Solana Devnet--only-oft-store true- This is irreversible and will set the Mint Authority to the OFT Store directly.
If there should be new additional minter(s)
<ENDPOINT_ID>-30168for Solana Mainnet,40168for Solana Devnet--additional-minterscomma-separated list of additional minters
(if applicable) Transfer the Anchor IDL Authority
This only applies if you had previously uploade the Anchor IDL onchain. A quick way to test this is by runningError: AccountNotFound: pubkey=<IDL_PDA_PUBKEY>, this means no Anchor IDL PDA had been created and you can ignore this step.
To transfer the Anchor IDL Authority, run:
(if applicable) Transfer the Freeze Authority
While the OFT Program does not require the Freeze Authority at all, your Solana Token might have its Freeze Authority set. To transfer the Freeze Authority to a new address:Deciding the number of local decimals for your Solana OFT
As OFTs can span across VMs, with each VM potentially using a different data type for token amounts, it’s important to understand the concept of decimals in the context of OFTs. Make sure you understand shared decimals and local decimals before proceeding. Before running thepnpm hardhat lz:oft:solana:create command, you should have decided the number of values to pass in for both the --shared-decimals and --local-decimals params.
For --shared-decimals, it should be the same across all your OFTs regardless of VM. Inconsistent values (i.e. one chain having a share decimals value of 4 while another has it as 6) can result in value loss. For more detail, read Token Transfer Precision.
On EVM chains, the data type that represents token amounts is uint256 and the common number of (local) decimals is 18. This results in an astronomically high possible max supply value.
u64 type to represent token amounts, with the decimals value defaulting to 9, although many tokens choose to go with 6 decimals. The possible max value by default (~18 billion) is a lot lower, so it’s important to select a local decimals value on Solana that can fit your token’s max supply.
Refer to the table below for a comparison between a Solana token’s (local) decimals and the possible max supply value.
Max Supply in Solana for a Given Decimals Value (Decimals 9 to 4)
| Decimals | Max Supply (in whole tokens) |
|---|---|
| 9 | ~1.84 × 10¹⁰ ( ~18 billion ) |
| 8 | ~1.84 × 10¹¹ ( ~184 billion ) |
| 7 | ~1.84 × 10¹² ( ~1.8 trillion ) |
| 6 | ~1.84 × 10¹³ ( ~18 trillion ) |
| 5 | ~1.84 × 10¹⁴ ( ~184 trillion ) |
| 4 | ~1.84 × 10¹⁵ ( ~1.8 quadrillion ) |
Squads Multisig – Multisig Account vs Vault
In Squads, there are two distinct address types:- Multisig Account – the primary account that manages the Squad.
- Vault – a derived account (at a specific index) where assets and program interactions occur.
--multisig-key flag:
- Provide the Multisig Account address, not the Vault address.
- The helper internally derives the Vault address at index 0 to propose transactions to.
Creating a Squads Multisig on Solana Devnet
Squads is the most widely used multisig on Solana. The current version of Squads is v4. The OFT tasks support the usage of a Squads via the--multisig-key param. On mainnet, you can create a v4 Multisig using the Mainnet UI.
On the devnet UI, you are currently not able to create a multisig. However, you can still perform operations such as voting on transactions and executing them.
In order to create a Squads v4 Multisig for Solana Devnet, you have two options: CLI and Typescript SDK.
Creating using the CLI
With the Squads CLI installed, you can run:Creating using the Typescript SDK
Dependencies:Using the created Multisig Account in the Squads Devnet UI
In the Squads v4 Devnet UI, on the initial page load you’ll be asked to fill up the value for the Multisig Config Address. Input the address of the Multisig Account you had just created. If the page is not loading, try updating the Settings to use a private RPC URL. Also ensure that the RPC in use is for Solana Devnet and not Mainnet Beta.Implementing Time-locks for Solana OFT Mints
The Solana OFT Program’s mint function cannot be altered without breaking crosschain transfers. If you require the ability to implement time-locks for minting operations, the timelock must be configured via an additional minter and NOT on the program’s mint function itself. To implement time-locks for mints:- Specify additional minters when creating the OFT
- Configure the timelock on the additional minter authority
- Ensure the timelock is NOT applied directly to the program’s mint function
Using Squads Multisig for Time-locked Mints
The additional minter can be a Squads Multisig, which you can configure to have a timelock for minting transactions. This approach allows you to implement secure time-delayed minting while preserving crosschain transfer functionality. When configuring a Squads Multisig as an additional minter:- Set up the Squads Multisig as described in the previous section
- Configure the desired timelock duration for the multisig transactions
- Specify the multisig address as an additional minter when deploying your OFT