TriportRPC

eth_estimateGas

BNB Smart Chain / https://triport.io/rpc/bsc

Minimum tier: Free

BNB Smart Chain method guide

Last updated:

eth_estimateGas simulates an EVM call against current BNB Smart Chain state and returns the estimated gas requirement as a hex quantity.

Use the estimate to prepare a transaction's gas limit. The call object can supply sender, destination, value, calldata, fee fields, gas, and an access list; it must contain at least one of to, data, or input according to the OpenRPC schema.

Unlike eth_call, this method returns a gas amount rather than contract output. It does not broadcast or mutate state, and raw transaction submission is not exposed for BSC. Execution can still fail for malformed calldata or a reverting call.

Parameters

eth_estimateGas parameters
NameTypeRequiredDescription
callCallYes

Returns

eth_estimateGas return value
FieldType
gasQuantity

Examples

curl https://triport.io/rpc/bsc \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":["<call>"]}'
const res = await fetch("https://triport.io/rpc/bsc", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_estimateGas",
  "params": [
    "<call>"
  ]
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/rpc/bsc",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":["<call>"]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: BNB Smart Chain.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_estimateGas do?
Estimate gas for an EVM call.
How many credits does eth_estimateGas cost?
eth_estimateGas costs 1 credit(s) per call on Triport by default.
Is eth_estimateGas available over WebSocket?
eth_estimateGas is an HTTP JSON-RPC method.