Skip to main content

0.01 credits per call

eth_estimateGas on Base: Estimates the gas required to execute a transaction.

Endpoint

https://rpc.goldrushdata.com/v1/base-mainnet
Authenticate with Authorization: Bearer <GOLDRUSH_API_KEY>. See authentication.

Parameters

NameTypeRequiredDescriptionExample
callObjectObjectyesSame shape as eth_call’s call object.{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}

Returns

QUANTITY: Hex-encoded gas estimate.
"0xc738"

Examples

curl https://rpc.goldrushdata.com/v1/base-mainnet \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_estimateGas",
    "params": [{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}]
  }'
import { ethers } from "ethers";

const url = "https://rpc.goldrushdata.com/v1/base-mainnet";
const fetchReq = new ethers.FetchRequest(url);
fetchReq.setHeader("Authorization", `Bearer ${process.env.GOLDRUSH_API_KEY}`);

const provider = new ethers.JsonRpcProvider(fetchReq);
const result = await provider.send("eth_estimateGas", [{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}]);
console.log(result);
import { createPublicClient, http } from "viem";

const client = createPublicClient({
  transport: http("https://rpc.goldrushdata.com/v1/base-mainnet", {
    fetchOptions: {
      headers: {
        Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}`,
      },
    },
  }),
});

const result = await client.request({
  method: "eth_estimateGas",
  params: [{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}],
});
console.log(result);
import { Web3 } from "web3";

const provider = new Web3.providers.HttpProvider(
  "https://rpc.goldrushdata.com/v1/base-mainnet",
  {
    headers: [
      { name: "Authorization", value: `Bearer ${process.env.GOLDRUSH_API_KEY}` },
    ],
  }
);
const web3 = new Web3(provider);

const result = await web3.currentProvider.request({
  method: "eth_estimateGas",
  params: [{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}],
});
console.log(result);
from os import environ
from web3 import Web3

w3 = Web3(Web3.HTTPProvider(
    "https://rpc.goldrushdata.com/v1/base-mainnet",
    request_kwargs={
        "headers": {
            "Authorization": f"Bearer {environ['GOLDRUSH_API_KEY']}",
        },
    },
))
result = w3.manager.request_blocking("eth_estimateGas", [{"from":"0xd8da6bf2...","to":"0xa0b86991...","data":"0xa9059cbb..."}])
print(result)

Errors

CodeMessage
-32000Gas required exceeds allowance, or transaction reverts.
Plus standard JSON-RPC errors: -32600 invalid request, -32601 method not found, -32602 invalid params.

Also available on