<p>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.</p>

<p>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%.</p>

CC BY-SA 4.0
2019-03-02T12:43:23.480Z
2019-03-02T12:43:23.480Z
Ugam Kamat
<p>Can some one explain completely what off by one error is? how is it fixed?</p>

<blockchain><blockchain.info>
What is off-by one error in updating target? How is it fixed?
user92673
# What is off-by one error in updating target? How is it fixed?

(Asked by: username_0 on 2019-03-02)

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

**Tags:** blockchain, blockchain.info


---

## 1 answers

### Answer by username_1 on 2019-03-02. Score: 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%.


---

