Skip to main content
EVM server accounts are managed by Coinbase’s infrastructure, providing secure key management without requiring you to handle private keys directly. These accounts work with all EVM-compatible chains supported by CDP.

Creating an EVM Account

1

Initialize the CDP Client

First, set up your CDP client with your API credentials:
import { CdpClient } from "@coinbase/cdp-sdk";

const cdp = new CdpClient();
2

Create a new account

Create a new EVM account with an optional name:
const account = await cdp.evm.createAccount({
  name: "MyAccount"
});
console.log(`Created account: ${account.address}`);
3

Create with a policy

You can apply an account-level policy during creation:
const account = await cdp.evm.createAccount({
  name: "RestrictedAccount",
  accountPolicy: "pol_abc123..."
});

Retrieving Accounts

Get or Create Pattern

Use getOrCreateAccount for idempotent account creation:
// Returns existing account or creates new one
const account = await cdp.evm.getOrCreateAccount({ 
  name: "MyAccount" 
});

Get Account by Address or Name

// By address
const account = await cdp.evm.getAccount({ 
  address: "0x1234..." 
});

// By name
const account = await cdp.evm.getAccount({ 
  name: "MyAccount" 
});

List All Accounts

Retrieve all accounts with pagination support:
const response = await cdp.evm.listAccounts({
  pageSize: 50,
  pageToken: "optional-token-for-next-page"
});

console.log(`Found ${response.accounts.length} accounts`);
if (response.nextPageToken) {
  console.log("More pages available");
}

Updating Accounts

You can update an account’s name or apply/remove policies:
const updatedAccount = await cdp.evm.updateAccount({
  address: account.address,
  name: "NewAccountName",
  accountPolicy: "pol_xyz789..." // Optional
});

Importing Accounts

Import an existing private key as a CDP-managed account:
const account = await cdp.evm.importAccount({
  privateKey: "0xabcdef...",
  name: "ImportedAccount"
});
The private key is encrypted using RSA before transmission to CDP servers.

Exporting Accounts

Export the private key of a CDP-managed account:
// Export by address
const privateKey = await cdp.evm.exportAccount({ 
  address: account.address 
});

// Export by name
const privateKey = await cdp.evm.exportAccount({ 
  name: "MyAccount" 
});

console.log(`Private key (without 0x prefix): ${privateKey}`);
Store exported private keys securely. Never commit them to version control or share them.

Account Properties

EVM server accounts expose the following properties:
address
string
The Ethereum address of the account (e.g., 0x1234...)
name
string | null
The optional name assigned to the account
policies
string[] | null
List of policy IDs applied to this account

Common Operations

Once you have an EVM account, you can:
  • Transfer tokens: See Token Transfers
  • Send transactions: See Sending Transactions
  • Swap tokens: See Token Swaps
  • Sign messages: Use account.signMessage() for EIP-191 signatures
  • Sign typed data: Use account.signTypedData() for EIP-712 signatures
  • Check balances: Use account.listTokenBalances(network)

Troubleshooting

Account Not Found

If getAccount() throws an error, the account doesn’t exist. Use getOrCreateAccount() for idempotent operations.

Name Conflicts

Account names must be unique within your project. Use updateAccount() to rename.

Rate Limits

If you hit rate limits, use idempotencyKey parameters to safely retry failed requests:
const account = await cdp.evm.createAccount({
  name: "MyAccount",
  idempotencyKey: "unique-key-123"
});

Next Steps

Build docs developers (and LLMs) love