Smart accounts (ERC-4337) are programmable wallets that enable advanced features like batching multiple transactions together and sponsoring gas fees for your users.Key benefits of CDP Smart Accounts include:
Batch transactions
Execute multiple calls in a single user operation
Gas sponsorship
Optional paymasters for gasless UX
Multi-chain support
Deploy on 8 mainnets and 2 testnets across EVM chains
For keeping the same address, EIP-7702 upgrades an existing EOA with the same smart account capabilities without creating a new contract address.
On Base Sepolia, user operations are subsidized and the smart account does not need to be funded with ETH. On Base mainnet, fund the smart account with ETH before submitting.
React
Node (TypeScript)
Python
useSendUserOperation tracks status, data, and error through on-chain confirmation.
For CDP Smart Accounts, pass a paymasterUrl to cover gas fees with any ERC-7677-compatible paymaster, use useCdpPaymaster on Base, or configure a custom paymaster in CDP Portal (see Custom paymaster via CDP Portal below).
React
Node (TypeScript)
Python
React also supports useCdpPaymaster: true to use the CDP Paymaster on Base without providing a URL.
useCdpPaymaster is only supported on Base. You cannot specify both useCdpPaymaster and paymasterUrl.
Configure CDP to route gas sponsorship for CDP Smart Accounts through your own paymaster infrastructure instead of — or in addition to — the CDP-managed paymaster. The paymaster URL is stored in CDP’s backend and never sent to the client.Use a custom paymaster when you:
Run your own paymaster infrastructure (e.g. a proxy in front of Alchemy, Pimlico, or another provider)
Need gas sponsorship on EVM chains where CDP’s native paymaster doesn’t apply (only Base and Base Sepolia are natively supported)
Want custom sponsorship rules — per-user caps, business-logic gates, or allow/deny logic — that go beyond CDP’s built-in contract allowlists
Need the paymaster URL kept strictly server-side and never exposed to the frontend
Custom Paymaster URL — A per-network URL configured in CDP Portal at the project level. When CDP’s backend receives a user operation from a CDP Smart Account that needs sponsorship, it checks whether the project has a custom paymaster configured for that network and routes the request there.Paymaster Context — An arbitrary key-value map (defined by EIP-7677) configured in Portal and forwarded to your paymaster on every sponsored request. The primary use case is authentication: include a static secret in the context, and your paymaster validates it before processing requests, so a leaked URL alone can’t be abused.
User operation (CDP Smart Account) │ ▼CDP backend (cdp-service) │ checks project config for custom paymaster URL on this network │ forwards Portal context as EIP-7677 context ▼Your paymaster │ validates secret from context │ applies your custom sponsorship logic ▼Bundler → chain
Portal config is project-level and stored server-side — your frontend never sees the paymaster URL. When context is configured in Portal, omit paymaster parameters from SDK calls and CDP forwards the Portal context automatically.
In CDP Portal, go to your non-custodial wallet project and open the Paymaster Configuration tab.
2
Add a network
Click Add network and select the EVM network you want to configure. You can add one entry per network.
3
Set your paymaster URL
Enter your paymaster’s HTTPS endpoint. This must be an ERC-7677-compatible paymaster URL.
https://paymaster.example.com/api/v1/sponsor
4
Add context key-value pairs (recommended)
Under Context, add one or more key-value pairs. CDP forwards these to your paymaster on every sponsored request.For the static-secret authentication pattern:
Key
Value
x-cdp-secret
a-long-random-secret-you-generate
Context values are write-only in the Portal UI — once saved, they cannot be read back, only overwritten. Treat them like secrets: store the value somewhere safe before saving.
Your paymaster receives the context as part of the standard EIP-7677 pm_getPaymasterStubData / pm_getPaymasterData request, under the context field. Reject requests that don’t include the expected secret.
TypeScript
Python
paymaster.ts
import { createServer, type IncomingMessage } from "http";const CDP_SECRET = process.env.CDP_PAYMASTER_SECRET; // same value you set in Portalasync function readJson(req: IncomingMessage) { const buffers: Buffer[] = []; for await (const chunk of req) buffers.push(chunk as Buffer); return JSON.parse(Buffer.concat(buffers).toString());}createServer(async (req, res) => { const body = await readJson(req); if (body.method === "pm_getPaymasterStubData" || body.method === "pm_getPaymasterData") { const context = body.params?.[2] ?? {}; // Reject if the secret is missing or wrong if (context["x-cdp-secret"] !== CDP_SECRET) { res.writeHead(401); res.end(JSON.stringify({ error: "Unauthorized" })); return; } // Your sponsorship logic here // ... }}).listen(3000);
paymaster.py
import osfrom flask import Flask, request, jsonifyapp = Flask(__name__)CDP_SECRET = os.environ["CDP_PAYMASTER_SECRET"]@app.post("/")def paymaster(): body = request.get_json() method = body.get("method", "") if method in ("pm_getPaymasterStubData", "pm_getPaymasterData"): context = body.get("params", [None, None, {}])[2] or {} if context.get("x-cdp-secret") != CDP_SECRET: return jsonify({"error": "Unauthorized"}), 401 # Your sponsorship logic here # ...
Once your paymaster URL is configured in Portal, CDP’s backend applies it automatically — you do not pass paymasterUrl in SDK calls. If context (including authentication secrets) is configured in Portal, no paymaster parameters are required in SDK calls.
Custom paymasters are most valuable for chains where CDP doesn’t natively sponsor gas:
Chain
CDP native paymaster
Custom paymaster
Base Mainnet
✅
✅ (overrides CDP’s)
Base Sepolia
✅
✅ (overrides CDP’s)
Arbitrum, Optimism, Polygon, etc.
❌
✅
Any ERC-7677 chain
❌
✅
On Base, a custom paymaster configured in Portal overrides CDP’s built-in paymaster for that project. On other chains, it’s the only path to gas sponsorship through CDP Smart Accounts.See also: Paymaster Proxy · Paymaster Security · EIP-7677
Base Builder Codes attribute onchain activity back to your app for rewards and analytics. Pass dataSuffix on any user operation — no contract changes needed.First, register at base.dev and generate your suffix: