Bitcoin Forum
November 06, 2024, 09:42:34 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What's the rationale behind difficulty adjustment after every 2016 blocks?  (Read 163 times)
logfiles (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2156
Merit: 1816


Top Crypto Casino


View Profile WWW
July 02, 2021, 11:52:02 PM
 #1

I am not sure if this question has been asked here before. If it has, please you can direct me to the thread  Wink

I was curious about knowing why difficulty adjustment happens every 2016 blocks and not 2 times less (1008 blocks) or 2 times more (4,032 blocks) or even just some random number like 3000 blocks?

Why particularly 2016 blocks?

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

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


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DannyHamilton
Legendary
*
Offline Offline

Activity: 3472
Merit: 4801



View Profile
July 03, 2021, 01:18:25 AM
Merited by ABCbits (2)
 #2

I am not sure if this question has been asked here before. If it has, please you can direct me to the thread  Wink

I was curious about knowing why difficulty adjustment happens every 2016 blocks and not 2 times less (1008 blocks) or 2 times more (4,032 blocks) or even just some random number like 3000 blocks?

Why particularly 2016 blocks?

Average block time = 10 minutes.

2 weeks = 20160 minutes.

20160 / 10 = 2016 blocks.

Satoshi decided that he liked "2 weeks" as a reasonable amount of time between difficulty adjustments.  If he chose too short an amount of time, then there is risk that the natural variability of block times would have too large an effect on the adjustment.  If he chose too long an amount of time, then there is risk that a reduction in hash power would result in a VERY long wait for the next adjustment.

As far as I know, Satoshi never explained why he thought that 2 weeks was a good choice.
kxwhalexk
Member
**
Offline Offline

Activity: 98
Merit: 173


View Profile
July 03, 2021, 02:30:19 AM
 #3

I am not sure if this question has been asked here before. If it has, please you can direct me to the thread  Wink

I was curious about knowing why difficulty adjustment happens every 2016 blocks and not 2 times less (1008 blocks) or 2 times more (4,032 blocks) or even just some random number like 3000 blocks?

Why particularly 2016 blocks?
I think it’s just Satoshi Nakamoto for the convenience of calculation.

2016*10m/60m/24h=14d

One of the reasons may be that Satoshi Nakamoto’s computer computing power takes exactly 10 minutes to generate a block.

If his computer had higher computing power at the time, for example, a block was generated in 5 minutes,Maybe now it is 1008 blocks to change the computing power once

expected / actual = 20160 / actual

expected / actual = (2016 *10) / (2016 * 9) = 1.11

difficulty * 1.11 = new difficulty
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 11010


Crypto Swap Exchange


View Profile
July 03, 2021, 03:07:54 AM
Last edit: July 03, 2021, 03:28:37 AM by pooya87
 #4

If his computer had higher computing power at the time, for example, a block was generated in 5 minutes,Maybe now it is 1008 blocks to change the computing power once
It takes 10 minutes (on average) to mine a block because of the selected target. If it took less time for Satoshi to mine blocks (like 5 min) then he would have simply changed the minimum target to a different value so that it took more time.

█▀▀▀











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











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

Activity: 2590
Merit: 6337


Self-proclaimed Genius


View Profile
July 03, 2021, 03:17:36 AM
 #5

There's a reference in "difficulty" article from the Bitcoin wiki that might answer your question: https://en.bitcoin.it/wiki/Difficulty#Related_Links
The actual link: old Reddit link

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
kxwhalexk
Member
**
Offline Offline

Activity: 98
Merit: 173


View Profile
July 03, 2021, 03:34:19 AM
 #6

If his computer had higher computing power at the time, for example, a block was generated in 5 minutes,Maybe now it is 1008 blocks to change the computing power once
It takes 10 minutes (on average) to mine a block because of the selected target. If it took less time for Satoshi to mine blocks (like 5 min) then he would have simply changed the minimum target to a different value so that it took more time.
Haha, it is true after reasonable inference, but this is just a guess. After all, Satoshi is mysterious in my heart, and no one knows what he is thinking.
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 11010


Crypto Swap Exchange


View Profile
July 03, 2021, 03:54:53 AM
 #7

~
Haha, it is true after reasonable inference, but this is just a guess. After all, Satoshi is mysterious in my heart, and no one knows what he is thinking.
Well yes but you have to remember that before bitcoin was created, there were no "target" to even begin to mine a block to see how much it would take.
So at first one would write the mining code then benchmark it to see how many hashes per second it can compute using different CPUs that existed at the time, then decide on how much time one wants between the blocks and finally using these two values (hash/sec & desired time) set the target so that it takes that much time on average.

It would make very little sense to first select a random target value then see how much time it takes with your hashrate to mine that block and then set the difficulty adjustment period. It has to be the other way around.

█▀▀▀











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











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

Activity: 1694
Merit: 8324


Bitcoin is a royal fork


View Profile WWW
July 03, 2021, 06:01:36 AM
 #8

I was curious about knowing why difficulty adjustment happens every 2016 blocks and not 2 times less (1008 blocks) or 2 times more (4,032 blocks) or even just some random number like 3000 blocks?
If you chose a really shorter distance between difficulty adjustments, like every 100 blocks, you wouldn't estimate the hashrate properly. Take China as an example; the hashrate dropped by 69% within 1-3 days, but the difficulty won't be reduced that much. And it, indeed, shouldn't. That drop is clearly temporary. Once they setup their mining rigs again, the estimation for the last 2016 blocks would be properer than the last 100.

The number “2016” was Satoshi's decision. Another one could have set it to “2000” or “1008”.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
kxwhalexk
Member
**
Offline Offline

Activity: 98
Merit: 173


View Profile
July 03, 2021, 07:20:18 AM
Merited by pooya87 (1)
 #9

I was curious about knowing why difficulty adjustment happens every 2016 blocks and not 2 times less (1008 blocks) or 2 times more (4,032 blocks) or even just some random number like 3000 blocks?
If you chose a really shorter distance between difficulty adjustments, like every 100 blocks, you wouldn't estimate the hashrate properly. Take China as an example; the hashrate dropped by 69% within 1-3 days, but the difficulty won't be reduced that much. And it, indeed, shouldn't. That drop is clearly temporary. Once they setup their mining rigs again, the estimation for the last 2016 blocks would be properer than the last 100.

The number “2016” was Satoshi's decision. Another one could have set it to “2000” or “1008”.
Code:
    
    if (nActualTimespan < nTargetTimespan/4)
        nActualTimespan = nTargetTimespan/4;
    if (nActualTimespan > nTargetTimespan*4)
        nActualTimespan = nTargetTimespan*4;

Yes, the next difficulty adjustment range is 1/4--4 times the previous difficulty,There is a maximum adjustment and minimum adjustment limit.
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
July 03, 2021, 09:15:07 AM
Last edit: July 03, 2021, 03:18:48 PM by ranochigo
 #10

If you chose a really shorter distance between difficulty adjustments, like every 100 blocks, you wouldn't estimate the hashrate properly. Take China as an example; the hashrate dropped by 69% within 1-3 days, but the difficulty won't be reduced that much. And it, indeed, shouldn't. That drop is clearly temporary. Once they setup their mining rigs again, the estimation for the last 2016 blocks would be properer than the last 100.
Which is the problem. In the scenario where a drastic drop in hashrate occurs, the block interval rises quite substantially and making the difficulty epoch even longer, thus prolonging the situation. The caveat being that difficulty lags behind the actual situation quite a bit, which isn't the best for the network. Some altcoins did adopt KGW previously to deal with wild fluctuation from Multipools switching to them. Schemes like that are far more responsive but with some security tradeoff.

Ideally, the difficulty adjustment should be long enough that variance is eliminated sufficiently while still making it prohibitively expensive or difficult for possible partition attacks. Bitcoin doesn't need to change from the seemingly arbitrary number of blocks that Satoshi decided on. While we've had quite a few instances where the block interval was prolonged quite a bit, it isn't that big of an issue, mainly due to its rarity and would be more complicated to change the retargeting parameters.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
j2002ba2
Full Member
***
Offline Offline

Activity: 206
Merit: 447


View Profile
July 03, 2021, 12:07:09 PM
 #11

Why particularly 2016 blocks?

They say to get meaningful statistics from data we need at least 1000 entries. Just to be sure let's get 2000 instead. There are formulas behind all this, but probability is hard, and it's too easy to make mistakes.

Pmalek
Legendary
*
Offline Offline

Activity: 2940
Merit: 7541


Playgram - The Telegram Casino


View Profile
July 03, 2021, 04:09:07 PM
 #12

<Snip>
A difficulty adjustment like that would also depend on when during the current period the sudden drop of hashrate occurred. If it happened at the beginning and lasted for most part of the current difficulty period of 2016 blocks, the difficulty would be reduced more than if it happened in the middle and especially at the end.   

When you say temporary, do you expect the hashrate (the miners in China) to resume their operations soon or do you think the machines will move abroad and mine from somewhere else? I don't think neither of these two options will happen that fast.

▄▄███████▄▄███████
▄███████████████▄▄▄▄▄
▄████████████████████▀░
▄█████████████████████▄░
▄█████████▀▀████████████▄
██████████████▀▀█████████
████████████████████████
██████████████▄▄█████████
▀█████████▄▄████████████▀
▀█████████████████████▀░
▀████████████████████▄░
▀███████████████▀▀▀▀▀
▀▀███████▀▀███████

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 
Playgram.io
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

▄▄▄░░
▀▄







▄▀
▀▀▀░░
▄▄▄███████▄▄▄
▄▄███████████████▄▄
▄███████████████████▄
▄██████████████▀▀█████▄
▄██████████▀▀█████▐████▄
██████▀▀████▄▄▀▀█████████
████▄▄███▄██▀█████▐██████
█████████▀██████████████
▀███████▌▐██████▐██████▀
▀███████▄▄███▄████████▀
▀███████████████████▀
▀▀███████████████▀▀
▀▀▀███████▀▀▀
██████▄▄███████▄▄████████
███▄███████████████▄░░▀█▀
███████████░█████████░░
░█████▀██▄▄░▄▄██▀█████░
█████▄░▄███▄███▄░▄█████
███████████████████████
███████████████████████
██░▄▄▄░██░▄▄▄░██░▄▄▄░██
██░░░░██░░░░██░░░░████
██░░░░██░░░░██░░░░████
██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▄▄████
███████████████████████
███████████████████████
 
PLAY NOW

on Telegram
[/
Kakmakr
Legendary
*
Offline Offline

Activity: 3542
Merit: 1965

Leading Crypto Sports Betting & Casino Platform


View Profile
July 04, 2021, 02:34:52 PM
 #13

I wonder if Satoshi ever considered that 2 weeks would be enough for people to shutdown their mining farms and then relocate to another site, if something happened? We do Disaster Recovery projects at work and our goal is always to have a backup system in place, within 1 to 2 weeks after a disaster happened.

I think Satoshi also factored in how long it would take to recover from any disaster that will destroy a large percentage of the hashing power in a specific location... right? (I cannot just be a random decision that was based on math)  Roll Eyes

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1652
Merit: 1901

Amazon Prime Member #7


View Profile
July 04, 2021, 03:21:48 PM
 #14

Why particularly 2016 blocks?
It is an arbitrary number designed to coincide with the target number of blocks being produced every two weeks assuming an average block time of one per every 10 minutes.

I am not sure if satoshi conducted any kind of research or testing to conclude that 2016 blocks was the ideal difficulty time, however, he did not publish his research/testing if ihe did.

Moving forward, the reason why the difficulty period will not change is that the 2016 block period is the status quo and the status quo is not causing major problems for bitcoin.
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!