Overview
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
Embedded Wallets do not support the Policy Engine. Embedded Wallets can use Paymaster allowlists today; Smart Account spend permissions are coming soon.
Prerequisites
- A CDP Portal account and project
- Node.js 22+ and a package manager (npm, pnpm, or yarn)
- Basic familiarity with React and TypeScript
- A CDP project with Embedded Wallets enabled
- Your app domain allowlisted
@coinbase/cdp-coreand@coinbase/cdp-hooksinstalled
Enable smart accounts
Configure theCDPHooksProvider to create a smart account for new users on sign in.
- When
ethereum.createOnLoginis set to"smart", new users receive both an EOA and a smart account.
basePath(API base URL override)useMock(local mock mode)debugging(verbose logging)
Access the user’s smart account
UseuseCurrentUser to access the authenticated user’s accounts. The first smart account is available as currentUser.evmSmartAccounts?.[0].
useEvmAddress() to get the primary EVM address; it returns the smart account if one exists, otherwise the EOA.
Send a user operation
Smart accounts submit ERC-4337 user operations rather than standard EOA transactions. UseuseSendUserOperation to submit one or more calls. This hook returns status, data, and error values which you can use to track the status of the user operation.
Batch calls
Provide multiplecalls to batch actions in a single user operation. Calls execute in order and revert atomically on failure.
Encode contract calls
To interact with contracts, passdata using an ABI-encoded payload. This example encodes an ERC-20 transfer using viem:
Using non-Base networks
Smart accounts can send user operations on the following networks:| Network | Mainnet | Testnet |
|---|---|---|
| Base | ✓ | ✓ (Base Sepolia) |
| Arbitrum | ✓ | |
| Optimism | ✓ | |
| Zora | ✓ | |
| Polygon | ✓ | |
| BNB Chain | ✓ | |
| Avalanche | ✓ | |
| Ethereum | ✓ | ✓ (Sepolia) |
Feature availability: While smart accounts support user operations across all these networks, some features like token transfers, swaps, and funding are only available on specific networks. For the complete feature support matrix, see the CDP SDK documentation.
network parameter for any supported chain. For example:
Gas sponsorship with paymaster
Use a paymaster to sponsor gas so users can transact without holding ETH.- Add
paymasterUrltosendUserOperation - Or set
useCdpPaymaster: trueto use the CDP Paymaster
Questions? Contact us in the #embedded-wallets channel on Discord.
Reference
| Resource | Description |
|---|---|
useCurrentUser | Get the current authenticated user |
useEvmAddress | Primary EVM address (Smart Account if present, else EOA) |
useSendUserOperation | Send a user operation; hook returns status/data |
sendUserOperationOptions | Options for sending a user operation |
sendUserOperationResult | Result fields for sendUserOperation |
ethereum.createOnLogin | Config: “eoa” or “smart” |
| User type | user.evmAccounts[], user.evmSmartAccounts[] |
| Hooks README | Package overview and usage |