I would like to get the historical Gas (Gwei) price in hourly or minutely with safelow, Standard, fast and fastest. I am aware of the etherscan.io which gives avg gas price for a day and also ethstation which gives realtime data. I am able to get the real-time from https://www.etherchain.org/tools/gasPriceOracle. Is there a way where i can get historical prices?


You can follow this website they have provided their API as well click here

and you can get a lot of other detailed information as well


The closest you can get is using this graph of historical gas prices.

Unless somebody has been storing the data you are asking for in a database, you will not be able to retrieve it. You can, however, run the same algorithm that ethgasstation.info uses on the graph above and interpolate the data, if desired.


You can get the historical data from the Chainlink Price feeds fast gas proxy contract if you wanted to pull from an on-chain record.

You can see the history right in the contract

/** This example code is designed to quickly deploy an example contract using Remix.

pragma solidity ^0.6.7;

import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract HistoricalPriceConsumerV3 {

    AggregatorV3Interface internal priceFeed;
     * Network: Mainnet
     * Aggregator: Fast Gas / Gwei Price
     * Address: 0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C
    constructor() public {
        priceFeed = AggregatorV3Interface(0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C);

     * Returns historical price for a round id.
     * roundId is NOT incremental. Not all roundIds are valid.
     * You must know a valid roundId before consuming historical data.
     *    InValid:      18446744073709562300
     *    Valid:        18446744073709562301
     * @dev A timestamp with zero value means the round is not complete and should not be used.
    function getHistoricalPrice(uint80 roundId) public view returns (int256) {
            uint80 id, 
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.getRoundData(roundId);
        require(timeStamp > 0, "Round not complete");
        return price;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.