Transferring Tokens from a CDP Wallet

·

Transferring tokens between blockchain accounts is a foundational operation for developers building decentralized applications. Whether you're moving native assets like ETH or SOL, or standardized tokens such as USDC, understanding how to securely and efficiently execute transfers using the Coinbase Developer Platform (CDP) Wallet API is essential.

This guide walks you through transferring tokens across EVM Accounts, Smart Accounts, and Solana Accounts, with practical code examples in both Python and TypeScript/Node.js. We’ll also cover how to handle ERC-20 and SPL tokens, manage decimals, and verify transaction outcomes—all while maintaining security and scalability.


Understanding Token Transfers

A token transfer involves sending digital assets from one blockchain address to another. These transfers are irreversible and must be signed cryptographically to validate ownership.

The CDP Wallet API supports:

Supported assets include:

👉 Discover how to automate secure token transfers with powerful API tools.


Prerequisites

Before initiating any transfer, ensure your development environment meets the following requirements:

💡 Tip: Always store your API keys securely—never commit them to version control.*

Transferring Tokens via EVM Accounts

Externally Owned Accounts (EOAs) are standard blockchain wallets controlled by private keys. Here's how to send funds between two EOAs.

Step 1: Create Two EOAs

Use the CDP API to generate two new EVM accounts:

from cdp import Cdp

Cdp.configure_from_json("path/to/credentials.json")

account_1 = Cdp.client.networks.evm.create_account()
account_2 = Cdp.client.networks.evm.create_account()

Step 2: Transfer ETH Between Accounts

Initiate a native ETH transfer using the transfer method:

transfer = account_1.transfers.create(
    destination=account_2.address,
    amount="0.00001",
    asset_id="eth"
)

Step 3: Wait for Confirmation

Poll the transfer status until confirmed on-chain:

transfer.wait()
print(f"Transfer status: {transfer.status}")
print(f"Explorer link: {transfer.transaction_link}")

Once complete, you can verify the transaction on a block explorer like Etherscan or Basescan.


Executing Transfers from Smart Accounts

Smart Accounts offer advanced functionality such as batched transactions and multi-signature support.

Step 1: Create a Smart Account

First, create an owner EOA to control the Smart Account:

owner = Cdp.client.networks.evm.create_account()
smart_account = owner.smart_accounts.create()

Step 2: Set Up a Receiver Account

Create a destination address:

receiver = Cdp.client.networks.evm.create_account()

Step 3: Send ETH from Smart Account

Initiate the transfer:

transfer = smart_account.transfers.create(
    destination=receiver.address,
    amount="0.00001",
    asset_id="eth"
)

Step 4: Confirm the Transaction

Wait for finality:

transfer.wait()
print(f"Transfer status: {transfer.status}")

Smart Account transfers may take slightly longer due to additional validation logic but provide greater flexibility.

👉 Learn how to streamline multi-chain transfers with integrated developer tools.


Transferring SOL on Solana

Solana enables fast, low-cost transactions. The process is similar but uses Solana-specific tooling.

Step 1: Generate Two Solana Accounts

sol_account_1 = Cdp.client.networks.solana.create_account()
sol_account_2 = Cdp.client.networks.solana.create_account()

Step 2: Transfer Native SOL

Use the transfer method with sol as the asset:

sol_transfer = sol_account_1.transfers.create(
    destination=sol_account_2.address,
    amount="0.0001",
    asset_id="sol"
)

Step 3: Await Confirmation

sol_transfer.wait()
print(f"Transaction confirmed! Link: {sol_transfer.transaction_link}")

All Solana transactions are processed within seconds under normal network conditions.


Complete Working Example

Below is a full script that demonstrates:

  1. Creating EOA and Smart Accounts
  2. Transferring ETH between them
  3. Creating Solana Accounts
  4. Sending SOL
  5. Confirming all transactions

After execution, output will resemble:

=== EOA Example ===
Transferring 0.00001 ETH from 0x689c59617D8Ec93a114E2304cC038bB8678775C7 to 0xe4026d8D0fA814379042f1E245096F0551931d14...
Transfer status: success
Explorer link: https://sepolia.basescan.org/tx/0xdaa53830fb62f407dfe65c6e10bac6c9af1fb2014551d107f7d9de2055914985

=== Smart Account Example ===
Transferring 0.00001 ETH from 0xC3c2D7879B31Aca4e26D16AD57D07422E4a23A67 to 0xe4026d8D0fA814379042f1E245096F0551931d14...
Transfer status: complete
Explorer link: https://sepolia.basescan.org/tx/0x045e29f40897dc01b50a6ba0d7c3d0a424fbca69792869f56e1321f1a899419f

=== Solana Account Example ===
Transferring 0.0001 SOL from DYjMQTJCcqmtdMvagJvW17U7teg8caUQ92nSrcXdqSZG to 32gPVc5gDvn2T5EgV81NFavDMpf5HU4oLUbmuipKpV8C...
Transaction confirmed! Link: https://explorer.solana.com/tx/4KEPbhkRLTg2FJNqV5bbUd6zv1TNkksxF9PDHw2FodrTha3jq2Cojn4hSKtjPWdrZiRDuYp7okRuc1oYvh3JkLuE?cluster=devnet

This end-to-end flow validates your integration and ensures cross-chain interoperability.


Transferring ERC-20 and SPL Tokens

Beyond native coins, you can transfer fungible tokens like USDC with minimal changes.

Sending USDC (ERC-20)

Set token to "usdc" in the transfer call:

transfer = account_1.transfers.create(
    destination=account_2.address,
    amount="10000",  # 0.01 USDC (6 decimals)
    asset_id="usdc"
)

To simplify handling decimal places, use utility functions:

This avoids manual calculation errors.

Using Custom Token Contracts

For non-standard tokens, pass the contract address directly:

transfer = account_1.transfers.create(
    destination=account_2.address,
    amount=Cdp.parse_units("5", "custom"),
    asset_id="0xYourTokenContractAddress"
)

Same applies to SPL tokens on Solana—just use the mint address.

👉 Explore seamless multi-token transfer solutions for developers.


Frequently Asked Questions

Can I transfer tokens between different blockchains?

No—this guide covers transfers within a single blockchain. Cross-chain transfers require bridges or LayerZero-like protocols.

How do I check if a transfer succeeded?

Use .wait() to block until confirmation, then check .status. A value of "confirmed" means success.

Why is my USDC amount showing as 10000 instead of 0.01?

USDC uses 6 decimal places. So, 1 USDC = 1,000,000 units. Therefore, 0.01 USDC = 10,000 units.

Are Smart Account transfers more expensive?

They may incur slightly higher gas fees due to contract execution, but they offer better security and programmability.

What happens if a transaction fails?

The transfer object will reflect "failed" status. Common causes include insufficient balance or network congestion.

Is it safe to reuse account addresses?

Yes—once created, accounts persist unless deleted. Reusing addresses is standard practice and secure.


Next Steps

Now that you understand token transfers, consider exploring:

With robust tooling and clear workflows, the CDP Wallet API empowers developers to build scalable, secure blockchain applications across multiple ecosystems.

Core Keywords: token transfer, EVM account, Smart Account, Solana account, ERC-20 transfer, SPL token, CDP Wallet API