Track ERC-4337 UserOperations
A UserOperation is a signed intent that a bundler wraps into a real transaction calling
EntryPoint.handleOps. Its success is reported by the UserOperationEvent, not by the
transaction receipt alone.
Procedure
Know the EntryPoint per version — the address is part of every hash:
# v0.7: 0x0000000071727De22E5E9d8BAf0edAc6f37da032
# v0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
cast call $ENTRYPOINT "getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,uint256,uint256,uint256,uint256,bytes,bytes))(bytes32)" \
"(0x...,1,0x,0x,0x0000...00,100000,100000,21000,1,1,0x,0x)" --rpc-url $RPC
Ask the bundler for the op by hash (JSON-RPC on a bundler endpoint, not a node):
curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationByHash",
"params":["0x<userOpHash>"]}' | jq .
curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationReceipt",
"params":["0x<userOpHash>"]}' | jq -r '.result.success, .result.receipt.transactionHash'
Cross-check on-chain by decoding the EntryPoint logs. The authoritative event is
UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256):
TOPIC=$(cast keccak "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)")
cast logs --address $ENTRYPOINT "$TOPIC" --from-block $B --to-block $((B+5)) \
--rpc-url $RPC --json | jq -r '.[] | [.topics[1], .topics[2], .data] | @tsv'
Estimate gas for a new op through the bundler before sending:
curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_estimateUserOperationGas",
"params":[{"sender":"0x...","callData":"0x...","nonce":"0x0"},$ENTRYPOINT]}' | jq .
On failure, look for UserOperationRevertReason(bytes32,address,uint256,bytes) and
PostOpRevertReason, decode the inner revert, and check success: false in the event.
Pitfalls
UserOperationEvent.success == false means the outer op was included but the account's
inner call reverted; the tx receipt still shows status 0x1. Do not equate tx success with
op success.
- v0.6 vs v0.7 packing differs (the userOpHash and the
paymasterAndData layout changed).
A hash computed with the wrong version never matches on-chain.
- The nonce is 256 bits: a 192-bit key plus a 64-bit sequence. Reusing the key with a
non-sequential value makes the op invalid.
- A revert in
postOp (or an out-of-gas postOp) reverts the entire UserOperation even though
validation passed; check PostOpRevertReason.
- Bundlers simulate against a slightly different state than the eventual block; an estimate
that passes can still fail at inclusion under changed balances or allowances.
Verification
cast logs --address $ENTRYPOINT "$(cast keccak "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)")" \
--from-block $B --to-block $((B+10)) --rpc-url $RPC --json \
| jq -r '.[0].data' # last word region encodes success flag
Report the userOpHash, the inclusion tx hash, the success flag from
eth_getUserOperationReceipt, and any UserOperationRevertReason.
1---2name: track-erc4337-userops3description: Use when following an ERC-4337 UserOperation from submission to inclusion, decoding EntryPoint events, or debugging why a sponsored transaction reverted.4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/track-erc4337-userops6---78# Track ERC-4337 UserOperations910A UserOperation is a signed intent that a bundler wraps into a real transaction calling11`EntryPoint.handleOps`. Its success is reported by the `UserOperationEvent`, not by the12transaction receipt alone.1314## Procedure15161. Know the EntryPoint per version — the address is part of every hash:1718 # v0.7: 0x0000000071727De22E5E9d8BAf0edAc6f37da03219 # v0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d278920 cast call $ENTRYPOINT "getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,uint256,uint256,uint256,uint256,bytes,bytes))(bytes32)" \21 "(0x...,1,0x,0x,0x0000...00,100000,100000,21000,1,1,0x,0x)" --rpc-url $RPC22232. Ask the bundler for the op by hash (JSON-RPC on a bundler endpoint, not a node):2425 curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \26 --data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationByHash",27 "params":["0x<userOpHash>"]}' | jq .28 curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \29 --data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationReceipt",30 "params":["0x<userOpHash>"]}' | jq -r '.result.success, .result.receipt.transactionHash'31323. Cross-check on-chain by decoding the EntryPoint logs. The authoritative event is33 `UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)`:3435 TOPIC=$(cast keccak "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)")36 cast logs --address $ENTRYPOINT "$TOPIC" --from-block $B --to-block $((B+5)) \37 --rpc-url $RPC --json | jq -r '.[] | [.topics[1], .topics[2], .data] | @tsv'38394. Estimate gas for a new op through the bundler before sending:4041 curl -s -X POST "$BUNDLER" -H 'content-type: application/json' \42 --data '{"jsonrpc":"2.0","id":1,"method":"eth_estimateUserOperationGas",43 "params":[{"sender":"0x...","callData":"0x...","nonce":"0x0"},$ENTRYPOINT]}' | jq .44455. On failure, look for `UserOperationRevertReason(bytes32,address,uint256,bytes)` and46 `PostOpRevertReason`, decode the inner revert, and check `success: false` in the event.4748## Pitfalls4950- `UserOperationEvent.success == false` means the outer op was *included* but the account's51 inner call reverted; the tx receipt still shows `status 0x1`. Do not equate tx success with52 op success.53- v0.6 vs v0.7 packing differs (the userOpHash and the `paymasterAndData` layout changed).54 A hash computed with the wrong version never matches on-chain.55- The nonce is 256 bits: a 192-bit key plus a 64-bit sequence. Reusing the key with a56 non-sequential value makes the op invalid.57- A revert in `postOp` (or an out-of-gas postOp) reverts the entire UserOperation even though58 validation passed; check `PostOpRevertReason`.59- Bundlers simulate against a slightly different state than the eventual block; an estimate60 that passes can still fail at inclusion under changed balances or allowances.6162## Verification6364 cast logs --address $ENTRYPOINT "$(cast keccak "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)")" \65 --from-block $B --to-block $((B+10)) --rpc-url $RPC --json \66 | jq -r '.[0].data' # last word region encodes success flag6768Report the userOpHash, the inclusion tx hash, the `success` flag from69`eth_getUserOperationReceipt`, and any `UserOperationRevertReason`.