Advanced
Account Abstraction (ERC-4337) — Lesson outline
Build smart wallets.
Developer Advanced
5/8 — Account Abstraction (ERC-4337) — Lesson outline
RouteFollow this to avoid skipping safety.
function validateUserOp(UserOperation calldata op, bytes32 opHash, uint256 missingFunds)
external override returns (uint256) {
_onlyEntryPoint();
_checkNonce(op.nonce);
_checkSig(opHash, op.signature);
_checkPaymaster(op.paymasterAndData, missingFunds);
return 0;
}
Keep a skeleton handy so each step in the outline maps to code you need to ship.
Steps
- Map trust:Bundler, paymaster, wallet owner(s), signature scheme.
- Design validation:Signature checks, nonces, paymaster rules.
- Implement minimal AA wallet:ValidateUserOp + execute.
- Add paymaster policy:Budgets, allowlist, withdrawal.
- Test replay, bad signatures,:Gas sponsorship abuse.
- Review monitoring:Events and userOp fields to log.