Skip to main content
Ethereum API
Multichain API

eth_feeHistory

Summary: Transaction fee history

Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.

Parameters

blockCount string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$


newestBlock oneOf

Block number or tag

Block number string

Block number

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Block tag enum

earliest: The lowest numbered block the client has available; finalized: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; safe: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; latest: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for finalized or safe block MUST be responded to with -39001: Unknown block error

Enum:
"earliest"
"finalized"
"safe"
"latest"
"pending"

rewardPercentiles array
required

A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed.

rewardPercentile number

Floating point value between 0 and 100.

Returns

Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.
Fee history result object
required

Fee history results.

oldestBlock string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

baseFeePerGas array

An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.

hex encoded unsigned integer string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

baseFeePerBlobGas array

An array of block base fees per blob gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-4844 blocks.

hex encoded unsigned integer string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

gasUsedRatio array

An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.

normalized ratio number

normalized ratio

blobGasUsedRatio array

An array of block blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block.

normalized ratio number

normalized ratio

reward array

A two-dimensional array of effective priority fees per gas at the requested block percentiles.

rewardPercentile array

An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.

hex encoded unsigned integer string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Customize request
Parameter
Value
string
oneOf
[ 20, 30 ]
array
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "eth_feeHistory",
"params": [
"0x5",
"latest",
[
20,
30
]
],
});
Example response
{
"oldestblock": "0x10b52f",
"baseFeePerGas": [
"0x3fa63a3f",
"0x37f999ee",
"0x3e36f20a",
"0x4099f79a",
"0x430d532d",
"0x46fcd4a4"
],
"baseFeePerBlobGas": [
"0x7b7609c19",
"0x6dbe41789",
"0x7223341d4",
"0x6574a002c",
"0x7223341d4",
"0x6574a002c"
],
"gasUsedRatio": [
0.017712333333333333,
0.9458865666666667,
0.6534561,
0.6517375666666667,
0.7347769666666667
],
"blobGasUsedRatio": [
0,
0.6666666666666666,
0,
1,
0
],
"reward": [
[
"0x3b9aca00",
"0x59682f00"
],
[
"0x3a13012",
"0x3a13012"
],
[
"0x3a13012",
"0x3a13012"
],
[
"0xf4240",
"0xf4240"
],
[
"0xf4240",
"0xf4240"
]
]
}