TriportRPC

eth_estimateGas

POSThttps://triport.io/rpc/bsc

Estimate gas for an EVM call.

BNB Smart Chainbsc:rpcbsc_read_rpc - 15 / 20 / 100 / 250 RPS (free / basic / pro / business) (default, unmeasured); enterprise unlimited

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

JSON-RPC params is a positional array: [call].

callobjectrequired
EVM call object to simulate; see the object fields below.
accessListarray<object>optional
EIP-2930 access-list entries; each contains address and storageKeys.
datastring (hex data)optional
ABI-encoded call data; an alternative to input.
fromstring (address)optional
Address used as the simulated sender.
gasstring (hex quantity)optional
Gas made available to the simulation.
gasPricestring (hex quantity)optional
Legacy gas-price field.
inputstring (hex data)optional
ABI-encoded call data; an alternative to data.
maxFeePerGasstring (hex quantity)optional
Maximum fee-per-gas field.
maxPriorityFeePerGasstring (hex quantity)optional
Maximum priority-fee field.
tostring (address)optional
Destination account or contract.
valuestring (hex quantity)optional
Native value supplied to the simulated call.
accessList[]object
addressstring (address)required
Account whose storage is predeclared.
storageKeysarray<string>required
32-byte storage-key hashes for that account.

Response

The response below is the checked fixture for this method; it is reproduced without changing its fields or values.

resultstring (hex quantity)
Estimated gas as a hex quantity.

Errors

Errors use the standard JSON-RPC error envelope. See BSC errors for network-specific classification and the linked shared reference.

CodeMeaningWhen it happens
-32602Invalid paramsA required positional parameter is missing or a value does not match the OpenRPC schema.
401UnauthorizedThe x-token API key is missing or invalid.
429Rate limitedThe request exceeds the configured category RPS for the caller's tier.

Examples

JavaScript (fetch)

const response = await fetch("https://triport.io/rpc/bsc", {
  method: "POST",
  headers: {
    "x-token": process.env.TRIPORT_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_estimateGas",
    "params": [
      {
        "to": "0x0000000000000000000000000000000000000000",
        "value": "0x0"
      }
    ]
  }),
});


const payload = await response.json();
console.log(payload.result);

Notes

  • An estimate is a simulation result, not a guarantee that a later transaction will use exactly the same gas.
  • The BSC categories use configured defaults of 15 / 20 / 100 / 250 RPS; they are marked unmeasured in the tier matrix.
  • Related methods: eth_call, eth_gasPrice, eth_feeHistory.