Prerequisites for SVM to EVM Tutorials

Before starting the SVM to EVM tutorials, ensure you have:

Development Environment

  • Anchor and Solana CLI Tools: Install Anchor and Solana CLI Tools following the installation guide. This requires Rust to be installed.

  • Node.js v20 or higher: You can use the nvm package to install and switch between Node.js versions. Once installed, you can verify the node version with:

    node -v
    

    Example output:

    $ node -v
    v23.11.0
    
  • Yarn: For installing and managing dependencies.

  • Git: For cloning the repository.

Starter Kit Repository

  1. Clone the CCIP Solana Starter Kit:

    git clone https://github.com/smartcontractkit/solana-starter-kit.git && cd solana-starter-kit
    
  2. Checkout to the ccip branch:

    git checkout ccip
    
  3. Install dependencies:

    yarn install
    

Wallets

  • Solana Wallet with Private Key: You'll need a Solana keypair file. If you don't have one, create it with:
    solana-keygen new --outfile ~/.config/solana/id.json
    
  • Ethereum Wallet Address: You'll need an Ethereum address as the destination for your cross-chain messages. You don't need the private key for these tutorials since you're only sending to, not from, Ethereum.

Solana RPC URL

Configure Solana CLI for Devnet

Before proceeding, ensure your Solana CLI is configured to use Devnet:

# Using the default public endpoint
solana config set --url https://api.devnet.solana.com

# OR using a custom RPC endpoint if you have one
# solana config set --url YOUR_CUSTOM_DEVNET_RPC_URL

You can verify your current configuration with:

solana config get

You should see your configured Devnet RPC URL in the output. Example output:

$ solana config get
Config File: /Users/<username>/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: /Users/<username>/.config/solana/id.json
Commitment: confirmed

Native Tokens for Transaction Fees

SOL tokens are used for Solana transaction fees. For these tutorials, we will also use SOL to pay for CCIP fees (though LINK and WSOL are alternative payment options).

  • Obtain SOL on Devnet using the airdrop command:

    solana airdrop 3
    
  • Example output:

    Requesting airdrop of 3 SOL
    
    Signature: 2MiFptKYiJQNfzERzNzB4X1tYeBaW1muJ4oNaUpujeaWmgCiwCZ1ftMyYmg9fAitw2Trbsw8yfBNSanLGX4SUAr7
    
    13.25722618 SOL
    

Associated Token Accounts (ATAs)

Solana's token model requires an Associated Token Account (ATA) for each token you want to hold. These must be created before you can receive or send tokens.

Creating ATAs

Create an ATA for each token needed in these tutorials:

# Create ATA for BnM token (used for cross-chain token transfers)
spl-token create-account 3PjyGzj1jGVgHSKS4VR1Hr1memm63PmN8L9rtPDKwzZ6

# Create ATA for LINK token (used for CCIP fee payments)
spl-token create-account GAn1RmBY76BjdqPAFnqM4jhqSSeeo9Zf7ASqHoWLdwZb

# Create ATA for Wrapped SOL (used for wrapped native fee payments)
spl-token create-account So11111111111111111111111111111111111111112

If using a non-default keypair (other than ~/.config/solana/id.json), specify it explicitly:

spl-token create-account <TOKEN_MINT> --owner <YOUR_KEYPAIR_PATH>

Verifying ATAs

Confirm your ATAs were created successfully:

spl-token accounts

Example output:

Token                                         Balance
---------------------------------------------------------------------------------------------------------------
3PjyGzj1jGVgHSKS4VR1Hr1memm63PmN8L9rtPDKwzZ6  0.09
GAn1RmBY76BjdqPAFnqM4jhqSSeeo9Zf7ASqHoWLdwZb  0
So11111111111111111111111111111111111111112   4.440009443

Token Delegation

Before sending CCIP messages with tokens from Solana, you must delegate authority to the CCIP Router's Program Derived Addresses (PDAs). This allows the router to transfer tokens on your behalf when executing cross-chain messages.

Understanding Token Delegations

In Solana, unlike Ethereum where you approve a smart contract to spend your tokens, you need to:

  1. Delegate to CCIP Router's Fee Billing Signer PDA: For fee tokens (LINK and Wrapped SOL)
  2. Delegate to CCIP Router's Fee Billing Signer PDA: For tokens you want to send cross-chain (BnM)

Automating Token Delegation

The token:delegate script automates the token delegation process by:

  1. Identifying your token accounts for Wrapped SOL, BnM, and LINK
  2. Delegating the maximum possible amount to the CCIP Router's fee-billing PDA (allowing it to use tokens for fees)
  3. Providing transaction confirmations and explorer links for verification

Run the delegation script:

yarn svm:token:delegate

After running, verify your token delegations:

yarn svm:token:check

The verification shows:

  • Your current token balances
  • The delegate address for each token
  • Delegation amounts
  • Status of each delegation (✓ Correct or ✗ Missing/Invalid)

Obtaining Testnet Tokens

BnM Tokens on Solana Devnet

To complete the cross-chain token transfer examples, you'll need BnM tokens:

  1. Bridge BnM tokens from Ethereum Sepolia to your Solana Devnet wallet
  2. Follow the detailed instructions in the token transfers tutorial

Wrapped SOL (wSOL)

Native SOL must be wrapped into wSOL token format before it can be used with token-based interfaces. To wrap your SOL:

yarn svm:token:wrap

This command wraps 0.1 SOL to wSOL by default. To specify a custom amount:

yarn svm:token:wrap --amount <LAMPORTS_AMOUNT>

Example:

$ yarn svm:token:wrap --amount 10000000
...
==== Operation Summary ====
[2025-05-01T20:18:03.134Z] Token: Wrapped SOL (wSOL)
[2025-05-01T20:18:03.134Z] Amount Wrapped: 10000000 lamports
[2025-05-01T20:18:03.134Z] New Balance: 4450009443 lamports
[2025-05-01T20:18:03.134Z]
SOL wrapping completed successfully

Note: All amounts are specified in lamports (1 SOL = 1,000,000,000 lamports).

Get the latest Chainlink content straight to your inbox.