# What is the formula for inferring hash rate from difficulty and block frequency?

Two parts to this question

1/ There have recently been concerns over drops in hash rate observed on sites such as blockchain.com. However, my understanding is that hash rate is inferred from the difficulty level and the block intervals. I am trying to work out the exact formula for the inference of hash rate.

I know that the average time we can expect to find a block in is calculated with the following formula:

``````average time to find a block = (difficulty * 32 ** 2)/ hash rate
``````

Would that mean that hash rate is inferred with the following formula?

``````hash rate = (difficulty * 32 ** 2)/ time interval between the last two blocks
``````

2/ I mainly want the first part answered but if you are feeling rosy today, an answer to this second part would be amazing.

Block times are Poisson distributed. I understand that this allows us to calculate the probability that block times increase to such an extent over the course of a day that it infers a 40% reduction in hash rate.

Does anyone know the exact calculation which would let us calculate this probability?

Here's some rough ideas I have about the calculation:

The following formula allows us to calculate the probability that k events take place in time period t.

``````P(k in t) = (e ** -lam)*(lam**k / k!)
where lam = (average events which can be expected to be observed per unit of time  * t)
``````

The average events which can be expected to be observed in the case of block intervals is 1 block per ten minutes so 1/10.

Let's say we have hash rate dropping 50% over the course of one day, would that imply that we are observing 288 blocks over the course of 1440 minutes?

If I am thinking about this in the correct way, this would mean the calculation is as follows:

``````P(288 blocks in 1440 minutes) = (e ** -(144)*((144**288)/288!)
``````

Not sure if this calculation is correct. But to take it further, this would calculate the small probability of exactly 288 blocks being found in 1440 minutes. But if it were possible to calculate the Poisson distribution of block intervals, we may be able to find the probability of finding greater than or equal to 288 blocks in 1440 minutes.

As you can probably tell, my understanding of the second part of the question is limited so if you have an answer to even just the fist part, that would be amazing!

• Sep 26, 2019 at 2:46

Better Late than Never. I was asking myself the same question...I thought the hash rate of the network came from Full Nodes observation on Miners...I was wrong. I was looking for this answer on Bitcoin.org, but it's on Blockchain website: https://www.blockchain.com/charts/hash-rate. Look at the methodology at the bottom of the page. Formula is Hash rate = (Difficulty*2^32)/(intervals in seconds between 2 blocks. Theoretically you know this to be 600 seconds. So the tell it as H = 2exp32 D/T..

For the second part of your answer, this is from my own inference, but within a day, we can expect a persistent shorter time of resolution per blocks, as hash speed in the long run accelerates at about 400% per year (from technological efficiencies and Mining Nodes being added), meaning about 0,45% per day. Look at Network Difficulty over time, and you see that it continuously increases Difficulty, neutralizing efficiencies, to maintain block resolution time around 10 minutes. If it did not do so, reversibility would increase making reliability of security vulnerable, weakening users confidence, whom would either seek trust signals or defect . On this you can read Nakamoto's introduction of his white paper. Many factors may affect the slowing of the Networks Hash rate. The most important is not from technology when Hash slips, but from defections (permanent or temporary) of miners associated with Price of the Bitcoin usually. With blockchain.com latest charts (data from March 18 2021)I can infer the average time of block resolution from the same formula. By doing T = (Difficulty*(2^32)/Network Hash Rate. (21.6TH*4,294967296)/157.6EH = 588.65 seconds or 9'48". I am new to this, a week or so, and am not and won't be either an investor, nor miner...but I am always very curious, like estimating the number of Miner Nodes, a statistics I cannot find anywhere. They are about 70 Million lightweight Nodes (mostly wallets), Between 8,000 to 12,000 Full Nodes...but how many Mining Nodes? At Least 1,1 Million to up to 6 Million depending of the formula you create (or I create). If someone has the answer to this, please go ahead.

The 2^32 factor in the question is inaccurate

Difficulty is not part of the blockchain. It is calculated, for people who need an increasing number to represent Target. Target decreases to make mining harder (like a golf score)

Start with Target, and a simple mathematical fact. The Target is stored in every block header. A winning block must have a header hash (double-SHA256) smaller than Target. At this point in history, we believe that SHA256 produces a random distribution of results. Target is actually a range, with a lower bound of zero

The mathematics: The average number of hashes (all miners) required to win the race is the size of the 256-bit number range ( 2^256 ) divided by the size of the target range

This states the probability of a partial hash collision using a hashing algorithm with a random distribution of results

We know the original Target for Bitcoin persisted for more than 11 months, because the rules don't allow it to be larger (easier). This is stamped in all those 32,256 blocks as 0x1d00ffff which is a 32-bit compressed representation of 0xFFFF0000000000000000000000000000000000000000000000000000

Divide that into 2^256 ... 0x0100010001 which is close to 2^32, but is actually 2^32 + 2^16 + 1. This is the average number of hashes required to find a block with a header hash smaller than the original target 0x1d00ffff

History: the original Target value is defined as Difficulty 1. Obviously, Difficulty is inversely proportional to Target. Mathematics: Difficulty = Difficulty_1_Target / current_Target
https://en.bitcoin.it/wiki/Difficulty

You can work backwards from Difficulty to the average number of hashes required to find a block

Then the hash rate per second for a 10-minute block is the average number of hashes required to find a block divided by 600, and the hash rate per second for n blocks over 24 hours is the average number of hashes required to find a block * n / 86400

These calculations are simpler using Target and ignoring Difficulty. Also, Target is stored in the blockchain. Difficulty is not