eth
eth_feeHistory
Returns historical gas fee data, including base fees and priority fee percentiles, for a range of recent blocks. Introduced in EIP-1559.
Returns historical gas fee data, including base fees and priority fee percentiles, for a range of recent blocks. Introduced in EIP-1559.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | string | Number of blocks in the requested range as a hexadecimal string. |
| 2 | string | The newest block in the range. A block number as a hex string, or a block tag ("latest", "earliest", "pending"). |
| 3 | array | An array of floating-point percentile values (between 0 and 100) to sample effective priority fees at for each block. |
Returns
object -- An object containing:
| Field | Type | Description |
|---|---|---|
oldestBlock | string | The oldest block number in the range (hex). |
baseFeePerGas | array | Array of base fee per gas values (hex) for each block in the range, plus the next block. |
gasUsedRatio | array | Array of gas used ratios (float) for each block. Values between 0 and 1. |
reward | array | Array of arrays containing the requested percentile priority fees (hex) for each block. |
Example
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": ["0x4", "latest", [25, 75]],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"oldestBlock": "0x18b7000",
"baseFeePerGas": [
"0x3b9aca00",
"0x3b9aca00",
"0x3b9aca00",
"0x3b9aca00",
"0x3b9aca00"
],
"gasUsedRatio": [
0.023456,
0.018732,
0.031204,
0.009871
],
"reward": [
["0x0", "0x0"],
["0x0", "0x0"],
["0x0", "0x0"],
["0x0", "0x0"]
]
}
}
TRY IT
Notes
- The
baseFeePerGasarray contains one more element than the block count because it includes the base fee for the next (pending) block. - PulseChain uses EIP-1559 fee mechanics. The base fee adjusts dynamically based on network congestion.
- The
rewardarray contains the effective priority fee (tip) at the requested percentile for each block. Blocks with no transactions may report"0x0"for all percentiles. - This method is commonly used by wallets and dApps to estimate appropriate gas prices for transactions.
- The block count is capped by the node implementation. Requesting too many blocks may be truncated.
eth_getUncleCountByBlockNumber
Returns the number of uncles in a block matching the given block number.
eth_estimateGas
Estimates the amount of gas required to execute a transaction. The transaction is not actually sent to the network. The estimate may be higher than the actual gas used because of EVM mechanics and nod
