← Protocols
ERC-4337 — Account Abstraction Using Alt Mempool
Standard / EIP·EVM

ERC-4337 — Account Abstraction Using Alt Mempool

01Description

Smart-contract account standard that brings account abstraction to Ethereum without consensus-layer changes by introducing UserOperations, an alt-mempool, Bundlers, and a singleton EntryPoint contract. Status: Review (Standards Track / ERC).

02Best for
  • 01smart accounts without protocol changes
  • 02gas sponsorship via Paymasters
  • 03session keys and custom validation
  • 04passkey / social login wallets
  • 05transaction batching
03Install
  • pnpm add permissionless viem
  • pnpm add @account-abstraction/contracts
  • # alternative SDKs: @zerodev/sdk, @biconomy/account, @alchemy/aa-core
05Prompt snippet
Use ERC-4337 to build smart-contract accounts that send `UserOperation` (struct: sender, nonce, initCode, callData, callGasLimit, verificationGasLimit, preVerificationGas, maxFeePerGas, maxPriorityFeePerGas, paymasterAndData, signature) through a Bundler RPC (`eth_sendUserOperation`, `eth_estimateUserOperationGas`) targeting an EntryPoint singleton (v0.6 at 0x5FF1...789, v0.7 at 0x0000...032). The EntryPoint calls `validateUserOp` on the account and `validatePaymasterUserOp` on an optional Paymaster, then executes `callData` via `handleOps`. Prefer `permissionless` (Pimlico) or ZeroDev's SDK with viem — both expose `createSmartAccountClient` and abstract bundler/paymaster RPC. For sponsored gas, attach a verifying or token paymaster. Sign UserOps with EIP-191 / EIP-712 hashes scoped to the EntryPoint and chainId.
06Gotchas
  • EntryPoint v0.6 and v0.7 are NOT interchangeable — UserOp shape, hash formula, and paymaster fields changed (paymasterAndData split into separate fields in 0.7). Pick one and pin every contract/SDK to the same version.
  • Bundler validation rules (ERC-7562) forbid certain opcodes (TIMESTAMP, BLOCKHASH, GAS) and storage access patterns during `validateUserOp` — violating them silently drops the UserOp from the mempool.
  • `initCode` runs only on the first UserOp; subsequent ops must leave it empty or the EntryPoint reverts. Use `getSenderAddress` to compute the counterfactual address before deployment.
  • Signature aggregation (BLS, etc.) requires an aggregator contract registered with the EntryPoint — most paymasters do not support aggregated UserOps.
  • Paymaster deposits and stake are tracked per-EntryPoint; topping up the wrong version is a common production foot-gun.
07Alternatives