Overview
Delegated signing lets your backend sign transactions on behalf of end users without requiring them to be online or have an active session. The end user grants a time-bound delegation from your frontend, and your server can then take actions on their account using only your CDP API key and Wallet Secret. This is useful for:- Automated transactions — Execute transactions triggered by webhooks or onchain events when the user is offline
- Agentic wallets — Allow a backend service or agent to operate a user’s wallet with scoped permissions
- Background operations — Process user-initiated flows that complete asynchronously after the user has left your app
How it works
Two parties are involved:- End user — Authenticates on your frontend and grants a time-bound delegation to your app
- Developer — Uses their CDP API key, CDP Wallet Secret, and the active delegation to sign transactions from the backend with no user interaction required
Delegation scopes
There are two available delegation scopes:
User-scoped and account-scoped delegations are mutually exclusive per user. To switch scopes, revoke all existing delegations first.
The flow:
- Grant — The authenticated end user calls
createDelegationon the frontend, specifying an expiry time - Sign — Your backend uses the CDP SDK with your API key to perform actions on behalf of the user
- Revoke — The delegation can be revoked before expiry by the end user or the developer
Available delegated signing methods
With an active delegation, your backend can call the following methods viacdp.endUser.* on behalf of an end user:
EVM: Sign
EVM: Send
Solana: Sign
Solana: Send
Prerequisites
- In the CDP Portal, go to Wallets → Non-custodial Wallet → Security and enable the Delegated Signing toggle.
- Install the required packages:
@coinbase/cdp-hooks):
cdp-sdk):
- TypeScript
- Python
.env file:
.env
TypeScript only: Set
moduleResolution: "node16" or "nodenext" in your tsconfig.json to avoid compilation errors with the CDP SDK.Step 1: End user creates a delegation (React)
The authenticated end user grants your app a time-bound delegation. This is the only step that requires the user to be present.User-scoped
A user-scoped delegation covers all of a user’s accounts.Only one active user-scoped delegation is allowed per user at a time. If a delegation already exists, revoke it or let it expire before creating a new one.
React
Account-scoped
An account-scoped delegation covers one specific account. This lets you revoke access for a single account without affecting other delegations you hold for the same user.One active account-scoped delegation is allowed per account at a time. If a delegation already exists for that account, revoke it or let it expire before creating a new one.
React
Step 2: Developer signs on behalf of the end user
Once a delegation is active, your backend can submit transactions for the end user using your CDP API key and Wallet Secret — no user session needed. The signing API is the same regardless of delegation scope.Step 3: Revoke a delegation
A delegation can be revoked before it expires — either by the end user from the frontend, or by the developer from the backend.User-scoped
Revoking a user-scoped delegation removes access across all of the user’s accounts. End user revokes (React)React
Account-scoped
Revoking an account-scoped delegation removes access for one account and leaves all other account delegations for that user intact. End user revokes (React)React