This algorithm is used in various altcoins to regulate difficulty. This method was first introduced in Megacoin and used to adjust the difficulty of the network every block adaptively. The logic of the algorithm is shown as follows:
KGW = 1 + (0.7084 * pow((double(PastBlocksMass)/double(144)), -1.228))
The algorithm runs in a loop that goes through a set of predetermined blocks (PastBlockMass) and calculates a new readjustment value. The core idea behind this algorithm is to develop an adaptive difficulty regulation mechanism that can readjust the difficulty in response to rapid spikes in hash rates. Kimoto Gravity Well (KGW) ensures that the time between blocks remains approximately the same. In Bitcoin, the difficulty ...