Wallet API v2: Quickstart Guide

·

The Wallet API v2 empowers developers to seamlessly integrate blockchain account creation and transaction management into their applications. With support for both EVM-compatible networks and the Solana blockchain, this powerful API streamlines the development of decentralized applications (dApps), crypto wallets, and Web3 services.

Whether you're building on Ethereum, Base, or Solana, Wallet API v2 provides a secure, scalable foundation for managing digital assets programmatically.


Getting Started with Wallet API v2

This guide walks you through setting up your development environment, creating blockchain accounts, funding them with testnet tokens, and sending transactions — all using real code examples in TypeScript and Python.

You’ll learn how to:

Let’s dive in.


Prerequisites

Before using the Wallet API v2, ensure your development environment is ready:

Once these are set up, proceed to authenticate your requests by generating API credentials.

Generate Your API Keys

To interact with the Wallet API v2, you need two key components:

  1. CDP API Key
  2. Wallet Secret

👉 Generate your secure API credentials now and start integrating with Wallet API v2.

Log in to the CDP Portal, navigate to:

Keep both values secure — you’ll use them to authenticate every request.

For more details, refer to the official CDP API Keys and Wallet Security documentation.

Set Up Your Project

Initialize a new project directory and configure environment variables for secure credential handling.

Run the following commands in your terminal:

mkdir cdp-sdk-example && cd cdp-sdk-example
npm init -y
npm pkg set type="module"
touch main.ts
touch .env

Add your credentials to .env:

CDP_API_KEY_ID=your-api-key-id
CDP_API_KEY_SECRET=your-api-key-secret
CDP_WALLET_SECRET=your-wallet-secret

Install required packages:

npm install @coinbase/cdp-sdk dotenv

Now, initialize the CDP client in main.ts:

import { CdpClient } from "@coinbase/cdp-sdk";
import dotenv from "dotenv";

dotenv.config();

const cdp = new CdpClient(); // Automatically loads keys from environment

This client will be used across all subsequent operations.


Step 1: Create Blockchain Accounts

Wallet API v2 supports two major account types:

Create an EVM Account

Use the cdp.evm.createAccount() method to generate a new Ethereum-style wallet:

const account = await cdp.evm.createAccount();
console.log("Created EVM account:", account.address);

Example output:

Created EVM account: 0x3c0D84055994c3062819Ce8730869D0aDeA4c3Bf

Create a Solana Account

Similarly, create a Solana account using:

const account = await cdp.solana.createAccount();
console.log("Created Solana account:", account.address);

Example output:

Created Solana account: 2XBS6naS1v7pXEg25z43FGHnmEgEad53fmiZ9S6LPgKn

These accounts are fully functional and ready for funding and transactions.


Step 2: Fund Accounts with Testnet Tokens

Newly created accounts start with zero balance. Use the Faucet API to receive test tokens on supported testnets.

Fund an EVM Account

Request ETH on Base Sepolia testnet:

const { transactionHash } = await cdp.evm.requestFaucet({
  address: account.address,
  network: "base-sepolia",
  token: "eth"
});

Output example:

Requested funds from ETH faucet: https://sepolia.basescan.org/tx/0x9e93a16f2ca67f35bcb1ea2933f19035ae1e71ff3100d2abc6a22ce024d085ec

Fund a Solana Account

Get SOL on Solana devnet:

await cdp.solana.requestFaucet({
  address: account.address,
  token: "sol"
});

Output example:

Requested funds from Solana faucet: https://explorer.solana.com/tx/4KEPbhkRLTg2FJNqV5bbUd6zv1TNkksxF9PDHw2FodrTha3jq2Cojn4hSKtjPWdrZiRDuYp7okRuc1oYvh3JkLuE?cluster=devnet

Funds typically arrive within seconds.


Step 3: Send a Transaction

Now that your account is funded, send your first transaction.

Send ETH via EVM

You'll need viem to handle transaction confirmation:

npm install viem

Full example:

import { http, createPublicClient, parseEther } from "viem";
import { baseSepolia } from "viem/chains";

const publicClient = createPublicClient({ chain: baseSepolia, transport: http() });

// Create account & fund via faucet (steps above)

const transactionResult = await cdp.evm.sendTransaction({
  address: account.address,
  transaction: {
    to: "0x0000000000000000000000000000000000000000",
    value: parseEther("0.000001")
  },
  network: "base-sepolia"
});

const txReceipt = await publicClient.waitForTransactionReceipt({
  hash: transactionResult.transactionHash
});

console.log(`Transaction sent! View on explorer: https://sepolia.basescan.org/tx/${transactionResult.transactionHash}`);

Send SOL via Solana

Install the Web3.js library:

npm install @solana/web3.js@1

Send SOL with this script:

import { Connection, PublicKey, SystemProgram, Transaction } from "@solana/web3.js";

const connection = new Connection("https://api.devnet.solana.com");

// After creating and funding account...

async function sendTransaction(address: string) {
  const lamportsToSend = 1000; // 0.000001 SOL
  const fromPubkey = new PublicKey(address);
  const toPubkey = new PublicKey("EeVPcnRE1mhcY85wAh3uPJG1uFiTNya9dCJjNUPABXzo");

  const { blockhash } = await connection.getLatestBlockhash();
  const transaction = new Transaction().add(
    SystemProgram.transfer({
      fromPubkey,
      toPubkey,
      lamports: lamportsToSend
    })
  );

  transaction.recentBlockhash = blockhash;
  transaction.feePayer = fromPubkey;

  const serializedTx = transaction.serialize({ requireAllSignatures: false }).toString("base64");
  const { signature } = await cdp.solana.signTransaction({
    address,
    transaction: serializedTx
  });

  const decodedTx = Buffer.from(signature, "base64");
  const txId = await connection.sendRawTransaction(decodedTx);

  console.log(`Sent SOL! Explorer link: https://explorer.solana.com/tx/${txId}?cluster=devnet`);
}

👉 Start building with blockchain transactions today — explore advanced features and scale your dApp.


Core Keywords

This guide integrates the following SEO-optimized keywords naturally throughout:

These terms reflect high-intent search queries from developers entering the Web3 space.


Frequently Asked Questions (FAQ)

What blockchains does Wallet API v2 support?

Wallet API v2 supports EVM-compatible chains like Ethereum, Base, and Optimism, as well as the Solana blockchain. This allows developers to build cross-chain applications with a unified interface.

Is the Wallet API free to use?

Yes, during the developer preview phase, usage is free. However, rate limits apply. Always check the latest documentation for updates on pricing and quotas.

How do I secure my API keys?

Never expose your CDP_API_KEY_SECRET or CDP_WALLET_SECRET in client-side code or public repositories. Use environment variables and restrict key permissions in the CDP Portal.

Can I use Wallet API v2 in production?

While currently in developer preview, many teams use it in staging and early production environments. Monitor Coinbase’s official announcements for GA timelines.

What is the difference between CDP API Key and Wallet Secret?

The CDP API Key authenticates general access to Coinbase Developer Platform services. The Wallet Secret specifically enables cryptographic signing operations for wallet actions like transaction signing.

How fast are transactions processed?

Transaction speed depends on network congestion and confirmation settings. On testnets like Base Sepolia or Solana Devnet, confirmations usually take under 30 seconds.


Next Steps

Now that you've mastered the basics, explore deeper:

👉 Accelerate your Web3 development journey — access powerful tools and APIs today.