Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

Overview of Coinbase CDP

Consider a user who signs in with an email address and pays a 1 USDC service fee in an application. The application verifies that funds have arrived in the user's account and enables the service only after the payment succeeds. Issuing an address is just one step. A complete payment also requires linking the authenticated user to an account, preparing funds, signing and submitting the transaction, and recording its outcome against the order.

Coinbase Developer Platform, or CDP, is a development platform that brings these capabilities together through APIs and SDKs. Alongside Wallets, which creates accounts that hold funds, developers can integrate fiat onramps, asset swaps, gas sponsorship, and notifications about execution results. For example, an application that uses Base for USDC transfers prepares an account, funds it with USDC, and executes the payment approved by the user. The result then updates the application's order record and interface.

Throughout this process, the application keeps track of which user and order the payment belongs to. It associates the user ID with the paying address and records the payment conditions and outcome against the order.

Recorded value Relationship to the order
Network Which chain the payment uses
Amount How much is paid
Execution result Whether the payment succeeded

Addresses and transaction hashes returned by CDP provide the information needed to link execution to these records.

How the user experience connects to CDP components

The same combination of capabilities can distribute a service's own operating funds. However, the party authorizing signatures differs when a user spends their own money and when a backend pays rewards from a company account. These arrangements are also distinct from connecting an existing Coinbase exchange account or Coinbase Wallet. Choose the architecture based on whose funds are being moved and who has authority to move them.

The original figures are retained and contain Japanese labels.

Wallet Architecture

When users spend their own funds, the application associates each authenticated user with an account they can authorize signatures for. When a company spends its operating funds, the service backend acts under the company's authority. With CDP's non-custodial wallets, the authentication model governing that authority and the type of onchain account are separate choices.

In the user-controlled model, users can authenticate by email, SMS, social login, or a JWT issued by the application's existing authentication system. A JWT is a signed token that conveys information about an authenticated user.

If configured to create an account at login, the system associates the account with the authenticated user. For example, for an account in the Ethereum-compatible execution environment known as the EVM, the returned address can be used as the user's deposit address and to display their balance.

This association allows users to get started inside the application without installing a browser-extension wallet. However, the browser login session and the onchain account serve different purposes. The application selects the corresponding address from the authenticated user's information and ensures that another user's account is never used as the payment source.

For a company operating account, the backend uses the developer project's credentials. For example, it calls cdp.evm.createAccount(), records the returned address as the sending account, and specifies that address when submitting transactions. Using getOrCreateAccount to retrieve or create a named account avoids creating another account for the same purpose every time the service starts. The application decides how to associate account names with its company or user records.

The terms Embedded Wallets and Server Wallets in older documentation help distinguish user-login workflows from backend-controlled workflows. When selecting a product, check whether it uses user authentication or API key authentication rather than relying on the product name alone.

Even for a user-owned account, Delegated Signing allows the user to authorize the backend to sign for a specified period. For example, if a particular account is delegated for 24 hours, the backend can request operations on that account using a valid delegation and CDP credentials even after the user closes the interface. Delegation can cover all of a user's accounts or a specific account, and it can be revoked before expiry.

Parties controlling funds and their authentication paths

The delegation interface shows the user which funds can be moved and until when. The application then checks the order and budget before submitting the corresponding signing request for policy evaluation. A time-limited delegation alone does not restrict spending purposes or total expenditure to what the application intends.

A separate product, Custodial Wallets Beta, holds funds in a custodial account on the Coinbase side. Both its user-authenticated and API-key-authenticated variants should be distinguished from the non-custodial models discussed above. Identifying who owns the funds being controlled is the starting point for choosing between user-facing wallets and business treasury management.

Account Types

Signing in by email does not determine the type of onchain account. A conventional EVM account controlled by a single private key is an EOA. It can be used through either user login or the service's API key. The address CDP returns identifies where to deliver assets or which account to operate on.

A contract-based account that verifies its owner's authorization before executing operations is a Smart Account. CDP associates an EOA with the smart account as its owner and authorizes contract operations through the owner's signature. The owner EOA and Smart Account have different addresses. To pay 1 USDC from a Smart Account, fund the Smart Account address itself.

Authentication and account type as separate dimensions

This choice also changes how payments are executed and how gas fees are covered. An EOA submits a conventional transaction directly; a Smart Account instead receives a request specifying what the contract should execute. The same email-login experience can therefore support different designs for batching operations and sponsoring gas fees.

Solana accounts use Solana-specific signatures and transaction formats. The networks for which EVM signing is available are not necessarily the same as those supported by CDP's submission APIs, swaps, or gas sponsorship. For example, CDP's Paymaster supports Base. Creating an account for another EVM chain does not by itself establish that the same sponsorship is available there.

Keys and Request Authentication

When a backend requests operations on a company account, it authenticates both the developer project and sensitive wallet operations. A Secret API Key establishes that the API call is made under the project's authority. The SDK creates a JWT from the API Key ID and API Key Secret and places it in the request's Authorization header.

Sensitive operations, including signing, additionally require an authentication token derived from a Wallet Secret. The Wallet Secret is a key managed by the developer to authorize wallet operations. It is distinct from the account's private key controlling ETH or USDC, allowing the application to request signatures over specified content without receiving the asset key.

For example, in a request to send 0.001 ETH to a specified recipient, the wallet authentication token is bound to the destination URI and request body. The body is represented by a hash of its canonicalized contents, and the receiving system verifies that the request was signed with the correct Wallet Secret. If the recipient or amount is modified in transit, the original token cannot validate the altered request as the same authorization.

Asset keys are generated, encrypted, decrypted, and used to sign transactions in a TEE, a computing environment isolated from the host. CDP uses AWS Nitro Enclaves and forwards requests to that environment through a dedicated communication channel. The TEE verifies wallet authentication and the request contents, then returns the results of operations that satisfy the conditions to the API.

API authentication and sensitive signing requests

In the user-authentication model, a device-specific Temporary Wallet Secret is used for request authentication. The backend's developer secret is not distributed directly to users for login and signing. The request-authorizing key remains separate from the key that signs for assets, and requests are constructed according to the authentication model.

The application can avoid much of the work of implementing asset-key storage and encryption, but a service possessing the API key and Wallet Secret can request operations within its authority. The application must therefore check orders and user authorization before constructing a signing request. Key export also has distinct permissions: API-key-managed account keys can be retrieved by a backend with Export permission, which is separate from the path for exporting a user's asset key and does not mean the backend SDK can extract it.

Policy Evaluation Order

Even a correctly authenticated service can submit the wrong recipient or amount. CDP wallet policies evaluate request contents against conditions before signing. In addition to the application's order checks, these policies constrain what authenticated requests can do.

Policies can be scoped to project, covering the project's accounts, or account, covering an individual API-key-managed account. Rules specify an operation, such as signEvmTransaction for transaction signing, and whether to allow or deny matching requests. Operations authenticated by the user use project policies; the examples below, which also evaluate individual account policies, concern API-key-authenticated operations.

Consider a signing request to send 0.01 ETH to recipient A. If a project rule allows transfers to A of no more than 0.02 ETH, the request matches both the recipient and amount conditions and is allowed. Transfers to B or transfers of 0.03 ETH do not match this allow rule.

If the same policy also contains a rule denying transfers to A, both the allow and deny rules match the 0.01 ETH request. The deny rule takes precedence.

However, deny precedence within a policy is distinct from the evaluation order between project and individual account policies. With API key authentication, when the project policy already determines that a request is allowed, an individual account rule does not override that decision. Keeping the previous project allow rule and adding an account rule denying recipient A does not block requests that the project has already allowed. To make an account-level restriction effective, arrange rules with an understanding of which requests are resolved at the higher level.

The account policy is evaluated when the project policy does not determine the outcome. If either scope contains rules for the target operation but no rule matches at either scope, the request is denied. Conversely, if neither scope has any rules for that operation, the default behavior is to allow it.

Evaluation order for project and account policies

For example, attaching a recipient condition to transaction signing does not automatically apply the same condition to message signing. For each operation the application actually uses, determine which inputs are evaluated against which conditions. Also distinguish requests that only ask for a signature from requests that ask for submission, since they may target different operations.

The value compared in this example is an amount of native ETH. To restrict USDC amounts, use the contents of the token contract call and the conditions applicable to that operation. Conditions for a single request also differ from cumulative daily spending. To determine how many 1 USDC payments are permitted, combine verified product limits with the application's budget records.

Transaction Execution

Once the account, authentication method, and authorization conditions have been selected, the application can request operations on assets. It requests signing and network submission, checks the execution result, and updates the order. Choosing a Smart Account changes the format of the execution request.

For example, to send 0.001 ETH from a company account on Base Sepolia, use the address obtained through createAccount as the sender. The main values passed to sendTransaction have the following roles.

Value What it determines in the request
network Submission to Base Sepolia
to The address receiving ETH
value The amount of native ETH to transfer

On networks supported by CDP's submission API, CDP can also estimate gas fees and manage the account's nonce, which distinguishes the order of its transactions. It signs content that passes authentication and policy checks and submits it to the network, so the application does not have to retrieve the asset key to implement submission itself. On networks not supported by the submission API, combine signature-only functionality with submission through an RPC interface to a node.

The transactionHash returned by submission identifies the transaction for subsequent lookups. The application associates submission information with its order record and retrieves the receipt containing the execution result.

Value associated with the order What it identifies
Sender The account used for payment
Network The chain on which the transfer was submitted
Hash The transaction whose receipt is queried

Separating signature generation, submission acceptance, and successful onchain execution prevents pending or failed submissions from being mistaken for completed payments.

Signing requests and post-submission verification

The same relationship between execution results and order records applies when a user pays 1 USDC. However, rather than setting the value of an ETH transfer to 1, the application calls the USDC contract's transfer function. With USDC's 6 decimal places, 1 USDC is 1000000 in base units.

The application encodes this amount and the recipient in the calldata and sets the transaction destination to the USDC contract. When using a user-authenticated SDK or Smart Account, it still verifies that the signature covers these payment details. If the receipt indicates failure or execution remains pending, the order must not be marked as purchased; the interface displays the actual execution status.

If the connection drops before a response arrives, the execution result is unknown. Assuming submission itself failed and initiating a new payment can lead to double payment if the original request was executed. Use available hashes or submission request identifiers to establish the outcome of the same order before resuming.

Smart Accounts and Gas Fees

Even if the user's account holds USDC, an EOA needs ETH to cover gas when sending it. Instead of requiring users to deposit ETH as well for a 1 USDC service fee, the application can cover the gas cost. This arrangement uses a Smart Account and a Paymaster, which evaluates sponsorship conditions.

A Smart Account operates with authorization from its owner EOA. Obtaining the address when creating the account and deploying the contract during its first execution are distinct steps; deployment occurs with the first UserOperation. A UserOperation specifies what the Smart Account should execute, and the application places the desired calls in the calls array.

A transfer of 1 USDC contains one call with the following values.

Field Contents for a 1 USDC transfer
to USDC contract address
value 0, the amount of native ETH transferred
data Calldata for transfer with the recipient and amount 1000000

Here, the Smart Account holds and transfers the USDC. The owner EOA authorizes that operation by signing. Confusing the deposit address with the signing address would place funds in the wrong account. Multiple entries in calls can be executed together in order; CDP's batched execution reverts the entire batch if any call fails.

A Bundler groups and submits these requests to the chain. CDP provides endpoints for using a Bundler and Paymaster. The Paymaster determines whether to cover gas based on eligible contracts, per-user limits, and the developer's budget. The owner's signature authorizing the 1 USDC transfer and the developer's decision to pay execution costs are separate decisions about the same request.

Separation of owner signatures and gas sponsorship

For example, if the initial USDC operation is eligible for sponsorship, the user pays with their own USDC while the application covers gas. The purchase price and execution cost are separate, so sponsoring gas does not mean the application also pays the 1 USDC price. If sponsorship is denied, the application decides whether to stop the operation or switch to a path where the user covers gas, and communicates the result.

CDP's Paymaster supports Base Mainnet and Base Sepolia. To sponsor gas on other EVM chains that support Smart Accounts, check the conditions of a compatible external Paymaster. Account-type support and the coverage of CDP's sponsorship product are separate here as well.

The userOpHash returned on submission identifies a UserOperation and is distinct from a conventional transaction hash. Use CDP's waiting functionality to confirm completion and associate the operation with its onchain transactionHash. The application tracks the order's execution result through this association and does not display a successful payment based solely on UserOperation acceptance.

Retrying When the Response Is Unknown

To resume safely when submission status is unclear, the application creates a key identifying the request before sending it. Saving this key and the request contents in the order's processing record preserves the identity of the request whose result must be checked, even if only the response is lost. Creating a new transfer for the same order each time would break this association.

For APIs that support idempotency, supply a UUID v4 key in X-Idempotency-Key. Resubmitting the same key and input returns the original response within the 24-hour retention window. CDP can distinguish a retry from a new operation, so there is no need to create another transfer simply to obtain a response.

Retrieving the existing result with the same key

Changing the request body while keeping the same key produces an input conflict error. The original request may still be processing, so that response alone should not trigger a new payment. For example, before changing an order amount, establish whether the operation for the original amount executed rather than modifying a request whose result is unknown.

This guarantee applies only within the retention period and to supported APIs. Do not assume the same guarantee for retries after 24 hours or unsupported operations; track payments in the application itself. Record the corresponding execution identifier with the order and verify the onchain result. These records connect API-level duplicate prevention to the business decision not to charge an order twice.

Funding, Withdrawals, and Payments

Creating an account does not automatically fund it with USDC for payments. Users purchasing with fiat currency can use Onramp; those converting existing crypto assets can use a swap. The path for converting assets back into fiat and withdrawing them after payment is Offramp. Each route starts with and delivers different assets.

For example, when a user wants to fund an account on Base with USDC, the backend creates an Onramp session. The session specifies the deposit destination and asset to purchase.

Specified value Input in this example
Recipient The user's own account address
Asset USDC
Network Base

In addition to the purchase amount and payment currency, provide the payment method and location as appropriate for the selected integration.

Opening the returned session.onrampUrl in the frontend takes the user to Coinbase's purchase flow. This is a single-use URL, and the available assets and payment methods vary by location and integration.

Creating a session merely makes it possible to begin purchasing. Receiving the URL does not increase the user's USDC balance in the application. Reflect the deposit only once the actual delivery of assets has been verified.

Conversely, to withdraw unused USDC, create an Offramp session. After the user confirms the conversion, the application integrates an onchain transfer to a Coinbase-controlled address. Transferring the assets and receiving fiat are distinct stages, so check both the transaction hash and the Offramp status.

Different routes for deposits, withdrawals, and swaps

If the user already holds another token on Base, a swap can provide the necessary USDC. CDP Swaps connects quotes from the Trade API to signing and execution through Wallets. When specifying the amount to exchange, define what will be exchanged, which account will perform the swap, and how much price movement is acceptable.

Specified value What it determines
Input and output tokens Which assets are exchanged
Network The chain on which the swap executes
Account holding the assets Which account performs the swap
Price movement tolerance How much price movement is acceptable

Specify the quantity in the input token's base units. If a Smart Account holds the funds, the executor specified in the quote is the Smart Account, not its owner EOA. That account's balance and token spending authorization, or allowance, determine whether the swap can execute.

After receiving a quote, the application checks the estimated output, liquidity availability, and any balance or allowance shortfalls. A slippage tolerance of 100 bps equals 1%, and the minimum output becomes an execution condition accepted by the user. If allowance is insufficient, arrange the necessary token approval before proceeding with the swap.

A price quote is a non-binding estimate, not a completed swap. When the user accepts the conditions and executes, the account signs and submits the operation. For an EOA, the result is associated with a transaction receipt; for a Smart Account, it is associated with the UserOperation outcome. The application verifies execution and the updated received assets, then reflects them in the balance available for the 1 USDC payment.

CDP Swaps supports the mainnets of Base, Ethereum, Arbitrum, Optimism, and Polygon. Do not assume the same swap can be executed on a testnet. When choosing how to prepare funds, separately check Onramp location and payment-method requirements and swap network and balance requirements.

There is also a suite of Payments products for businesses receiving, holding, and disbursing funds through custodial accounts. A setup that pays out funds received in a business account as fiat differs in fund ownership from one delivering USDC to a user's non-custodial wallet. Even when choosing a funding method for the user's 1 USDC payment, creating a wallet alone does not establish eligibility for business payment products.

Paying for APIs

Once USDC is available, services can be purchased without a payment button in the user interface. For example, a report-generation application might request an external analytics API and pay a USDC fee for one call. x402 enables this exchange: an HTTP response specifies the fee, and the client retries the request with payment information attached.

The analytics API seller returns a payment requirement and the conditions it accepts.

Returned condition What the buyer checks
Price How much the service costs
Recipient Who receives the payment
Network Which chain to pay on
Asset Which asset to pay with

For example, when offered a price of 0.01 USDC on Base, the buyer's application checks the price and recipient against its purchasing policy. If the conditions are acceptable, the wallet signs payment information for the selected method, and the application attaches it to another request to the same API.

The seller verifies that payment information against the advertised conditions. A service that handles verification and settlement on the seller's behalf is called a Facilitator, and CDP provides such an integration for sellers. The buyer's Wallets signing role and the seller's request to a Facilitator for verification and settlement are separate operations within the same payment.

Responsibilities of the wallet and facilitator

Successful verification of a payment signature and settlement of the asset transfer are also distinct results. The seller associates the analytics result being provided with the required settlement result and returns the resource to the buyer. This enables payment per HTTP request alongside conventional API-key subscriptions billed at the end of the month.

x402 also supports signers and recipient wallets other than CDP. Furthermore, signing payment information and submitting a conventional transaction do not necessarily use the same request format or policy operation. The application selects a compatible signing method and checks both the individual price and the overall task budget before purchasing.

The payment mechanism and its integration with Circle Gateway are also discussed in Micropayments for AI Agents with x402 and Circle Gateway. When choosing CDP, identify the products required by separately considering the buyer's account and where the seller requests verification and settlement.

Application Integration

When funding or submission completes after the user closes the interface, the response to the initial operation alone cannot update application records. Webhooks, which deliver HTTP notifications from CDP to an application endpoint, let the application process results without waiting for the page to reload. The application registers the event types and receiving URL and associates incoming notifications with order, deposit, or withdrawal records.

Wallet-operation notifications cover changes from creation through signing, broadcasting, and confirmation, as well as failures. For example, for wallet.transaction.confirmed, compare the transaction_hash with a stored submission record. Use the sender's address and network to identify the relevant account. For delegated operations, user_id and delegation_id can also be associated with the user and delegation records.

To track incoming USDC deposits from external sources, distinguish wallet-operation notifications from Onchain Activity notifications. Onchain Activity monitoring can be narrowed using the following parameters.

Specified value What it filters
Network Chain to monitor
Target contract Contract of the monitored asset
Event name Type of operation to monitor

When monitoring USDC Transfer events on Base, compare the reported recipient and amount against the user's account to identify the deposit.

Linking execution requests and result notifications to application records

Verify the authenticity of incoming HTTP requests using the secret established when creating the subscription and the X-Webhook-Signature header. Verification uses the signed timestamp and raw body as received, not a reformatted body produced after parsing JSON. If the event identifier in the headers is used in business decisions, also verify the signing scheme that covers that identifier before passing it to business logic.

Notifications use at-least-once delivery, so a normal retry can deliver the same event again. When granting service access against an order, associate processed identifiers with order state updates so retries cannot grant access twice. When distinguishing Onchain Activity events, use the log position as well; multiple events in the same transaction must not be collapsed into one simply because their transaction hashes match.

This process allows asset changes to update application orders. However, record the received event type separately from the finality conditions required to deliver the product, and do not treat pending or failed operations as successful payments. Supported notifications also vary by account type and network. Solana does not necessarily expose the same pending or replaced statuses as the EVM.

Connecting Agents

Purchases previously initiated by a user's click can also begin when an agent selects an operation. For example, an agent asked to generate a report might check its balance, swap into the necessary asset, and pay for an analytics API. Execution of the chosen operation connects to the wallet, swap, and payment components described above.

AgentKit exposes these operations as tools callable from an agent framework. An Action Provider exposes operations such as transfers and balance checks as tools, while a Wallet Provider standardizes the signing and submission calls used by those operations. For a transfer action using CDP's Wallet Provider, application code receives the inputs selected by the LLM, authenticates with CDP, and requests the operation on the target account.

AgentKit itself does not enforce purchase limits, human approval, or recipient allowlists. Its official README also describes these limitations and the risk that external text can influence operation selection.

To delegate only analytics API purchases, validate recipients and amounts through the tool configuration and implementation, then apply the corresponding wallet policies and application budget checks. Exposing an operation as a tool and implementing the conditions that authorize it are separate tasks.

Separation of decisions, operation validation, and signing

For example, receiving a 0.01 USDC price from an external API does not authorize a purchase merely because the LLM found that price. Application code checks the remaining budget and whether the recipient is allowed, proceeds to signing when the conditions are met, and returns a result blocking further purchases otherwise. Keep developer secrets out of the LLM's context and tool responses, and avoid giving the agent credentials for managing policies.

For service operating funds, use an API-key-managed account; for user funds, choose user authentication or time-limited delegation. AgentKit also integrates with other Wallet Providers, so the signing infrastructure and supported capabilities depend on that choice. Whether using LangChain, Vercel AI SDK, MCP, or OpenAI Agents SDK, the application retains responsibility for approvals, records, and retries.

For a fixed daily reward payment, ordinary application code can evaluate the conditions and call the CDP SDK. Adding AgentKit's tool integration becomes useful when the system should choose recipients or operations based on context. Even after integrating AgentKit, the selected wallet and payment products remain responsible for moving funds.

Integration and Operational Requirements

Begin with a combination of capabilities that supports the complete experience of a user signing in, paying 1 USDC, and seeing a completion message. Choose between a user-authentication SDK for login and the payment interface and backend integration through the CDP SDK's CdpClient or REST API according to who controls the funds. The TypeScript and Python SDKs handle authentication tokens and request formats, allowing applications to call account creation and submission from their own business logic.

For submission testing, use a Base Sepolia account and test assets. Verify how denied requests, returned hashes, execution results, and notification retries are reflected in the application's order state. Separately investigate eligibility for mainnet-only Swaps and location-dependent Onramp rather than treating testnet verification as sufficient.

To investigate policy evaluation without signing, pass the operation, account, and inputs to simulation. It returns an allow or deny decision and its reason, allowing you to identify which condition blocks a request with a different recipient, for example. Simulation does not sign, submit, or persist operations, nor does it automatically populate gas or nonce, so include the values you intend to evaluate.

The result applies to the policies and inputs at that point in time. It does not reserve an authorization guaranteeing the same outcome for a future real request. Execution is still subject to authentication and the policies in effect at that time.

Using pause on an operational policy temporarily removes its conditions from evaluation, and resume reactivates those conditions. This removes a restriction rather than freezing signing. If there are no other active rules for the operation, the default allow behavior applies. Operators with Manage permission who satisfy the project's eligibility requirements decide which restrictions to remove and for how long.

Two dimensions of integration decisions

To stop abnormal payments, stop accepting new requests or executing operations in the application. Prepare recovery procedures that account for credentials and active restrictions, and do not mistake pause for an emergency stop. If the Wallet Secret is lost, the developer portal provides a procedure for deleting the old secret and creating a new one.

Rotating request-authentication credentials and regenerating the account's asset key are distinct operations. Keep secrets out of source code and logs, and associate the services authorized to request operations and the operators managing them with the order processing records. API responses alone do not record the business decision behind a movement of funds.

Add sponsorship when obtaining gas prevents users from getting started, or connect Onramp when they want to deposit fiat. Similarly, add notifications when processing continues outside the interface. Expand from the capabilities needed for a single complete experience. Check fees, rate limits, locations, and supported networks against the particular product and agreement, rather than treating them as uniform performance or cumulative budget guarantees across all APIs.

Conclusion

CDP lets applications assemble a payment by creating an account for an authenticated user, preparing USDC, and returning signing and execution results to the application. Gas sponsorship, asset swaps, API payments, and agent-selected operations can be integrated according to where they fit into that payment. The application determines who moves funds and makes order and budget decisions, while associating the accounts and execution results returned by CDP with its own processing records.

The official Coinbase Developer Platform documentation describes the available wallet, payment, and notification products and their requirements.

The official AgentKit repository documents its integrations, implementation, and usage limitations.