Improved difficulty adjustment for proof-of-work based blockchains with genetic algorithm - Chin, Zi Hau (2021)
Blocks and transactions are produced and confirmed respectively in blockchains by participating nodes through a consensus algorithm, one of which is ProofofWork (PoW). The principle of PoW is to compute a complex mathematical problem, and the complexity of this computation, is governed by the difficulty, adjusted on a periodic basis to control the rate of new block creation. This is determined by the network hash rate, and if the hash rate grows or declines exponentially, the block creation interval cannot be maintained. Genetic algorithm (GA) is proposed as an additional mechanism to the existing difficulty adjustment algorithm as a response to suppress the slow difficulty adjustment reaction due to fluctuation of hash rate caused by miners leaving or entering the network such as an attack or sudden events, by optimizing the blockchain parameters. This research aims to achieve a more dynamic difficulty adjustment mechanism that is able to meet the network objectives. Reparameterization of blockchain was performed on forks of actual Bitcoin blockchain network with virtual machines. Mining was also performed in order to measure the effects of reparameterization. Study was performed using SimBlock, a blockchain network simulator as a base. Difficulty adjustment algorithm and the capacity to increase or decrease hash rate dynamically were then added to the simulator and the efficacy of the implementation was investigated. With new implementations, SimBlock is able to more accurately simulate an actual Bitcoin blockchain network in terms of obtained block time than before especially in the case of fluctuating hash rate. Furthermore, SimBlock is now capable of reproducing the occurrence of fluctuating hash rate in an actual blockchain network. Nondominated sorting genetic algorithm II (NSGAII) is then implemented into SimBlock and simulation of different scenarios (default without GA, fixed block interval with GA, fixed difficulty adjustment interval with GA & variable block and difficulty adjustment intervals with GA) were carried out. All the scenarios with GA were able to respond more quickly to sudden increase or decrease in hash rate. This can be proven by the result of obtaining lower standard deviation of average block time and difficulty as compared to the default blockchain network without GA. Based on observation, if the block interval decreases, the stale block rate will increases accordingly as a low block interval raises the likelihood of several miners mining a valid block at the simultaneously. Moreover, an increasing stale block rate would result in a higher median block propagation time as more bandwidth was required to propagate stale blocks. Thus by finding a middle ground, the scenario of fixed difficulty adjustment interval with GA achieved the best overall performance with the lowest standard deviation of average block time and difficulty in addition to moderate median block propagation time and stale block rate.