Author

Topic: Why is difficulty calculated every two weeks? (Read 1513 times)

hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
February 15, 2012, 06:09:26 PM
#8
Also, software that was using the sliding window for difficulty wouldn't be backwards compatible with older versions of Bitcoin, correct? You would have to create a secondary chain to institute a different way to calculate difficulty.

Changing it would fork the blockchain.  This can be done non-catastrophically by adding support in one version, waiting a while for everyone to upgrade, then having the change actually activate on a pre-determined block number.  People who did not upgrade or who reject the new system will reject sliding-window blocks; people who do upgrade will reject the old-style blocks; the side with >50% of the hashrate wins.  (Realistically this won't be done without a supermajority of support.)
kjj
legendary
Activity: 1302
Merit: 1026
February 15, 2012, 05:42:00 PM
#7
As far as I know, no one has ever demonstrated an actual advantage of a sliding window, but quite a few sliding window system have been found to be exploitable.
sr. member
Activity: 411
Merit: 250
February 15, 2012, 05:41:29 PM
#6
Also, software that was using the sliding window for difficulty wouldn't be backwards compatible with older versions of Bitcoin, correct? You would have to create a secondary chain to institute a different way to calculate difficulty.
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
February 15, 2012, 05:38:02 PM
#5
No, the sliding window just changes the shape of the effect.  The spike will bump difficulty sooner, but it also makes it revert sooner.  Overall the network averages it out and ends up the same number of blocks ahead or behind either way.
sr. member
Activity: 411
Merit: 250
February 15, 2012, 05:26:33 PM
#4
The hashrate estimation is noisy.  It requires a lot of smoothing.

A sliding window like you suggest would work too, but it has the same problem: short high spikes in hashrate cause the difficulty to rise then persist through the rest of the 2016-block window, making the net blockrate come out about the same in the end.

So it would work, but it wouldn't have much advantage, and the hashrate is stable enough that there's not much incentive to fool with something that works.

Isn't the current system also affected by the short high spikes? Since the difficulty is calculated on time spent finding the blocks, a short burst of activity finding blocks also affects the difficulty, but then it's locked in for the next two weeks. Would the sliding window smooth out those sorts of oddities as well? Making the window too small (such as every block) wouldn't work, as you wouldn't have enough data to calculate anything from. I'm not suggesting that we change things, since I've enjoyed how it's working, but a friend and I were wondering about this earlier today and I have not read any answer to it before.
legendary
Activity: 2114
Merit: 1031
February 15, 2012, 05:16:43 PM
#3
There have been some alternative chains that have messed with this "setting."  However, none of them have really taken hold in the economy and most still have their value dependent on bitcoin.
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
February 15, 2012, 04:41:02 PM
#2
The hashrate estimation is noisy.  It requires a lot of smoothing.

A sliding window like you suggest would work too, but it has the same problem: short high spikes in hashrate cause the difficulty to rise then persist through the rest of the 2016-block window, making the net blockrate come out about the same in the end.

So it would work, but it wouldn't have much advantage, and the hashrate is stable enough that there's not much incentive to fool with something that works.
sr. member
Activity: 411
Merit: 250
February 15, 2012, 04:31:48 PM
#1
I couldn't find an answer to this question elsewhere, and I'm assuming it's been answered before, so perhaps somebody can point me there. Why is difficulty only calculated every two weeks? This seems to cause issues either when calculating power is going up (causing blocks to be mined faster than anticipated) or when going down (causing blocks to be mined slower than anticipated). Does anybody know the rationale for going with a 2016 block window, rather than, say, a 144 block window for recalculation taking into account the last 2016 blocks for averaging purposes and to minimize abuse of the system? It also seems like the difficulty change would harm people who use bitcoin as the available hashing power drops, as their transactions will go through slower, and miners will mine fewer blocks gaining fewer rewards.

Again, sorry if this has been answered elsewhere, I couldn't find it with the search function, or with Google.
Jump to: