Bridging from Chiliz Chain to Solana
Deploy an OFT Adapter on Chiliz Chain and a Native OFT on Solana using LayerZero v2 to bridge tokens from Chiliz Chain to the Solana network.
To bridge an existing token from Chiliz Chain to Solana, you need to write and deploy two separate smart contracts: an OFT Adapter on the chain where the token already exists (Chiliz Chain), and a Native OFT on the destination chain (Solana).
Note that LayerZero provide their own QuickStart for OFT contracts:
Prerequisites
This guide requires the following:
A token contract address on Chiliz Chain. You do not need to own it.
A Web3 wallet for each chain (MetaMask does not support non-EVM chains):
For Chiliz Chain: MetaMask wallet with the Chiliz Chain RPC configuration.
For Solana: Solflare wallet with Solana Mainnet configuration. Here is their set-up guide.
Enough gas tokens on each chain to pay for the contract deployments as well as the gas fees for sending messages.
On Chiliz Chain: CHZ tokens.
On Solana: SOL tokens.
Step 1: Contract Development
Preparing the OFTAdapter on Chiliz Chain
This is a preparatory step, do not deploy right away! You will deploy in Step 3.
The OFTAdapter contract acts as a lockbox for your existing token. When users bridge their tokens away from Chiliz Chain, this contract locks the original ERC20 tokens.
Create a new file named ChilizTokenAdapter.sol in your contracts folder:
Preparing and Deploying the OFT on Solana
Unlike Chiliz Chain, Solana does not use the Ethereum Virtual Machine (EVM) or Solidity language. Solana smart contracts (called "Programs") are written in Rust.
To bridge your token, you need to deploy an OFT program on Solana. When this program receives a verified message from your Chiliz-deployed OFTAdapter, it will mint the corresponding SPL token into the user's Solana wallet.
LayerZero provides a ready-to-use Anchor example so you do not have to write the Rust bridge logic from scratch.
1. Clone the LayerZero OFT Solana example:
2. Build the Rust program
This will also generate your unique Solana Program ID (equivalent to a contract address in the EVM):
After the build completes, Anchor will generate a new keypair in target/deploy/oft_solana-keypair.json.
You can retrieve your new Program ID by running:
3. Deploy to Solana Mainnet
Make sure that your Solana CLI is configured for Mainnet and your local wallet has enough $SOL for the deployment and storage rent.
Don't forget to update the Anchor.toml file and the lib.rs declare_id! macro with this new Program ID before deploying.
4. Initialize the OFT and the SPL Mint
On Solana, a token's logic and its ledger are separated. You must initialize a new Mint Account (the SPL Token) and assign your newly deployed OFT Program as the Mint Authority. This ensures only the LayerZero bridge can mint new tokens on Solana.
The LayerZero SDK provides Hardhat/TypeScript tasks to handle this initialization directly from the command line. In your oft-solana project, configure your LayerZero Endpoint for Solana (30168) and run the initialization script:
Once this initialization transaction is confirmed on the Solana blockchain, your native OFT program is fully set up and ready to be wired to the Chiliz OFTAdapter!
Step 2: LayerZero Configuration
With your Chiliz Adapter deployed and your Solana OFT program initialized, you must now configure their connection. This is where the difference between EVM and non-EVM networks becomes highly visible.
LayerZero’s cross-chain messaging requires all peer addresses to be formatted as bytes32. Fortunately, the LayerZero V2 Hardhat tooling automatically handles the Base58-to-Bytes32 conversion for you, as long as you define the endpoints correctly in your config.
The Simple Config Generator is the recommended way to generate wiring configuration, as it automates bidirectional wiring and applies recommended security configurations under the hood.
Create or update your layerzero.config.ts file in the root of your Hardhat project:
The LayerZero wire task will read this, decode the Base58 string, pad it to 32 bytes, and pass it securely into the Chiliz OFTAdapter's setPeer function.
Step 3: Deployment Workflow
With your contracts written and your layerzero.config.ts prepared, it is time to deploy the Chiliz OFTAdapter. Since you already built and deployed the Solana native OFT program using Anchor in Step 1, this step focuses on deploying the EVM side of the bridge using Hardhat.
Deploying The Chiliz OFTAdapter contract
In your Hardhat project, create a deployment script in your deploy/ directory named 01_deploy_chiliz_solana_adapter.ts. This script passes your existing token address and the Chiliz Endpoint V2 address (EID) into the constructor.
Deploying the Chiliz OFTAdapter
Run the following command in your terminal to deploy the EVM Adapter:
Once the deployment is complete, Hardhat will save the Chiliz contract address in the deployments/ folder.
At this point, you have live contracts on both Chiliz Chain (EVM) and Solana (SVM), but they do not yet trust each other. Time to make them meet!
Step 4: Wiring & Peering
To allow your OFTAdapter contract and OFT program to communicate, you must "wire" them together as trusted peers.
Because we are bridging across two entirely different Virtual Machines (EVM and SVM), configuring requires special attention.
To guarantee the Executor has enough Compute Units and Lamports to mint tokens and create ATAs on Solana, you must define these limits in your layerzero.config.ts file before wiring.
Run the automated wire command in your terminal:
This will prepare the 6 required configuration transactions:
setSendLibrary: Assigns the MessageLib for outbound packets.setReceiveLibrary: Assigns the MessageLib for inbound packets.setConfig: Configures the DVNs and Executor.setConfig: Configures the DVNs for inbound verification.setEnforcedOptions: Ensures consistent execution parameters (crucial for ensuring the user pays enough upfront to cover Solana Compute Units and Lamport rent).setPeer: Links the Solana EID to your destination Base58 Program ID.
The LayerZero V2 toolbox automates the heavy lifting: it will decode the Base58 Solana address, pad it to the required bytes32 EVM format, and submit the setPeer and setEnforcedOptions transactions to both chains.
Once the wiring transactions confirm, your EVM-to-Solana bridge is live and securely permissioned.
Your token is officially ready to cross the EVM/SVM divide!
Step 5: Operation & Testing
With your Chiliz Adapter deployed, your Solana Native OFT initialized, and the two properly wired together, your token is officially ready to cross the EVM/SVM divide. The final step is to execute and track a test transfer from Chiliz Chain to Solana.
1) Sending the Cross-Chain Message to Solana
The LayerZero V2 toolbox includes a Hardhat task for sending OFT transfers directly from the command line.
Unlike EVM-to-EVM transfers where your destination is a standard hexadecimal string, your destination here is a Base58 Solana wallet address. The LayerZero CLI handles the Base58-to-Bytes32 conversion for the message payload automatically.
Run the following command in your terminal:
2) Tracking the Packet on LayerZero Scan
Because bridging to Solana involves translating between two entirely different consensus mechanisms and waiting for SVM finality, an asynchronous delay is normal.
To track this journey in real-time, click the LayerZero Scan link that appears in the CLI output.
Learn more about this tool here:
Decimal Translation
The Solana Native OFT will have automatically scaled the 6-decimal payload coming from the bridge up to the standard SPL 9 decimals, so your Solana wallet receives exactly 10 full tokens.
4) Troubleshooting Stuck Messages
If your transaction is marked as confirmed on Chiliz but fails to execute on Solana, the most common culprit is an Insufficient Lamports, or Compute Units error.
If the destination Solana wallet did not already have an Associated Token Account (ATA) for your specific token, the LayerZero Executor had to pay the Solana "rent exemption" fee to create it.
If the
valueparameter (Lamports) in yourenforcedOptionswas set too low to cover this rent, or if thegas(Compute Units) was insufficient, the Executor will refuse to pay out of pocket, and the message will stall.Fix: You do not lose your tokens. You can manually push a stuck message through via the LayerZero Scan UI. Connect your Solana wallet, click the "Force Resume" or "Execute" button on the block explorer, and pay the local destination fee (Compute Units + ATA Rent in $SOL) yourself to finalize the minting.
Last updated
Was this helpful?