BNB Smart Chain
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
BNB Smart Chain
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
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.
maxFeePerGas and maxPriorityFeePerGas for a BNB transaction.gasUsedRatio climb toward 1.0 to detect BSC congestion during busy PancakeSwap windows.| # | Nom | Type | Obligatoire | Description |
|---|---|---|---|---|
| 1 | blockCount | string | number | Oui | Number of blocks to include in the history window. Most providers cap this at 1024. |
| 2 | newestBlock | string | Oui | The most recent block to include in the window.Défaut : latest |
| 3 | rewardPercentiles | number[] | Non | Array of percentile values (0–100) at which to sample priority fees from each block. Pass an empty array to omit reward data. |
| Type | Description |
|---|---|
| object | Object 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 |
Try it live in the BNB Smart Chain playground.
| Code | Message | Cause |
|---|---|---|
-32602 | invalid argument | blockCount is 0, out of range, or rewardPercentiles contains values outside 0–100. |
-32000 | block not found | `newestBlock` references a block that does not exist on this node. |
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.blockCount returns a hefty payload, so cap the window at roughly 100–200 blocks per request and page through longer ranges.Paramètres
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.