TriportRPC

eth_feeHistory

POSThttps://triport.io/rpc/bsc

Return fee-market history.

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

eth_feeHistory returns recent fee-market observations ending at a selected BNB Smart Chain block.

The response contains the oldest block in the window, base-fee quantities, gas-used ratios, and optional reward rows for the requested percentiles. Quantities are hex encoded; gas-used ratios are numbers between zero and one.

Use it to build fee suggestions from a block window. For a single current gas-price estimate use eth_gasPrice; for a single priority-fee estimate use eth_maxPriorityFeePerGas.

Parameters

JSON-RPC params is a positional array: [blockCount, newestBlock, rewardPercentiles].

blockCountstring (hex quantity)required
Number of blocks in the history window, encoded as an EVM hex quantity.
newestBlockstring (block tag or hex quantity)required
Newest block in the requested history window.
rewardPercentilesarray<number>required
Percentiles between 0 and 100 for optional priority-fee reward rows.

Response

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

resultobject
Fee history response.
result.oldestBlockstring
Oldest block in the returned window as a hex quantity.
result.baseFeePerGasarray<string>
Base-fee hex quantities for the window.
result.gasUsedRatioarray<number>
Gas-used ratios between zero and one.
result.rewardarray<array<string>>
Optional reward quantities corresponding to the requested percentiles.

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.
-32000Upstream request failureInterpret the message with the code: header not found means a missing block; pruned/unsupported state text means unavailable historical state.
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_feeHistory",
    "params": [
      "0x1",
      "latest",
      [
        50
      ]
    ]
  }),
});


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

Notes