L0vdL0vd

eth_feeHistory

Returns base fees, gas usage ratios and priority fee percentiles for a range of recent blocks.

Архив · Работает на любом прошлом блоке

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_feeHistory","params":[4,"0x1208a5f",[25,75]]}'

Пример ответа

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "oldestBlock": "0x1208a5c",
    "reward": [
      [
        "0x989680",
        "0x59682f00"
      ],
      [
        "0x5f5e100",
        "0x77359400"
      ]
    ],
    "baseFeePerGas": [
      "0x2ccd63223",
      "0x2e8a218e9"
    ],
    "gasUsedRatio": [
      0.6551064,
      0.35944096666666664
    ],
    "baseFeePerBlobGas": [
      "0x0",
      "0x0"
    ],
    "blobGasUsedRatio": [
      0,
      0
    ]
  }
}

Длинные массивы и hex-строки в примере сокращены.

Параметры и свой эндпоинт

Параметры

blockCountstring | numberобязательный
Number of blocks in the range, up to 1024.
newestBlockstringобязательный
Highest block of the range: hex number or tag.
rewardPercentilesarrayнеобязательный
Increasing percentiles of priority fees to sample per block, e.g. [25, 75].

Возвращает

object Fee history.

oldestBlockstring
First block of the range, hex.
baseFeePerGasarray
Base fee per block, plus the next block's.
gasUsedRatioarray
gasUsed / gasLimit per block.
rewardarray
Priority fees at the requested percentiles per block.

Когда использовать

Read base fees, block fullness and tip percentiles for a range of blocks, for fee estimation or historical gas analytics.

Как читать ответ

baseFeePerGas has one more entry than the range: the last value is the base fee of the next block.

reward[i] holds the requested percentiles of tips paid in block i.

Советы

  • With a historical newestBlock you can chart gas markets at any point in time.

Связанные методы