On November 13th, Bitcoin Cash hard-forked to update its Difficulty Adjustment Algorithm (DAA). The original Bitcoin Cash EDA adjustment, intended to make sure the chain survived as a minority chain, served its purpose in keeping Bitcoin cash alive. However, large and erratic difficulty adjustments were creating large problems for both BCH and BTC. Perhaps, intentionally, as recently alleged by a former engineer, to congest the BTC network and exacerbate the small block big block debate.
The new DAA was chosen from community submissions, with a few different proposals put forth. In the end, two testing teams, Bitprim and nChain, choose Bitcoin ABC developer Amaury Sechet’s D601 algorithm. A summary of the findings was posted on the bitcoinabc.org website, stating:
BitPrim: “Tom and Amaury’s proposals are very similar in performance. Amaury’s proposal has better chances to get network consensus”
nChain: “D601 is the logical choice. D622 is 3.1% (+/- 1.2% at 95% CI) better in most instances, but there are edge cases against it. For example, a large miner can set fluctuations into the timing”
The choice of this new algorithm was perceived as rushed and egotistical by some in the community. There had been pressure to fix the algorithm in front of Bitcoin’s Segwit2x hardfork, which subsequently was called off by the NYA signatories. The announcement on the bitcoinabc.org website attempted to head off some of the predictable criticism by noting:
“In the future, consensus level changes should have more planning, as well as a process to facilitate cross-team communication. We look forward to working with other teams to define and hone that process in the months and years to come.”
And;
“We have the utmost respect for the all developers involved in the discussions, but only one algorithm could be chosen, and a timely decision was required.’
To an outsider, the community came together in the end, as the fork went successfully and is currently up and running but for success to continue, contributions from all the development teams will be crucial.
Now, let’s take a look at the winning algorithm and the possible effects in this 2-chain environment, where both chains are competing for the same SHA256 computational power.
The new DAA was tested and with the following stated objectives.
- Adjust difficulty to hash rate to target a mean block interval of 600 seconds.
- Avoid sudden changes in difficulty when hash rate is fairly stable.
- Adjust difficulty rapidly when hash rate changes rapidly.
- Avoid oscillations from feedback between hash rate and difficulty.
- Be resilient to attacks such as timestamp manipulation.
The difficulty is adjusted each block, based on the amount of work done and the elapsed time of the previous 144 blocks. To reduce miner gaming, the median value from the top 3 and bottom 3 of blocks in the 144-block set is used. These median values are approximately 144 blocks apart, and then W is defined as the cumulative work done between these two points, with T representing the total elapsed time between these two points. The T value is additionally rangebound with the minimum being .5 days, and the maximum T value equaling 2 days.
The resulting difficulty adjustment then appears as:
Wn = W * ExpectedBlockTime / T.
G = (2^256 / Wn) – 1
What does this all mean? Empirical evidence is amassing, but given the DAA specifications, the erratic periods of hash rate jumping from BTC to BCH, and back again, should be gone. This change benefits both chains as there will be a much steadier rate of producing blocks. Miners won’t be incentivized to game the system and rapidly hop between chains any longer. From a theoretical standpoint, hash power should be tied much closer the price ratio of BTC and BCH.