Avalanche
Ready to call this in production?
Free tier covers personal projects. Pay-as-you-go scales without a card.
Avalanche
Free tier covers personal projects. Pay-as-you-go scales without a card.
eth_feeHistory returns historical base fees, gas-used ratios, and priority-fee percentiles for a window of recent Avalanche C-Chain blocks. The C-Chain implements EIP-1559, so each block carries an AVAX-denominated base fee that floats with demand; this method hands you that series in one call so you can build a fee-estimation strategy for type-2 transactions. Query https://avalanche.therpc.io/YOUR_API_KEY (chain ID 43114) with a block count, a newest block, and the reward percentiles you want sampled.
maxFeePerGas and maxPriorityFeePerGas for AVAX transactions from recent percentile data.gasUsedRatio climb toward 1.0 across recent C-Chain blocks.| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockCount | string | number | Yes | Number of blocks to include in the history window. Most providers cap this at 1024. |
| 2 | newestBlock | string | Yes | The most recent block to include in the window.Default: latest |
| 3 | rewardPercentiles | number[] | No | 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 Avalanche 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 holds one more entry than the number of blocks requested: the final element is the node's prediction for the next C-Chain block, not a confirmed value.blockCount values produce large responses; with fast ~1–2s C-Chain blocks you rarely need a deep window, so cap at roughly 100–200 blocks per call and paginate if you need more.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.