← Protocols
Solana
01Description

Solana mainnet-beta — high-throughput, low-latency L1 with parallel execution (Sealevel), ~400ms slots, and sub-cent fees. The default chain for memecoins, consumer payments, perps (Drift, Jupiter Perps), order-book DEXes (Phoenix, Openbook), and NFTs (Tensor, Magic Eden). Native programs are Rust (Anchor / native), with on-the-fly account model rather than EVM-style state.

02Best for
  • 01consumer payment apps and memecoin trading terminals
  • 02perps, CLOB DEXes, and high-frequency DeFi
  • 03high-volume NFT collections and compressed NFTs (cNFTs)
  • 04Solana Pay QR-code checkout
  • 05Solana Mobile (Saga / Seeker) wallet adapter flows
03Install
  • pnpm add @solana/web3.js@^2
  • pnpm add @solana/wallet-adapter-base @solana/wallet-adapter-react @solana/wallet-adapter-react-ui
  • pnpm add @solana-program/system @solana-program/token
  • # Anchor (Rust contracts):
  • cargo install --git https://github.com/coral-xyz/anchor avm --locked --force && avm install latest && avm use latest
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_SOLANA_RPC_URLClientSolana RPC endpoint. The default `https://api.mainnet-beta.solana.com` is rate-limited and unsuitable for production — use Helius, QuickNode, Triton, or Alchemy.
NEXT_PUBLIC_SOLANA_CLUSTERClientCluster name — `mainnet-beta`, `devnet`, or `testnet`.
SOLANA_KEYPAIR_PATHServerPath to a server-side payer keypair JSON file for backend signing (paymaster, treasury, agent flows). Server-only.
05Prompt snippet
Use `@solana/web3.js` v2 (the new functional API): `createSolanaRpc(rpcUrl)` for reads, `createSolanaRpcSubscriptions(wssUrl)` for live updates. For wallet UX, mount `<WalletProvider wallets={[new PhantomWalletAdapter(), new BackpackWalletAdapter(), ...]} autoConnect>` and use `useWallet()` to access `publicKey` and `signTransaction`. For SPL transfers use `@solana-program/token` (`getTransferInstruction({ source, destination, authority, amount })`). For onchain swaps use Jupiter v6 (`https://quote-api.jup.ag/v6`). For program development use Anchor: `anchor init my-program` → write IDL-defined instructions → `anchor build && anchor deploy`. Always set a `recentBlockhash` and use `versioned: 0` transactions (legacy is deprecated).
06Gotchas
  • Solana transactions can fail silently with `BlockhashNotFound` if blockhash is older than ~60s — always fetch a fresh `getLatestBlockhash({ commitment: 'confirmed' })` right before signing.
  • The default mainnet-beta public RPC is heavily rate-limited and drops WebSocket subscriptions — production MUST use Helius/QuickNode/Triton with both HTTP and WSS endpoints.
  • Solana addresses are 32-byte base58 strings, NOT 20-byte hex like EVM — copy/paste between chains will silently corrupt addresses.
  • USDC on Solana lives at `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` (mint). Each holder needs an Associated Token Account (ATA) — derive with `getAssociatedTokenAddress` and create the ATA via `createAssociatedTokenAccountInstruction` if it doesn't exist (otherwise transfer fails).
  • Compute Unit limits default to 200,000 — complex CPI chains hit this fast. Set `ComputeBudgetProgram.setComputeUnitLimit` + `setComputeUnitPrice` explicitly for production transactions, and add a priority fee during congestion.
  • Solana's parallel execution requires accurate `accounts` lists in each instruction — declare every account you read or write or the transaction will fail with `AccountNotFound` at runtime.
  • Rent exemption is required for any account holding data; sending lamports below the rent-exempt minimum will leave the account unable to be opened.
07Alternatives