Skip to main content

eth_feeHistory

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


Method

  • JSON-RPC method name: eth_feeHistory
  • JSON-RPC version: 2.0

Parameters

NameTypeRequiredDescription
blockCountstringyesRequested range of blocks. Clients will return less than the requested range if not all blocks are available.
newestBlockoneOfyesHighest block of the requested range.
rewardPercentilesnumber[]yesA 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.

Parameter schema

{
"blockCount": {
"description": "Requested range of blocks. Clients will return less than the requested range if not all blocks are available.",
"required": true,
"schema": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
},
"newestBlock": {
"description": "Highest block of the requested range.",
"required": true,
"schema": {
"title": "Block number or tag",
"oneOf": [
{
"title": "Block number",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
},
{
"title": "Block tag",
"type": "string",
"enum": [
"earliest",
"finalized",
"safe",
"latest",
"pending"
],
"description": "`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"
}
]
}
},
"rewardPercentiles": {
"description": "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.",
"required": true,
"schema": {
"title": "rewardPercentiles",
"type": "array",
"items": {
"title": "rewardPercentile",
"description": "Floating point value between 0 and 100.",
"type": "number"
}
}
}
}

Result

  • Name: Fee history result
  • Description: Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.
  • Type: object

Result schema

{
"title": "feeHistoryResults",
"description": "Fee history results.",
"type": "object",
"required": [
"oldestBlock",
"baseFeePerGas",
"gasUsedRatio"
],
"additionalProperties": false,
"properties": {
"oldestBlock": {
"title": "oldestBlock",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "Lowest number block of returned range."
},
"baseFeePerGas": {
"title": "baseFeePerGasArray",
"description": "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.",
"type": "array",
"items": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
},
"baseFeePerBlobGas": {
"title": "baseFeePerBlobGasArray",
"description": "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.",
"type": "array",
"items": {
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$"
}
},
"gasUsedRatio": {
"title": "gasUsedRatio",
"description": "An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.",
"type": "array",
"items": {
"title": "normalized ratio",
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"blobGasUsedRatio": {
"title": "blobGasUsedRatio",
"description": "An array of block blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block.",
"type": "array",
"items": {
"title": "normalized ratio",
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"reward": {
"title": "rewardArray",
"description": "A two-dimensional array of effective priority fees per gas at the requested block percentiles.",
"type": "array",
"items": {
"title": "rewardPercentile",
"description": "An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.",
"type": "array",
"items": {
"title": "rewardPercentile",
"type": "string",
"pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$",
"description": "A given percentile sample of effective priority fees per gas from a single block in ascending order, weighted by gas used. Zeroes are returned if the block is empty."
}
}
}
}
}

Positional parameters

Parameter order:

  1. blockCount
  2. newestBlock
  3. rewardPercentiles

Errors

This method may return JSON-RPC standard errors (e.g. -32600, -32601, -32602, -32603) as well as application-specific errors.

TODO: Document method-specific error codes and conditions.