Author

Topic: Why difficulty change every 2016 blocks and not every 1? (Read 187 times)

legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
Now the thing I don't get is why every 2016 blocks? Why not every 1 block? The next block will have a new difficulty.
The block interval is not constant. Even with the same amount of hashpower solving the network, the time interval between blocks is still varies by a huge amount. There are certain blocks that are mined within seconds of each other as the probability of mining a block that meets the difficulty depends very heavily on luck too. The distribution of the block follows the Poisson distribution and as such, it would be better to take a sample size that is much bigger before the network adjusts its difficulty.
legendary
Activity: 2646
Merit: 6681
Self-proclaimed Genius
Read the answers of the developers themselves, first and second upvoted posts: https://bitcoin.stackexchange.com/questions/9305/why-not-retarget-on-every-block
Specially the one from 'G. Maxwell'.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
We know that every 2016 blocks the difficulty change.

That's happening because there is a new block mined every 10 minutes (on average)

This means that every 20160 minutes, 2016 blocks get mined.

After that minutes bitcoin core calculates the actual time it took to mine those 2016 blocks and divide it with the difficulty.

So new difficulty = old difficulty / actual time it took to mine 2016 blocks.

(Example with numbers: 1.11 = 20160 / 18144)

As much bigger is the number of difficulty so much smaller will be the target.
This is how target is calculated: target = targetmax / difficulty

Targetmax is a really big number. Imagine that targetmax = all the different combinations a SHA256 hash can take. It's 2^256.

Now the thing I don't get is why every 2016 blocks? Why not every 1 block? The next block will have a new difficulty.
Jump to: