Skip to main content

Overview

Users can create multiple blockchain accounts of each type within their Embedded Wallet. This enables organizing funds across different purposes, separating assets, and managing complex workflows without requiring separate wallet authentications. Key capabilities:
  • Up to 10 EVM EOA accounts per user
  • Up to 10 Solana accounts per user
  • Up to 10 EVM Smart Accounts per user (each requires a unique EOA owner)
  • Account Metadata: Each account includes creation timestamp and ownership information
  • Flexible creation: Create accounts on-demand based on your application’s needs
When createOnLogin is configured in your provider settings, only one account of the specified type is created automatically. Additional accounts must be created manually using the methods described below.

Prerequisites

  • A CDP Portal account and project
  • Node.js 22+ and a package manager (npm, pnpm, or yarn)
  • @coinbase/cdp-core and @coinbase/cdp-hooks installed
  • User must be authenticated

Account types

EVM EOA Accounts

Externally Owned Accounts (EOAs) are standard Ethereum accounts controlled by private keys. Users can create up to 10 EOA accounts.

Solana Accounts

Native Solana accounts for interacting with the Solana blockchain. Users can create up to 10 Solana accounts.

EVM Smart Accounts

Smart Accounts (ERC-4337) are programmable wallets with advanced features like batch transactions and gas sponsorship. Each Smart Account requires a unique EOA owner, and users can create up to 10 Smart Accounts (one per EOA account).

Creating additional accounts

Using React Hooks

React Hooks provide the most convenient way to create accounts in React applications:
import { useCreateEvmEoaAccount, useCurrentUser } from "@coinbase/cdp-hooks";

function CreateEoaAccount() {
  const { createEvmEoaAccount } = useCreateEvmEoaAccount();
  const { currentUser } = useCurrentUser();

  const handleCreate = async () => {
    try {
      const account = await createEvmEoaAccount();
      console.log("New EOA created:", account.address);
      console.log("Created at:", new Date(account.createdAt).toLocaleDateString());
    } catch (error) {
      console.error("Failed to create account:", error);
    }
  };

  return (
    <div>
      <h3>Your EVM Accounts ({currentUser?.evmAccountObjects?.length || 0}/10)</h3>
      <button onClick={handleCreate}>
        Create New EOA Account
      </button>
    </div>
  );
}

Using Core SDK

For non-React applications, use the core SDK functions:
import { createEvmEoaAccount } from "@coinbase/cdp-core";

// Create a new EOA account
const account = await createEvmEoaAccount();

console.log("Address:", account.address);
console.log("Created:", new Date(account.createdAt).toLocaleDateString());

Accessing account data

All user accounts are available through the currentUser object with metadata including creation timestamps and ownership information.

List all accounts

import { useCurrentUser } from "@coinbase/cdp-hooks";

function AccountList() {
  const { currentUser } = useCurrentUser();

  if (!currentUser) return <div>Please sign in</div>;

  return (
    <div>
      <h2>EVM EOA Accounts</h2>
      {currentUser.evmAccountObjects?.map((account, index) => (
        <div key={account.address}>
          <p>Account {index + 1}: {account.address}</p>
          <p>Created: {new Date(account.createdAt).toLocaleDateString()}</p>
        </div>
      ))}

      <h2>EVM Smart Accounts</h2>
      {currentUser.evmSmartAccountObjects?.map((account, index) => (
        <div key={account.address}>
          <p>Account {index + 1}: {account.address}</p>
          <p>Owners: {account.ownerAddresses.join(", ")}</p>
          <p>Created: {new Date(account.createdAt).toLocaleDateString()}</p>
        </div>
      ))}

      <h2>Solana Accounts</h2>
      {currentUser.solanaAccountObjects?.map((account, index) => (
        <div key={account.address}>
          <p>Account {index + 1}: {account.address}</p>
          <p>Created: {new Date(account.createdAt).toLocaleDateString()}</p>
        </div>
      ))}
    </div>
  );
}

Account object properties

EVM EOA

PropertyTypeDescription
addressstringThe blockchain address of the account
createdAtstringISO 8601 timestamp when the account was created

EVM Smart Account

PropertyTypeDescription
addressstringThe blockchain address of the account
createdAtstringISO 8601 timestamp when the account was created
ownerAddressesstring[]Array of EOA addresses that own this Smart Account

Solana Account

PropertyTypeDescription
addressstringThe blockchain address of the account
createdAtstringISO 8601 timestamp when the account was created

Working with multiple accounts

Selecting accounts for transactions

When sending transactions, specify which account to use:
import { useEvmAddress, useCurrentUser } from "@coinbase/cdp-hooks";
import { SendEvmTransactionButton } from "@coinbase/cdp-react";
import { useMemo, useState } from "react";

function MultiAccountTransaction() {
  const { currentUser } = useCurrentUser();
  const [selectedAccountIndex, setSelectedAccountIndex] = useState(0);

  // Sort accounts by creation date (oldest first)
  const sortedAccounts = useMemo(() => {
    return currentUser?.evmAccountObjects?.slice().sort((a, b) =>
      new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
    ) || [];
  }, [currentUser?.evmAccountObjects]);

  const selectedAccount = sortedAccounts[selectedAccountIndex];

  return (
    <div>
      <h3>Select Account</h3>
      <select
        value={selectedAccountIndex}
        onChange={(e) => setSelectedAccountIndex(Number(e.target.value))}
      >
        {sortedAccounts.map((account, index) => (
          <option key={account.address} value={index}>
            Account {index + 1}: {account.address.slice(0, 6)}...{account.address.slice(-4)}
          </option>
        ))}
      </select>

      {selectedAccount && (
        <SendEvmTransactionButton
          account={selectedAccount.address}
          network="base-sepolia"
          transaction={{
            to: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
            value: 1000000000000000n,
            chainId: 84532,
            type: "eip1559",
          }}
          onSuccess={(hash) => console.log("Transaction sent:", hash)}
          onError={(error) => console.error("Transaction failed:", error)}
        />
      )}
    </div>
  );
}

Use cases

Multiple accounts enable various organizational and functional patterns:
  • Organizing funds by purpose: Separate accounts for personal, business, and savings to keep funds organized
  • Separating assets by network: Different accounts optimized for specific networks or token types
  • Managing different identities: Maintain separate blockchain identities for public and private transactions
  • Separating NFT collections: Organize NFTs across different accounts by collection, purpose, or value
  • Different trading strategies: Separate accounts for different trading approaches or risk profiles
  • Multi-purpose fund management: Organize funds across multiple accounts based on liquidity needs
  • Smart account configurations: Different Smart Account setups for different use cases (e.g., sponsored vs. non-sponsored flows)
  • Managing spending policies: Separate Smart Accounts with different spending permissions and rules
Account limits: Users are limited to 10 accounts of each type (i.e. 30 accounts total). Always check the current count before attempting to create new accounts.
Smart Account owners: Each Smart Account requires a unique EOA owner; you cannot create multiple Smart Accounts with the same EOA. Each of the user’s EOA accounts can own one Smart Account, creating a one-to-one relationship.

Reference

ResourceDescription
useCreateEvmEoaAccountReact hook to create EVM EOA accounts
useCreateEvmSmartAccountReact hook to create EVM Smart Accounts
useCreateSolanaAccountReact hook to create Solana accounts
createEvmEoaAccountCore SDK function to create EVM EOA accounts
createEvmSmartAccountCore SDK function to create EVM Smart Accounts
createSolanaAccountCore SDK function to create Solana accounts
useCurrentUserReact hook to access current user and all accounts
User typeTypeScript type definitions for user accounts