Bitcoin Forum
June 26, 2024, 06:43:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why difficulty change every 2016 blocks and not every 1?  (Read 165 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1568
Merit: 7626


Protocols over bureaucrats


View Profile
April 20, 2020, 11:20:18 AM
 #1

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2450
Merit: 5735


Self-proclaimed Genius


View Profile
April 20, 2020, 11:25:24 AM
Merited by DdmrDdmr (1)
 #2

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'.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 2982
Merit: 4193



View Profile
April 20, 2020, 11:28:05 AM
 #3

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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!