eth_estimateUserOperationGas
curl --request POST \
--url https://rpc.etherspot.io/v1/137/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "<string>",
"nonce": "<string>",
"initCode": "<string>",
"callData": "<string>",
"paymasterAndData": "<string>",
"callGasLimit": "<string>",
"verificationGasLimit": "<string>",
"preVerificationGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"maxFeePerGas": "<string>",
"signature": "<string>"
}
],
"id": 123
}
'import requests
url = "https://rpc.etherspot.io/v1/137/"
payload = {
"jsonrpc": "2.0",
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "<string>",
"nonce": "<string>",
"initCode": "<string>",
"callData": "<string>",
"paymasterAndData": "<string>",
"callGasLimit": "<string>",
"verificationGasLimit": "<string>",
"preVerificationGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"maxFeePerGas": "<string>",
"signature": "<string>"
}
],
"id": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_estimateUserOperationGas',
params: [
{
sender: '<string>',
nonce: '<string>',
initCode: '<string>',
callData: '<string>',
paymasterAndData: '<string>',
callGasLimit: '<string>',
verificationGasLimit: '<string>',
preVerificationGas: '<string>',
maxPriorityFeePerGas: '<string>',
maxFeePerGas: '<string>',
signature: '<string>'
}
],
id: 123
})
};
fetch('https://rpc.etherspot.io/v1/137/', 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://rpc.etherspot.io/v1/137/",
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([
'jsonrpc' => '2.0',
'method' => 'eth_estimateUserOperationGas',
'params' => [
[
'sender' => '<string>',
'nonce' => '<string>',
'initCode' => '<string>',
'callData' => '<string>',
'paymasterAndData' => '<string>',
'callGasLimit' => '<string>',
'verificationGasLimit' => '<string>',
'preVerificationGas' => '<string>',
'maxPriorityFeePerGas' => '<string>',
'maxFeePerGas' => '<string>',
'signature' => '<string>'
]
],
'id' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://rpc.etherspot.io/v1/137/"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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://rpc.etherspot.io/v1/137/")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.etherspot.io/v1/137/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}"
response = http.request(request)
puts response.read_bodySkandha (Bundler) API calls
eth_estimateUserOperationGas
Estimate User Operation
POST
/
eth_estimateUserOperationGas
curl --request POST \
--url https://rpc.etherspot.io/v1/137/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "<string>",
"nonce": "<string>",
"initCode": "<string>",
"callData": "<string>",
"paymasterAndData": "<string>",
"callGasLimit": "<string>",
"verificationGasLimit": "<string>",
"preVerificationGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"maxFeePerGas": "<string>",
"signature": "<string>"
}
],
"id": 123
}
'import requests
url = "https://rpc.etherspot.io/v1/137/"
payload = {
"jsonrpc": "2.0",
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "<string>",
"nonce": "<string>",
"initCode": "<string>",
"callData": "<string>",
"paymasterAndData": "<string>",
"callGasLimit": "<string>",
"verificationGasLimit": "<string>",
"preVerificationGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"maxFeePerGas": "<string>",
"signature": "<string>"
}
],
"id": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_estimateUserOperationGas',
params: [
{
sender: '<string>',
nonce: '<string>',
initCode: '<string>',
callData: '<string>',
paymasterAndData: '<string>',
callGasLimit: '<string>',
verificationGasLimit: '<string>',
preVerificationGas: '<string>',
maxPriorityFeePerGas: '<string>',
maxFeePerGas: '<string>',
signature: '<string>'
}
],
id: 123
})
};
fetch('https://rpc.etherspot.io/v1/137/', 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://rpc.etherspot.io/v1/137/",
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([
'jsonrpc' => '2.0',
'method' => 'eth_estimateUserOperationGas',
'params' => [
[
'sender' => '<string>',
'nonce' => '<string>',
'initCode' => '<string>',
'callData' => '<string>',
'paymasterAndData' => '<string>',
'callGasLimit' => '<string>',
'verificationGasLimit' => '<string>',
'preVerificationGas' => '<string>',
'maxPriorityFeePerGas' => '<string>',
'maxFeePerGas' => '<string>',
'signature' => '<string>'
]
],
'id' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://rpc.etherspot.io/v1/137/"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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://rpc.etherspot.io/v1/137/")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.etherspot.io/v1/137/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_estimateUserOperationGas\",\n \"params\": [\n {\n \"sender\": \"<string>\",\n \"nonce\": \"<string>\",\n \"initCode\": \"<string>\",\n \"callData\": \"<string>\",\n \"paymasterAndData\": \"<string>\",\n \"callGasLimit\": \"<string>\",\n \"verificationGasLimit\": \"<string>\",\n \"preVerificationGas\": \"<string>\",\n \"maxPriorityFeePerGas\": \"<string>\",\n \"maxFeePerGas\": \"<string>\",\n \"signature\": \"<string>\"\n }\n ],\n \"id\": 123\n}"
response = http.request(request)
puts response.read_bodyExample values you use to demo the API:
Example response:
{
"jsonrpc": "2.0",
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender":"0xb341FEAFaF71b09089d03B7D114599f8F491EE45",
"nonce":"0x0",
"initCode":"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3296601cd0000000000000000000000000da6a956b9488ed4dd761e59f52fdc6c8068e6b5000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084d1f57894000000000000000000000000d9ab5096a832b9ce79914329daee236f8eea039000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000014375cd3E53E18f65672E9d0Eb6AD174511b0BF98100000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callData":"0x5194544700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit":"0x0",
"verificationGasLimit":"0x0",
"preVerificationGas":"0x0",
"maxPriorityFeePerGas":"0x3b9aca00",
"maxFeePerGas":"0x7a5cf70d5",
"paymasterAndData":"0x",
"signature":"0x00000000fffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"
},
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"id": 1
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"preVerificationGas": "0xdf55",
"verificationGas": "0x52503",
"verificationGasLimit": "0x52503",
"callGasLimit": "0x13880",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x59682f00"
}
}
Body
application/json
The first item in the array MUST be a userop, and the second item MUST be address of EntryPoint.
Response
200
Successful estimation
⌘I

