Skip to main content
POST
/
rpc
/
{chainId}
eth_estimateUserOperationGas
curl --request POST \
  --url https://api.gelato.cloud/rpc/{chainId} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <x-api-key>' \
  --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_estimateUserOperationGas",
  "params": [
    {
      "sender": "0x....",
      "nonce": "0x....",
      "factory": "0x....",
      "factoryData": "0x....",
      "callData": "0x....",
      "signature": "0x....",
      "maxFeePerGas": "0x....",
      "maxPriorityFeePerGas": "0x....",
      "paymaster": "0x....",
      "paymasterData": "0x....",
      "eip7702Auth": {
        "address": "0x....",
        "chainId": "0x....",
        "nonce": "0x....",
        "r": "0x....",
        "s": "0x....",
        "yParity": "0x...."
      }
    },
    "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
    {
      "0xsender": {
        "balance": "0x....",
        "nonce": "0x....",
        "code": "0x...."
      }
    }
  ]
}
'
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "preVerificationGas": "0x0",
    "verificationGasLimit": "0x148a6",
    "callGasLimit": "0x358e"
  }
}
Update: State overrides are now supported in this API endpoint. Checkout this example and Guide to understand how to use it.
  • In the Playground, click Add an Item to include the StateOverrideSet object.
  • Then, click Add a Property and add sender address there.
  • Now you can add the override values such as balance, nonce, code, state, stateDiff etc.
Before using the API Endpoints, make sure to check out the How-To Guides to understand the required parameters for different payment methods with the Gelato Bundler.
The API Playground below defaults to EntryPoint v0.7 & EntryPoint v0.8 parameters, If you’re working with EntryPoint v0.6, please change the object parameter to UserOperationEntryPoint0.6.Important: After entering the userOperation parameters, make sure to click Add an Item to include the EntryPoint address.

Headers

X-API-Key
string
required

Gelato API key for higher rate limits. This must be provided if sponsoring off-chain via Gas Tank.

Path Parameters

chainId
number
required

Target network chain identifier.

Body

application/json
id
number
default:1
jsonrpc
string
default:2.0
method
string
default:eth_estimateUserOperationGas
params
(`UserOperationEntryPoint0.7` · object | `UserOperationEntryPoint0.6` · object | string | `StateOverrideSet` · object)[]
  1. Object - The UserOperation object (gas limits and prices are optional)
  2. String - The EntryPoint address the request should be sent through. This MUST be one of the entry points returned by the eth_supportedEntryPoints rpc call.
  3. Object - Optional state override set that allows changes to the state of a contract before executing the call.
Required array length: 2 - 3 elements

Response

Successful response

id
number
default:1
jsonrpc
string
default:2.0
result
object