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
  1. Map trust:Bundler, paymaster, wallet owner(s), signature scheme.
  2. Design validation:Signature checks, nonces, paymaster rules.
  3. Implement minimal AA wallet:ValidateUserOp + execute.
  4. Add paymaster policy:Budgets, allowlist, withdrawal.
  5. Test replay, bad signatures,:Gas sponsorship abuse.
  6. Review monitoring:Events and userOp fields to log.
← Previous section
Next section →