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...."
}
}
]
}
'import requests
url = "https://api.gelato.cloud/rpc/{chainId}"
payload = {
"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...."
} }]
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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....'}}
]
})
};
fetch('https://api.gelato.cloud/rpc/{chainId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gelato.cloud/rpc/{chainId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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....'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gelato.cloud/rpc/{chainId}"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gelato.cloud/rpc/{chainId}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gelato.cloud/rpc/{chainId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"preVerificationGas": "0x0",
"verificationGasLimit": "0x148a6",
"callGasLimit": "0x358e"
}
}{
"message": "<string>"
}Bundler API Endpoints
eth_estimateUserOperationGas
Returns estimated gas values for a UserOperation.
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...."
}
}
]
}
'import requests
url = "https://api.gelato.cloud/rpc/{chainId}"
payload = {
"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...."
} }]
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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....'}}
]
})
};
fetch('https://api.gelato.cloud/rpc/{chainId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gelato.cloud/rpc/{chainId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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....'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gelato.cloud/rpc/{chainId}"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gelato.cloud/rpc/{chainId}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gelato.cloud/rpc/{chainId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"0x....\",\n \"nonce\": \"0x....\",\n \"factory\": \"0x....\",\n \"factoryData\": \"0x....\",\n \"callData\": \"0x....\",\n \"signature\": \"0x....\",\n \"maxFeePerGas\": \"0x....\",\n \"maxPriorityFeePerGas\": \"0x....\",\n \"paymaster\": \"0x....\",\n \"paymasterData\": \"0x....\",\n \"eip7702Auth\": {\n \"address\": \"0x....\",\n \"chainId\": \"0x....\",\n \"nonce\": \"0x....\",\n \"r\": \"0x....\",\n \"s\": \"0x....\",\n \"yParity\": \"0x....\"\n }\n },\n \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n {\n \"0xsender\": {\n \"balance\": \"0x....\",\n \"nonce\": \"0x....\",\n \"code\": \"0x....\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"preVerificationGas": "0x0",
"verificationGasLimit": "0x148a6",
"callGasLimit": "0x358e"
}
}{
"message": "<string>"
}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 Itemto include theStateOverrideSetobject. - Then, click
Add a Propertyand add sender address there. - Now you can add the override values such as
balance,nonce,code,state,stateDiffetc.
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
Gelato API key for higher rate limits. This must be provided if sponsoring off-chain via Gas Tank.
Path Parameters
Target network chain identifier.
Body
application/json
params
(`UserOperationEntryPoint0.7` · object | `UserOperationEntryPoint0.6` · object | string | `StateOverrideSet` · object)[]
- Object - The
UserOperationobject (gas limits and prices are optional) - String - The
EntryPointaddress the request should be sent through. This MUST be one of the entry points returned by theeth_supportedEntryPointsrpc call. - Object - Optional state override set that allows changes to the state of a contract before executing the call.
Required array length:
2 - 3 elementsShow child attributes
Show child attributes
⌘I