Base
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Base
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_feeHistory returns historical base fees, gas-used ratios, and priority-fee percentiles for a window of recent blocks, which is the raw material for building EIP-1559 fee strategies. Base is Coinbase's OP Stack rollup that implements the EIP-1559 fee market and prices everything in ETH, so this method lets you set maxFeePerGas and maxPriorityFeePerGas from real recent data instead of guessing. Call it at https://base.therpc.io/YOUR_API_KEY (chain ID 8453); because Base produces a block roughly every 2 seconds, even a small window covers a fresh slice of fee conditions.
maxFeePerGas and maxPriorityFeePerGas from recent percentile data so transactions confirm without overpaying.baseFeePerGas series.gasUsedRatio climb toward 1.0 across the window.reward percentiles to land transactions ahead of competition in busy Aerodrome or Uniswap blocks.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockCount | string | number | 是 | Number of blocks to include in the history window. Most providers cap this at 1024. |
| 2 | newestBlock | string | 是 | The most recent block to include in the window.默认值: latest |
| 3 | rewardPercentiles | number[] | 否 | Array of percentile values (0–100) at which to sample priority fees from each block. Pass an empty array to omit reward data. |
| 类型 | 描述 |
|---|---|
| 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 Base playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-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 has one more entry than the block count — the last element is the node's prediction for the next Base block, not a confirmed value.blockCount values produce large responses; the cap is usually 1024, but paginate or stay around 100–200 blocks per call to keep payloads manageable.参数
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.