payment_policy
erc-4337
account-abstraction
userop
paymaster
entrypoint
crypto-primitive
mcp:recompute_erc4337_userop_math

ERC-4337 UserOperation Math

Recomputes the ERC-4337 account-abstraction userOpHash from a caller-supplied UserOperation, computes the EntryPoint's required prefund from caller-supplied gas limits, and reconciles a declared paymaster charge against a charge recomputed from declared inputs. The EntryPoint version is a mandatory declared parameter, never inferred: v0.6 hashes a 10-word UserOperation pack, v0.7 hashes an 8-word PackedUserOperation in which verificationGasLimit and callGasLimit pack into accountGasLimits and maxPriorityFeePerGas and maxFeePerGas pack into gasFees. The prefund formulas differ too: v0.6 multiplies verificationGasLimit by three when a paymaster is present because that limit also caps postOp, while v0.7 adds the paymaster's own verification and postOp gas limits parsed from fixed offsets inside paymasterAndData. Both versions are supported; an unrecognised version is refused, never approximated. L1 data and blob fees are never derived, since after EIP-4844 they depend on the inclusion-time L1 basefee and blob basefee: an L1 data fee enters reconciliation only when declared, and its absence is reported as a named gap. block.basefee is never fetched either, so with differing fee caps the effective gas price is null with the reason unless a basefee is declared. keccak256 comes from the already-vendored, pinned noble-hashes bundle; the ABI encoding scheme is public-spec arithmetic on top of it, not hand-rolled crypto. Zero network calls and zero chain reads. Makes no claim that any operation was settled, accepted, included, or final, and no claim about signature validity, which the ERC-4337 spec excludes from the hashed struct.

Tool URL: https://ainumbers.co/chaingraph/art-613-erc4337-userop-math.html

post/v1/tools/recompute_erc4337_userop_math

Request

  • Base URL: https://ainumbers.co
  • URL: https://ainumbers.co/v1/tools/recompute_erc4337_userop_math
  • Auth: none declared

Request body

entryPointVersionstring
entryPointstring
chainIdnumber
senderstring
noncenumber
initCodestring
callDatastring
paymasterAndDatastring
callGasLimitnumber
verificationGasLimitnumber
preVerificationGasnumber
maxFeePerGasnumber
maxPriorityFeePerGasnumber
declaredBaseFeePerGasnumber
declaredActualGasUsednumber
declaredActualGasCostWeistring
declaredL1DataFeeWeistring
reconciliationToleranceWeistring

Response

Successful tool execution result

verdictstring
reasonsstring[]
chain_idstring nullable
packed_user_op_hashstring nullable
user_op_hashstring nullable
never_fetchedstring[]
scope_notestring

Changes

No recorded changes to this operation across all 1 revision of this API.