Advanced
Account Abstraction (ERC-4337) — Key concepts
Build smart wallets.
Developer Advanced
4/8 — Account Abstraction (ERC-4337) — Key concepts
UserOperation flowUsers sign userOps; bundlers collect them; the EntryPoint validates and executes via wallet code.
UserOp cost (simplified)
cost = (preGas + callGas + verificationGas) × maxFeePerGas
Paymasters may cover cost but must be trusted/limited.
bytes32 userOpHash = keccak256(
abi.encode(
address(entryPoint),
chainid,
op.sender,
op.nonce,
keccak256(op.initCode),
keccak256(op.callData),
op.callGasLimit,
op.verificationGasLimit,
op.preVerificationGas,
op.maxFeePerGas,
op.maxPriorityFeePerGas,
keccak256(op.paymasterAndData)
)
);
ValidationThe wallet’s validateUserOp decides if a userOp is acceptable (signature, nonce, paymaster policy).
PaymastersCan sponsor gas conditionally; must guard against grief and DOS.
Key points
- EntryPoint mediates all userOps;:Wallets implement validation and execution.
- Nonce management and replay:Protection are on the wallet.
- Paymasters:Set budgets, per-user rules, and revoke on abuse.
- Bundler trust:Centralization risk; prefer reputable/open bundlers.
- Signature schemes:EOA-like, multisig, or aggregated; gas vs security trade-offs.