Skip to main content

Overview

The CDP SDK supports multiple blockchain networks across EVM-compatible chains and Solana. Each network has different capabilities, and the SDK provides type-safe access to network-specific features.

Supported Networks

EVM Networks

The SDK supports a wide range of EVM-compatible networks:
  • Base - Coinbase’s Layer 2 network (full feature support)
  • Ethereum - Ethereum mainnet
  • Optimism - Optimistic Ethereum Layer 2
  • Arbitrum - Arbitrum One Layer 2
  • Polygon - Polygon PoS network
  • Avalanche - Avalanche C-Chain
  • BNB - BNB Smart Chain
  • Zora - Zora Network
  • Base Sepolia - Base testnet with faucet support
  • Ethereum Sepolia - Ethereum testnet
  • Ethereum Holesky - Ethereum testnet for staking
  • Optimism Sepolia - Optimism testnet
  • Arbitrum Sepolia - Arbitrum testnet

Solana Networks

  • Solana Mainnet - Solana production network
  • Solana Devnet - Solana development network with faucet support

Network Capabilities

Different networks support different features in the CDP SDK. The SDK enforces these capabilities at the type level to prevent runtime errors.

EVM Network Capabilities

NetworkToken BalancesFaucetTransferSwapFund (Onramp)
Base-
Base Sepolia--
Ethereum--
Ethereum Sepolia---
Optimism----
Arbitrum----
Polygon-----
sendTransaction is available on all networks. It provides low-level transaction sending without additional features like token resolution or swap routing.

Capability Descriptions

Query ERC-20 token balances for an account. Returns token metadata including symbol, decimals, and balance.Supported networks: Base, Base Sepolia, Ethereum
Request testnet tokens for testing and development. Typically provides native tokens (ETH, SOL) for gas.Supported networks: Base Sepolia, Ethereum Sepolia, Ethereum Holesky, Optimism Sepolia, Arbitrum Sepolia, Solana Devnet
Transfer native tokens or ERC-20 tokens with automatic gas estimation and token address resolution.Supported networks: Base, Base Sepolia, Ethereum, Ethereum Sepolia, Optimism, Arbitrum
Execute token-to-token swaps using decentralized exchange aggregators with optimized routing.Supported networks: Base, Ethereum, Optimism, Arbitrum
Enable fiat-to-crypto onramp for purchasing crypto with credit/debit cards or bank transfers.Supported networks: Base

Network-Scoped Accounts

The SDK provides a type-safe way to work with network-specific features using network-scoped accounts. When you scope an account to a network, only the methods available on that network are accessible.
import { CdpClient } from "@coinbase/cdp-sdk";

const cdp = CdpClient.configureFromJson({
  filePath: "~/Downloads/cdp_api_key.json",
});

const account = await cdp.evm.createAccount();

// Scope to Base network - all features available
const baseAccount = await account.useNetwork("base");
await baseAccount.listTokenBalances();
await baseAccount.swap({ /* swap options */ });

// Scope to Base Sepolia - faucet available, swap not available
const testAccount = await account.useNetwork("base-sepolia");
await testAccount.requestFaucet({ token: "eth" });
// testAccount.swap() // TypeScript error - not available on testnet

// Scope to Arbitrum - swap available, token balances not available  
const arbitrumAccount = await account.useNetwork("arbitrum");
await arbitrumAccount.swap({ /* swap options */ });
// arbitrumAccount.listTokenBalances() // TypeScript error - not available
Using network-scoped accounts provides better type safety and prevents runtime errors from calling unsupported methods.

Testnet vs Mainnet

When to Use Testnets

Use testnet networks during development to:
  • Test your integration without real funds
  • Experiment with transactions and smart contracts
  • Debug issues in a safe environment
  • Use faucets to get free testnet tokens
Integrate testnet transactions in your CI/CD:
  • Run automated E2E tests with real blockchain interactions
  • Validate transaction flows before production deployment
  • Test error handling and edge cases

When to Use Mainnet

Use mainnet networks for:
  • Real user transactions with actual value
  • Production-ready applications
  • Live blockchain data and state
  • Transactions use real funds and cannot be reversed
  • Gas fees must be paid in native tokens (ETH, SOL, etc.)
  • Network congestion can affect transaction times
  • Always test thoroughly on testnet first

Network Configuration

Chain IDs

Each EVM network has a unique chain ID:
const CHAIN_IDS = {
  "base": 8453,
  "base-sepolia": 84532,
  "ethereum": 1,
  "ethereum-sepolia": 11155111,
  "optimism": 10,
  "arbitrum": 42161,
  "polygon": 137,
  "avalanche": 43114,
  "bnb": 56,
  "zora": 7777777
};

RPC URLs

The SDK uses Coinbase Node RPC URLs by default. For Base networks, you can access node URLs:
import { getBaseNodeRpcUrl } from "@coinbase/cdp-sdk";

const baseMainnetUrl = getBaseNodeRpcUrl("base");
const baseSepoliaUrl = getBaseNodeRpcUrl("base-sepolia");

console.log(baseMainnetUrl); // https://api.developer.coinbase.com/rpc/v1/base/...
RPC URLs include your API key. Never expose them in client-side code or public repositories.

Custom Networks

For networks not natively supported, you can use custom RPC URLs:
// Use custom RPC URL
const customAccount = await account.useNetwork("https://rpc.custom-network.com");

// Type hint for known network capabilities
const typedAccount = await account.useNetwork<"base">(
  "https://mainnet.base.org" as "base"
);

Network Status and Health

Monitor network status at status.coinbase.com for CDP service health and network availability.

Best Practices

  • Start development on testnets (Base Sepolia, Ethereum Sepolia)
  • Use Base for production applications with full CDP feature support
  • Consider network fees - Layer 2 networks (Base, Optimism, Arbitrum) have lower gas costs
  • Choose networks based on your target users and ecosystem
  • Handle network-specific errors (insufficient balance, network congestion)
  • Implement retry logic for transient network failures
  • Check network capabilities before calling methods
  • Use try-catch blocks for all network operations
  • Cache network configuration and RPC URLs
  • Scope accounts to networks early to avoid repeated calls
  • Use batch operations when supported
  • Monitor transaction confirmation times per network

Next Steps

Transactions

Learn about transaction lifecycle and management

Accounts

Understand different account types

Sending Transactions

Step-by-step guide to sending transactions

Token Transfers

Transfer tokens across networks

Build docs developers (and LLMs) love