diff --git a/src/content/ccip/llms-full.txt b/src/content/ccip/llms-full.txt index bb6c40fe995..ac35db8761d 100644 --- a/src/content/ccip/llms-full.txt +++ b/src/content/ccip/llms-full.txt @@ -19418,7 +19418,7 @@ Understanding these encoding details becomes especially important when working w # Cross-Chain Token (CCT) Tutorials Source: https://docs.chain.link/ccip/tutorials/svm/cross-chain-tokens -Last Updated: 2025-08-13 +Last Updated: 2026-06-15 Learn how to implement cross-chain tokens using Chainlink's Cross-Chain Interoperability Protocol (CCIP) on SVM-based blockchains like Solana. @@ -19442,7 +19442,7 @@ This tutorial demonstrates the Lock and Mint token handling mechanism using Lock # Cross-Chain Token Setup: BurnMint with Direct Mint Authority Transfer Source: https://docs.chain.link/ccip/tutorials/svm/cross-chain-tokens/direct-mint-authority -Last Updated: 2025-08-13 +Last Updated: 2026-06-15 This comprehensive tutorial demonstrates how to create and configure cross-chain tokens using Chainlink's Cross-Chain Interoperability Protocol (CCIP) between Solana Devnet and Ethereum Sepolia. You will implement the **direct mint authority transfer** approach within **Path A** from the [CCIP Cross-Chain Token Integration Guide](/ccip/concepts/cross-chain-token/svm/integration-guide). @@ -19490,76 +19490,86 @@ For complete details on token handling mechanisms, see [Token Handling Mechanism ## Prerequisites -This tutorial requires setting up two different repositories in separate terminal windows. Follow the setup instructions for both environments before proceeding. +This tutorial uses a **two-terminal workflow** across two repositories. Install the system tools below, clone both repos, then complete environment setup before starting Phase 1. -### Development Environment Requirements - -**System Requirements:** +### System Requirements -- **Anchor and Solana CLI Tools**: Install following the [installation guide](https://www.anchor-lang.com/docs/installation). Requires Rust to be installed. -- **Node.js v20 or higher**: Use the [nvm package](https://www.npmjs.com/package/nvm) to install and manage versions. Verify with `node -v` -- **Yarn**: For dependency management +- **Node.js v22 or higher**: Verify with `node -v` ([nvm](https://www.npmjs.com/package/nvm) recommended) +- **pnpm**: Required for the BS58 generator (`npm install -g pnpm`) +- **Solana CLI**: [Installation guide](https://docs.solana.com/cli/install-solana-cli-tools) (includes `spl-token`) - **Git**: For cloning repositories +- **CCIP CLI**: For cross-chain transfer testing in the final phase -### Terminal 1: Solana Starter Kit Setup - -**Clone and setup the Solana Starter Kit:** +Install the [CCIP CLI](https://github.com/smartcontractkit/ccip-tools-ts) globally: ```bash -git clone https://github.com/smartcontractkit/solana-starter-kit.git && cd solana-starter-kit +npm install -g @chainlink/ccip-cli +ccip-cli --help ``` -**Install dependencies:** +See the [CCIP CLI documentation](https://docs.chain.link/ccip/tools/cli/) for RPC and wallet configuration. -```bash -yarn install -``` +### Tutorial Workflow -**Configure your Solana environment:** +| Terminal | Repository | Purpose | Commands | +| -------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | --------------- | +| **Terminal 1** | [CCIP Solana BS58 Generator](https://github.com/smartcontractkit/ccip-solana-bs58-generator) | Solana setup and configuration | `pnpm bs58` | +| **Terminal 2** | [Smart Contract Examples (Hardhat)](https://github.com/smartcontractkit/smart-contract-examples/tree/main/ccip/cct/hardhat) | EVM deploy and configuration | `npx hardhat` | +| **Either** | Global `@chainlink/ccip-cli` | Cross-chain transfer testing (final) | `ccip-cli send` | -```bash -# Set Solana CLI to use devnet -solana config set --url https://api.devnet.solana.com +### Terminal 1: CCIP Solana BS58 Generator -# Set your keypair (create one if needed) -solana config set --keypair ~/.config/solana/id.json +**Clone and install** (skip `git clone` if you already have the repo): -# If you do not have a keypair, create one: -solana-keygen new --outfile ~/.config/solana/id.json +```bash +git clone https://github.com/smartcontractkit/ccip-solana-bs58-generator.git +cd ccip-solana-bs58-generator +pnpm install ``` -**Fund your Solana wallet:** +**Configure Solana CLI for devnet:** + +First, check whether your environment is already set up: ```bash -# Get your wallet address +solana config get solana address - -# Request SOL from the devnet faucet -solana airdrop 2 +solana balance ``` -**Verify your setup:** +If the RPC URL is already `https://api.devnet.solana.com`, your keypair path is correct, and you have sufficient SOL, skip to [Terminal 2 setup](#terminal-2-smart-contract-examples-hardhat) below. + +Otherwise, run only the steps you need: ```bash -# Check your SOL balance -solana balance +# Set devnet (skip if config get already shows devnet) +solana config set --url https://api.devnet.solana.com -# Verify you are on devnet -solana config get +# Point to your keypair (skip if config get already shows the path you want) +solana config set --keypair ~/.config/solana/id.json + +# Create a keypair only if the file does not exist yet +solana-keygen new --outfile ~/.config/solana/id.json + +# Fund your wallet if balance is low +solana airdrop 2 +solana balance ``` -### Terminal 2: Smart Contract Examples Setup + + +### Terminal 2: Smart Contract Examples (Hardhat) -**Clone the repository and navigate to the Hardhat project:** +**Clone, install, and compile** (skip `git clone` if you already have the repo): ```bash git clone https://github.com/smartcontractkit/smart-contract-examples.git cd smart-contract-examples/ccip/cct/hardhat -``` - -**Install and compile dependencies:** - -```bash npm install npm run compile ``` @@ -19567,39 +19577,71 @@ npm run compile **Set up encrypted environment variables:** ```bash -# Set encryption password +# Required at the start of each session npx env-enc set-pw -# Configure environment variables +# Verify existing variables (skip npx env-enc set if all required vars are already configured) +npx env-enc view + +# Add or update variables only if missing npx env-enc set ``` -**Required environment variables for Ethereum Sepolia:** +**Required variables for Ethereum Sepolia:** - `ETHEREUM_SEPOLIA_RPC_URL`: RPC endpoint from [Alchemy](https://www.alchemy.com/) or [Infura](https://www.infura.io/) - `PRIVATE_KEY`: Your testnet wallet private key ([MetaMask export guide](https://support.metamask.io/managing-my-wallet/secret-recovery-phrase-and-private-keys/how-to-export-an-accounts-private-key/)) - `ETHERSCAN_API_KEY`: API key from [Etherscan](https://docs.etherscan.io/getting-started/viewing-api-usage-statistics) -**Fund your wallet:** +**Fund your EVM wallet:** + +- Acquire **ETH** on Ethereum Sepolia for transaction gas and CCIP fees ([Chainlink faucet](https://faucets.chain.link/) or [Google Cloud Faucet](https://cloud.google.com/application/web3/faucet/ethereum/sepolia)) +- **LINK** is optional — use `--fee-token LINK` on EVM → Solana sends if you prefer paying CCIP fees in LINK + +### Cross-Chain Transfers (CCIP CLI) + +The final tutorial phase uses globally installed `ccip-cli` (not the BS58 generator): + +- **Solana → EVM**: Run from Terminal 1 with `--wallet ~/.config/solana/id.json` +- **EVM → Solana**: Run from Terminal 2 (Hardhat directory). Prefer `--wallet hardhat:` ([Hardhat keystore](https://hardhat.org/docs/plugins/hardhat-keystore)) so the signing key stays encrypted. Hardhat tasks load env-enc automatically; `ccip-cli` does not. As an alternative, view the same key with `npx env-enc view` and export `PRIVATE_KEY` manually for the send command. -- Acquire LINK and ETH on Ethereum Sepolia using [Chainlink faucets](https://faucets.chain.link/) +**RPC endpoints** (required for source and destination chains). You can provide them any of these ways — see [CCIP CLI configuration](https://docs.chain.link/ccip/tools/cli/configuration): + +- **Command line:** pass `--rpc` on each command (repeat for multiple networks), or `--rpcs` with comma-separated URLs +- **Environment variables:** export `RPC_*` variables (e.g., `RPC_SEPOLIA`, `RPC_SOLANA_DEVNET`) or the tutorial's `SOLANA_DEVNET_RPC` and `ETHEREUM_SEPOLIA_RPC_URL` exports +- **File:** create a `.env` file in the directory where you run `ccip-cli` (default `--rpcs-file`, one URL per line) + +See the tutorial's **Configure CCIP CLI** section for the recommended `--rpc` examples. + +### Environment Variables + +Variables use prefixes to prevent confusion across repositories and tools: + +| Prefix | Usage | Examples | +| ------------ | ----------------------- | ------------------------------------------------------------------------- | +| `ETH_*` | Ethereum addresses | `ETH_TOKEN_ADDRESS`, `ETH_POOL_ADDRESS` | +| `SOL_*` | Solana addresses | `SOL_TOKEN_MINT`, `SOL_POOL_ADDRESS`, `SOL_WALLET_ADDRESS` | +| `SOL_CCIP_*` | Solana CCIP program IDs | `SOL_CCIP_POOL_PROGRAM`, `SOL_CCIP_ROUTER`, `SOL_CCIP_FEE_QUOTER_PROGRAM` | ## Tutorial Approach -This tutorial provides step-by-step instructions with detailed explanations of what each command does and why. You'll work primarily in Terminal 1 (Solana) with occasional switches to Terminal 2 (EVM). +This tutorial provides step-by-step instructions with detailed explanations of what each command does and why. You'll work primarily in Terminal 1 (CCIP Solana BS58 Generator) with occasional switches to Terminal 2 (EVM). **Environment Variable Management**: This tutorial uses phase-based variable files (e.g., `~/.phase1_vars`, `~/.ccip_complete_vars`) to eliminate manual variable re-entry when switching between terminals. Each phase saves its variables to files that subsequent phases can load automatically. For deeper technical implementation details, refer to: -- **[Solana Starter Kit README](https://github.com/smartcontractkit/solana-starter-kit/blob/main/README.md)**: SVM command details +- **[CCIP Solana BS58 Generator README](https://github.com/smartcontractkit/ccip-solana-bs58-generator/blob/main/README.md)**: Solana CLI command details, `--execute` EOA workflow, and options - **[Smart Contract Examples README](https://github.com/smartcontractkit/smart-contract-examples/blob/main/ccip/cct/hardhat/README.md)**: EVM implementation guide +**EOA execution**: In Terminal 1, append `--execute` to each `pnpm bs58` command so your local Solana wallet signs and sends transactions directly. Set `--authority` to your wallet address (`$SOL_WALLET_ADDRESS`). Read-only commands (`get-state`, `get-chain-config`, `derive-accounts`) do not use `--execute`. + ## Phase 1: Ethereum Sepolia Token Setup In this phase, you'll deploy and configure your ERC20 token with CCIP BurnMint pools on Ethereum Sepolia. @@ -19646,31 +19688,37 @@ Save your EVM configuration for use in later phases: Now we'll create and configure the Solana side of your cross-chain token system. -### Step 1: Create SPL Token +### Step 1: Prepare Environment + +Load EVM variables from Phase 1 and set Solana CCIP constants: + +### Step 2: Create SPL Token -Create an SPL token with metadata support: +Create an SPL token with metadata and initial supply using direct EOA execution: Set the token mint variable: -### Step 2: Initialize CCIP Token Pool +### Step 3: Initialize CCIP Token Pool Initialize the token pool configuration on Solana: -Save the Pool Signer PDA and Pool Config PDA from the output: +Save the Pool Signer PDA and Pool Config PDA. Derive them from the onchain pool configuration: + +Copy the **Pool Signer PDA** and **Pool State PDA** addresses from the output, then export them: -### Step 3: Create Pool Token Account +### Step 4: Create Pool Token Account In this step, you will create an Associated Token Account (ATA) for the Pool Signer PDA. This ATA is required for the pool to hold and manage tokens during cross-chain transfer operations. -### Step 4: Register as CCIP Administrator +### Step 5: Register as CCIP Administrator #### Propose Admin @@ -19680,7 +19728,7 @@ In this step, you will propose yourself as the CCIP administrator for the Solana In this step, you will accept the administrator role for the Solana token. This process establishes your control over the token's CCIP configuration on Solana. -### Step 5: Transfer Mint Authority to Pool Signer PDA +### Step 6: Transfer Mint Authority to Pool Signer PDA -### Step 6: Save Phase 2 Variables +Verify the authority transfer: + +### Step 7: Save Phase 2 Variables Save your Solana configuration for use in cross-chain setup: @@ -19702,7 +19752,7 @@ Configure bidirectional connectivity between your token pools on both chains. ### Step 1: Configure Solana Pool -**Stay in Terminal 1 (Solana Starter Kit)** +**Stay in Terminal 1** (CCIP Solana BS58 Generator) Load the Ethereum addresses from Phase 1: @@ -19748,16 +19798,23 @@ Register the BurnMint token pool with your token in the TokenAdminRegistry: ### Step 2: Register Solana Pool -**Switch to Terminal 1 (Solana Starter Kit)** +**Switch to Terminal 1** (CCIP Solana BS58 Generator) ```bash pwd -# Should show ../solana-starter-kit +# Should show: .../ccip-solana-bs58-generator +``` + +Load variables from previous phases: + +```bash +source ~/.phase1_vars +source ~/.phase2_vars ``` #### Create Address Lookup Table -Address Lookup Tables (ALT) optimize Solana transactions by compressing addresses. +Address Lookup Tables (ALT) optimize Solana transactions by compressing addresses. With EOA execution, create and populate the ALT in one step: Save the ALT address: @@ -19771,66 +19828,109 @@ Save all variables for the testing phase: ## Phase 5: Pre-Transfer Setup -Before testing transfers, complete final setup steps. +Before validating your configuration, complete final setup steps. -### Step 1: Get Pool Signer PDA +### Step 1: Verify Pool Signer PDA -Extract the Pool Signer PDA for reference: +Confirm the Pool Signer PDA matches your saved configuration: -Confirm this matches your previously saved PDA: - -```bash -echo "Saved Pool Signer PDA: $SOL_POOL_SIGNER_PDA" -echo "Current Pool Signer PDA: BwzTc3R77vf1dS4kj3JX8YGpCvjsg91vBDgyKJfeBkue" -``` +Compare the onchain **Pool Signer** with your saved variable: ### Step 2: Delegate Token Authority -In this step, you will delegate token approval to the fee-billing signer PDA, which is what enables CCIP to transfer tokens on your behalf when sending cross-chain messages. +In this step, you will delegate token approval to the CCIP fee-billing signer PDA, which enables CCIP to transfer tokens on your behalf when sending cross-chain messages. + +Approve the fee-billing signer to transfer tokens from your ATA: + +### Step 3: Verify Delegation -### Step 3: Verify Delegate +Check that your token account is delegated to the fee-billing signer: -Check the previous step to verify the token is delegated to the Pool Signer PDA: +Display token account and delegation status: -## Phase 6: Testing Cross-Chain Transfers +## Phase 6: Test Cross-Chain Transfers -In this step, you will test bidirectional token transfers to verify your setup. +Validate your configuration, then execute bidirectional token transfers using the CCIP CLI. + + Confirm you are in the correct directory (Terminal 1): ```bash pwd -# Should output: ../solana-starter-kit +# Should show: .../ccip-solana-bs58-generator ``` ### Step 1: Load Complete Configuration -Before testing, ensure all variables are available in your current terminal: +### Step 2: Verify Solana Pool and Chain Config + +### Step 3: Verify Ethereum Pool (Terminal 2) -### Step 2: Transfer Solana → Ethereum +**Switch to Terminal 2** (Smart Contract Examples - Hardhat): -**In Terminal 1 (Solana Starter Kit)** +```bash +npx hardhat getPoolConfig \ + --pooladdress $ETH_POOL_ADDRESS \ + --network ethereumSepolia +``` + +Confirm the Ethereum pool recognizes Solana Devnet with your `$SOL_POOL_CONFIG_PDA` and `$SOL_TOKEN_MINT`. + +### Configure CCIP CLI + +Export these RPC URLs once before your first transfer: + +```bash +export SOLANA_DEVNET_RPC="https://api.devnet.solana.com" +export ETHEREUM_SEPOLIA_RPC_URL="" + +export ETH_CCIP_ROUTER="0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59" +``` -### Step 3: Transfer Ethereum → Solana +Use the same `ETHEREUM_SEPOLIA_RPC_URL` from your env-enc setup in Terminal 2 (`npx env-enc view`). On `ccip-cli send`, the source chain RPC quotes fees and submits the transaction; for token-only transfers in this tutorial, that is the only RPC strictly required to send. Pass both RPCs on cross-chain commands anyway: the destination RPC is required for `ccip-cli show --wait` and for optional send features such as `--estimate-gas-limit` or `send --wait`. -