1

I have looked through all of the docs (https://etherscan.io/apis) and couldn't find how to get this from their APIs, yet they display this number in multiple places on their site. Was hoping for some guidance.

  • Hi, Etherscan shows entire data graphically till date, the hashrate of the network is shown here: etherscan.io/chart/hashrate and keep your mouse on the chart for daily reading. Thanks – Kishore Dec 7 '17 at 3:57
  • Thanks for your response. I need an API my server can call to on an interval. Manually doesn't work for my use case. – Will Christman Dec 7 '17 at 6:12
1

You can use the following EtherChain API:

https://etherchain.org/api/basic_stats

Under the stats section:

   ...
   "stats": {
        "blockTime": 15.4004,
        "difficulty": 1458229412239493.5,
        "hashRate": 109976005162231.83,
        "uncle_rate": 0.3029
    }
}
  • API still works but documentation is down (can't find it in case URL just changed) – CodingYourLife Jul 10 '18 at 10:02
0

The network hash rate is likely calculated. There does not appear to be an API for retrieving the network hash rate. Hovering over the network hash rate value on the home page says that it is averaged over the last 5000 blocks. The formula for computing the network hash rate is:

Difficulty / Avg Block Time = Hash Rate

You could estimate the Avg Block Time by using that value from your own output and see how that compares to the numbers on Etherscan.

Etherscan also provides links to CSV files for their charts at the bottom of each chart page. You could download the CSV data for the Difficulty Chart and the Average Block Time Chart and do the computation yourself or directly download the Hash Rate Growth Chart Data directly. It looks like it gets updated every 5 mins.

0

There is a not so straightforward way of getting the current difficulty from Etherscan. We will be using the GETH Parity Proxy.

Firstly, we will use the eth_blockNumber call to get the current block number. This value is given under the result property.

Next, we use the eth_getBlockByNumber to get the information regarding the current block. We will be passing in the block number from the previous step. In the response object, result.difficulty will be a hex string representing the difficulty associated with that block. Simply convert this to a decimal and we're done.

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.