Skip to main content
Version: Endpoint V2 Docs

Getting Started with LayerZero V2 on Solana

caution

The Solana OFT, Endpoint, and ULN Programs are currently in Mainnet Beta!


Any data, whether it's a fungible token transfer, an NFT, or some other smart contract input can be encoded on-chain as a bytes array, and delivered to a destination chain to trigger some action using LayerZero.

Because of this, any blockchain that broadly supports state propagation and events can be connected to LayerZero, like Solana.

tip

If you're new to LayerZero, we recommend reviewing "What is LayerZero?" before continuing.


LayerZero provides sister Solana Programs that can communicate with the equivalent Solidity Contract Libraries you deploy on the Ethereum Virtual Machine (EVM).

These programs, like their solidity counterparts, simplify calling the LayerZero Endpoint, provide message handling, interfaces for protocol configurations, and other utilities for interoperability:

Each of these programs standards implement common functions for sending and receiving omnichain messages.

Differences from the Ethereum Virtual Machine

The full differences between Solidity and Solana are outside the scope of this tutorial (e.g., see A Complete Guide to Solana Development for Ethereum Developers or 60 Days of Solana by RareSkills), however we will cover some major considerations.

info

Skip this section if you already feel comfortable working within the Solana Virtual Machine (SVM) and the Solana Account Model.

Writing Smart Contracts on Solana

To create a new ERC20 tokens on an EVM-compatible blockchain, a developer will have to inherit and redeploy the ERC20 smart contract.

Solana is different. Direct translation of Solidity contract inheritance to Solana is not possible because Rust does not have classes like Solidity. Instead, the Solana Account Model enables program reusability.

Solana Token Program Solana Token Program

Rather than deploying a new ERC20 smart contract for every new token you want to issue, you will instead send an instruction to the Solana Token Program and create a new account, known as the Mint Account, which defines a set of values based off the program's interface (e.g., the number of tokens in circulation, decimal points, who can mint more tokens, and who can freeze tokens).

Solana Token Program Solana Token Program

An account on Solana either is an executable program (i.e. a smart contract) or holds data (e.g. how many tokens you have).

info

Sometimes you’ll see Solana tokens referred to as “SPL tokens.” SPL stands for Solana Program Library, which is a set of Solana programs that the Solana team has deployed on-chain. SPL tokens are similar to ERC20 tokens, since every SPL token has a standard set of functionality.


A Program Derived Address (PDA) can then be used as the address (unique identifier) for an on-chain account, providing a method to easily store, map, and fetch program state. For example, a user's wallet and the SPL Token Mint can be used to derive the Token Account.

OFT Program OFT Program

To be compatible with the Solana Account Model, the Omnichain Fungible Token (OFT) Program extends the existing SPL token standard to interact with the LayerZero Endpoint smart contract.

OFT Program OFT Program

The typical path for Solana program development involves interacting with or deploying executable code that defines your specific implementation, and then having other developers mint accounts that want to use that interface (e.g., the SPL Token Program defines how tokens behave, and the Mint Accounts define the different brands of SPL tokens).

The OFT Program is different in this respect. Because every Solana Program has an Upgrade Authority, and this authority can change or modify the implementation of all child accounts, developers wishing to create cross-chain tokens on Solana will need to deploy their own instance of the OFT Program to mint new OFT Config Accounts.

Solana Token Program Solana Token Program

This decision was made so that tokens minted off of the OFT Program will own their OFT's Upgrade Authority, rather than depend on LayerZero Labs to maintain a single, mutable OFT Program for all OFT Configs.

See "Why Auditing the Code is Not Enough: A Discussion on Solana Upgrade Authorities" for more information on how Upgrade Authorities behave on Solana.

info

LayerZero Labs may eventually in the future maintain with another entity a version of the OFT Program which users can Mint OFT Config Accounts from, but for now developers should consider deploying their own version of the OFT Program.

Writing Solana Programs

Solana Programs are most commonly developed with Rust. LayerZero OApp Programs should also be written in Rust to take advantage of LayerZero Solana libraries. See an Overview of Developing On-chain Programs to learn more about Solana.

caution

While some initiatives exist to enable developers to write Solana programs in Solidity, compiling LayerZero Solidity Libraries using compilers like Neon EVM or Solang will NOT work with the Solana LayerZero Endpoint, because the LayerZero Rust Endpoint does not match 1:1 the Solidity Endpoint interface.