What is off-by one error in updating target? How is it fixed?

1

Can some one explain completely what off by one error is? how is it fixed?

user92673

Posted 2019-03-02T10:46:55.217

Reputation: 11

Answers

2

In the bitcoin blockchain, the difficulty of mining is adjusted after every 2016 blocks. If the average mining time for the last 2016 blocks was higher than 10 minutes than the difficulty is reduced so that the time readjusts to 10 minutes. While if the time to mine the last 2016 blocks was lower than 10 minutes, then the difficulty is increased.

Although the target calibration happens every 2016 blocks, because of an "off-by-one" error within the Bitcoin Core client, it is based on the total time of the previous 2015 blocks (not 2016 as it should be). Because you are now including the time for the last 2015 blocks but comparing it to 20,160 minutes (2016 x 10 minutes), this results in the target bias upward by ~0.05%.

Ugam Kamat

Posted 2019-03-02T10:46:55.217

Reputation: 5 180