POST
/
#eth_estimateUserOperationGas
curl --request POST \
  --url 'https://bundler.particle.network/#eth_estimateUserOperationGas' \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "chainId": 80001,
  "method": "eth_estimateUserOperationGas",
  "params": [
    {
      "sender": "0xSenderAddress",
      "nonce": "0x1",
      "initCode": "0xInitCode",
      "callData": "0xCallData",
      "signature": "0xSignature"
    }
  ]
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "chainId": 80001,
  "result": {
    "maxFeePerGas": "0x3B9ACA00",
    "maxPriorityFeePerGas": "0x3B9ACA00",
    "preVerificationGas": "0x5208",
    "verificationGas": "0x5208",
    "verificationGasLimit": "0x5208",
    "callGasLimit": "0x5208"
  }
}

Understanding estimateUserOperationGas

  • estimateUserOperationGas takes a partial UserOperation object and returns detailed gas estimates to be used in continued UserOperation construction. It takes:
    • Partial user operation object:
      • sender - string.
      • nonce - string.
      • initCode - string.
      • callData - string.
      • signature - string.signature can be a dummy string, such as 0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c.
      • entrypointAddress - string.

Query example

JSON
{
  "method": "eth_estimateUserOperationGas",
  "params": [
    // partial user operation
    {
      "sender": "0x8fb859e944561678be40cdd2db16551396c0b074",
      "nonce": "0x0152",
      "initCode": "0x",
      "callData": "0x9e5d4c49000000000000000000000000329a7f8b91ce7479035cb1b5d62ab41845830ce8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
      "signature": "0x73c3ac716c487ca34bb858247b5ccf1dc354fbaabdd089af3b2ac8e78ba85a4959a2d76250325bd67c11771c31fccda87c33ceec17cc0de912690521bb95ffcb1b"
    },
    "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789"
  ],
  "id": 1695717515,
  "jsonrpc": "2.0",
  "chainId": 80001
}

Body

application/json
Request to estimate the gas cost of a user operation.
jsonrpc
string
default:2.0
required

Version of the JSON-RPC protocol, should be 2.0.

Example:

"2.0"

id
integer
default:1
required

The request identifier.

Example:

1

chainId
integer
required

The chain ID.

Example:

80001

method
enum<string>
required

API method being called.

Available options:
eth_estimateUserOperationGas
params
array
required

Parameters for gas estimation.

Response

200 - application/json
Successful response with gas estimation.
jsonrpc
string
default:2.0
required

Version of the JSON-RPC protocol, should be 2.0.

Example:

"2.0"

id
integer
default:1
required

The request identifier.

Example:

1

chainId
integer
required

The chain ID.

Example:

80001

result
object
required