What is a UserOperation?
A UserOperation (UserOp) is the transaction format in ERC-4337 account abstraction — a pseudo-transaction submitted to the alt mempool that encodes the sender, target, calldata, gas parameters, and signature for a smart account operation.
WHY IT MATTERS
Smart accounts can't send regular Ethereum transactions (those require EOA signatures). Instead, they create UserOperations — structured data that describes the intended action. Bundlers collect UserOps, validate them, and submit them to the EntryPoint contract for on-chain execution.
A UserOp includes: sender (smart account address), nonce, callData (what to execute), gas limits, paymaster data (if using gas sponsorship), and signature (validated by the smart account's custom logic). This structure enables features impossible with regular transactions.
For agents, UserOps enable batched operations (swap + transfer in one UserOp), sponsored gas (paymaster field), and custom validation (spending policy checks during the signature verification step).
HOW POLICYLAYER USES THIS
PolicyLayer evaluates UserOperations against spending policies during the validation phase. Before a UserOp is submitted to the bundler, PolicyLayer checks the calldata, amounts, and recipients — rejecting UserOps that violate policies.