BNB Smart Chain

BNB Smart Chain

eth_feeHistory

eth_feeHistory looks backward across a window of recent BNB Smart Chain blocks and returns each block's base fee (paid in BNB), its gas-used ratio, and priority-fee samples at the percentiles you request. With BSC sealing a block roughly every three seconds under PoSA, even a few dozen blocks captures a fresh, fine-grained fee picture. Call https://bsc.therpc.io/YOUR_API_KEY at chain ID 56, and the data becomes the raw input for an EIP-1559 fee strategy that picks sensible maxFeePerGas and tip values.

Use cases

  • Build a fee estimator that reads recent percentile rewards to set maxFeePerGas and maxPriorityFeePerGas for a BNB transaction.
  • Render a fee-trend chart in a wallet or in a bscscan.com-style explorer view.
  • Watch gasUsedRatio climb toward 1.0 to detect BSC congestion during busy PancakeSwap windows.
  • Drive MEV-aware bidding by inspecting how high the upper reward percentiles run block to block.

Parameters

#NameTypeRequiredDescription
1blockCountstring | numberYesNumber of blocks to include in the history window. Most providers cap this at 1024.
2newestBlockstringYesThe most recent block to include in the window.Default: latest
3rewardPercentilesnumber[]NoArray of percentile values (0–100) at which to sample priority fees from each block. Pass an empty array to omit reward data.

Response

TypeDescription
objectObject with: `oldestBlock` (hex, starting block of the window), `baseFeePerGas` (array of hex wei — one per block plus the next predicted value), `gasUsedRatio` (array of floats 0–1 per block), `reward` (array of arrays — per-block percentile priority fees in hex wei; only present when `rewardPercen

Example request

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": [
4,
"latest",
[
25,
50,
75
]
],
"id": 1
}'

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32602invalid argumentblockCount is 0, out of range, or rewardPercentiles contains values outside 0–100.
-32000block not found`newestBlock` references a block that does not exist on this node.

Common pitfalls

  • The baseFeePerGas array carries one extra trailing entry: the node's forecast for the next BSC block, which has not been sealed yet — do not mistake it for a confirmed fee.
  • Against a network or node that predates EIP-1559 support, the call errors out or omits the fee fields entirely; guard for that path.
  • A large blockCount returns a hefty payload, so cap the window at roughly 100–200 blocks per request and page through longer ranges.

Supported networks

  • Mainnet — Chain ID: 56
  • Testnet — Chain ID: 97

See also

Parameters

Hex or decimal integer, e.g. "0xa" or 10

"latest" | "safe" | "finalized" | hex block number

Array of percentile values (0–100) at which to sample priority fees from each block. Pass an empty array to omit reward data.

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_feeHistory","params":["4","latest",[25,50,75]]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.