eth_feeHistory
Last updated
Last updated
Returns a collection of historical gas information from which you can decide what to submit as your maxFeePerGas
and/or maxPriorityFeePerGas
. This method was introduced with .
BLOCKCOUNT
- Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.
NEWESTBLOCK
- Highest number block of the requested range.
REWARDPERCENTILES
- (optional) A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.
Object
OLDESTBLOCK
- Lowest number block of the returned range.
BASEFEEPERGAS
- 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.
GASUSEDRATIO
- An array of block gas used ratios. These are calculated as the ratio of gasUsed
and gasLimit
.
REWARD
- (Optional) An array of effective priority fees per gas data points from a single block. All zeroes are returned if the block is empty.
NOTE: In this example we are using public Ethereum endpoint. Ideally, for your own projects, you should use your own endpoint, which you can generate for free by connecting to your wallet .