UserOperation Explained in Detail
A UserOperation is not a normal Ethereum transaction. It is a structured request that a smart account validates before the EntryPoint executes the account's intended call.
Important fields include sender, nonce, callData, gas limits, optional deployment data, optional paymaster data, and signature.
Smart contract example
struct UserOperation {
address sender;
uint256 nonce;
bytes callData;
bytes paymasterAndData;
bytes signature;
}
The real ERC-4337 structure includes more gas and deployment fields, but these are the security-sensitive pieces auditors usually trace first.
UserOperation in Auditing
The UserOperation hash is what the account and paymaster usually approve. If the hash omits important context, an attacker may replay or redirect the operation.
Auditors check whether the operation binds the exact account, action, nonce, chain, EntryPoint, gas policy, and paymaster conditions.
Red flags in code
-
callDatacan target unintended functions. -
Paymaster data can be reused for a different operation.
-
Gas fields are accepted without realistic bounds.
-
Nonce lanes or key-based nonces are misunderstood.
How to test or review it
-
Mutate each UserOperation field and confirm validation fails when it should.
-
Replay the same operation after it succeeds.
-
Replay across a different chain, EntryPoint, or account instance.
-
Test malformed calldata and paymaster data.
-
Confirm duplicate nonces and expired validity windows fail.
Keep learning this topic
ERC-4337
ERC-4337 is an Ethereum account abstraction standard that uses UserOperations, bundlers, paymasters, and an EntryPoint contract without changing Ethereum consensus.
Account Abstraction
Account abstraction lets smart contract accounts define their own validation rules instead of relying only on externally owned account transaction rules.
EntryPoint Contract
The EntryPoint contract is the ERC-4337 contract that validates and executes bundles of UserOperations and manages account and paymaster deposits.
Practice this in real audit scenarios
Definitions help, but auditors need reps. SCH turns concepts like UserOperation into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.