Overview

Accounts refer to an address on a blockchain that has the ability to sign transactions on behalf of the address, allowing you to not only send and receive funds, but also interact with smart contracts. Cryptographically, an account corresponds to a private/public key pair.

Accounts are a term consistent across the crypto ecosystem: Ethereum, Solana, and viem use this term to refer to the same concept.

The v2 Wallet APIs support the following account types:

  • EVM Compatible Accounts:
    • EOAs: Externally Owned Accounts on any EVM-compatible blockchain that have the ability to sign transactions on behalf of an account’s address (i.e., when using a Smart Account).
    • Smart Account: A smart contract-based account that can provide advanced functionality such as gas sponsorships and spend permissions.
  • Solana Accounts: An account on the Solana blockchain.

More code samples are available in our Typescript and Python SDK repositories.

EVM compatible networks

The v2 Wallet API supports both EOAs and Smart Accounts on EVM-compatible networks.

Externally Owned Accounts (EOAs)

Refer to the quickstart for an example of creating an EOA and sending a transaction with it.

Smart Accounts

Smart Accounts are currently only available on the Base Sepolia and Base Mainnet networks.

A Smart Account operates through a deployed smart contract (programmable code stored directly on the blockchain).

A Smart Account requires an owner account to sign on its behalf. The owner can be a CDP Account or an account secured by the developer using a library such as viem.

Smart accounts submit user operations to the blockchain using EIP-4337 Account Abstraction.

After configuring your environment variables, you can use the following code snippet to:

  1. Create an EOA
  2. Create a smart account with the EOA as owner
  3. Submit a user operation from the smart account to the EOA
import { CdpClient } from "@coinbase/cdp-sdk";
import { parseEther } from "viem";

const cdp = new CdpClient();

const evmAccount = await cdp.evm.createAccount();
const smartAccount = await cdp.evm.createSmartAccount({
  owner: evmAccount,
});
console.log(`Created smart account: ${smartAccount.address}`);

const sendResult = await cdp.evm.sendUserOperation({
  smartAccount,
  network: "base-sepolia",
  calls: [
    {
      to: evmAccount.address,
      value: parseEther("0"),
      data: "0x",
    },
  ],
});

console.log("User operation sent with operation hash:", sendResult.userOpHash);
console.log("Waiting for user operation to be confirmed...");

const waitResult = await cdp.evm.waitForUserOperation({
  smartAccountAddress: smartAccount.address,
  userOpHash: sendResult.userOpHash,
});

console.log("User operation confirmed with status:", waitResult.status);

const userOp = await cdp.evm.getUserOperation({
  smartAccount,
  userOpHash: sendResult.userOpHash,
});

console.log("Transaction hash:", userOp.transactionHash);

Smart accounts are created with the CREATE2 opcode. This means that the address of the smart account is deterministic and can be computed from the owner address and the smart account’s nonce. The actual smart contract is not deployed until the first user operation is submitted. Read more here.

Solana

Solana accounts correspond to Accounts on the Solana network.

Refer to the quickstart for an example of creating a Solana account and sending a transaction with it.

  • v2 Security: Learn about the security features of v2 Wallet API.
  • API Reference: Explore the complete API reference for v2 Wallet API.