How Bitcoin network hashrate is estimated

Jordan Baczuk
3 min readNov 14, 2018

Have you ever wondered how to know how much mining hashpower is currently mining Bitcoin? There is a way to estimate without knowing all of the miners and details about their equipment (hint this is practically impossible).

Quick Explanation

We know how often a block is being solved, and we can calculated the number of hashes (on average) it will take to solve a block (at the current difficulty). From this information we can estimate the total network hashrate (Hashes/second).

Script

I know you just want a script to calculate it, so here is a python script. Usage: $ btc_hashrate <blocks-24h> <current-difficulty>

Math Formulas

Let’s see how we arrive at:

Let’s say we know that in the last 24h 155 blocks have been solved, so blocks24h = 155. We also know at 10 min block times, there should be an average of blocksexpected = 144 (note this indicates the difficulty is too low, since they are being solved more quickly).

--

--