---
title: "ERC-4337 UserOperation Math"
method: POST
path: "/v1/tools/recompute_erc4337_userop_math"
tags: ["payment_policy", "erc-4337", "account-abstraction", "userop", "paymaster", "entrypoint", "crypto-primitive", "mcp:recompute_erc4337_userop_math"]
---

# ERC-4337 UserOperation Math

`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

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

## Request body

- object
  - `entryPointVersion` string
  - `entryPoint` string
  - `chainId` number
  - `sender` string
  - `nonce` number
  - `initCode` string
  - `callData` string
  - `paymasterAndData` string
  - `callGasLimit` number
  - `verificationGasLimit` number
  - `preVerificationGas` number
  - `maxFeePerGas` number
  - `maxPriorityFeePerGas` number
  - `declaredBaseFeePerGas` number
  - `declaredActualGasUsed` number
  - `declaredActualGasCostWei` string
  - `declaredL1DataFeeWei` string
  - `reconciliationToleranceWei` string

## Response `200`

Successful tool execution result

- object
  - `verdict` string
  - `reasons` string[]
  - `entry_point` object
    - `declared_version` string, nullable
    - `address` string, nullable
    - `canonical_address_for_declared_version` string, nullable
    - `address_matches_canonical` boolean, nullable
  - `chain_id` string, nullable
  - `user_op` object
    - `sender` string, nullable
    - `nonce` string, nullable
    - `init_code` string, nullable
    - `call_data` string, nullable
    - `paymaster_and_data` string, nullable
    - `call_gas_limit` string, nullable
    - `verification_gas_limit` string, nullable
    - `pre_verification_gas` string, nullable
    - `max_fee_per_gas` string, nullable
    - `max_priority_fee_per_gas` string, nullable
  - `packed_words` object, nullable
    - `layout` string
    - `word_count` number
    - `account_gas_limits` string, nullable
    - `gas_fees` string, nullable
  - `field_hashes` object, nullable
    - `init_code_hash` string
    - `call_data_hash` string
    - `paymaster_and_data_hash` string
  - `packed_user_op_hash` string, nullable
  - `user_op_hash` string, nullable
  - `gas_accounting` object, nullable
    - `entry_point_version` string
    - `required_gas` string
    - `required_prefund_wei` string
    - `prefund_formula` string
    - `paymaster_present` boolean
    - `paymaster_address` string, nullable
    - `paymaster_multiplier_applied` string, nullable
    - `paymaster_verification_gas_limit` string, nullable
    - `paymaster_post_op_gas_limit` string, nullable
    - `paymaster_fields_note` string, nullable
    - `declared_base_fee_per_gas` string, nullable
    - `effective_gas_price_wei` string, nullable
    - `effective_gas_price_basis` string
  - `paymaster_reconciliation` object, nullable
    - `status` string
    - `missing_declared_inputs` string[]
    - `declared_actual_gas_used` string, nullable
    - `declared_actual_gas_cost_wei` string, nullable
    - `declared_l1_data_fee_wei` string, nullable
    - `recomputed_execution_cost_wei` string, nullable
    - `recomputed_total_charge_wei` string, nullable
    - `residual_wei` string, nullable
    - `tolerance_wei` string
    - `notes` string[]
  - `never_fetched` string[]
  - `scope_note` string

---

[API](https://skmtc.dev/ainumbers/apis/ainumbers-co-fintech-intelligence-suite.md) · [All operations](https://skmtc.dev/ainumbers/apis/ainumbers-co-fintech-intelligence-suite/llms.txt) · [OpenAPI document](https://skmtc.dev/ainumbers/apis/ainumbers-co-fintech-intelligence-suite/revisions/b462e4f5bb28?raw)
