The Simplest Difficulty Adjustment Algorithm

2024-07-30 · Ryan X. Charles

I have changed the difficulty adjustment algorithm of EarthBucks to (almost) the simplest possible algorithm. The new algorithm is as follows:

  • Determine the length of time it took to compute the previous block (real block time) comparing its timestamp to the timestamp of the block before that.
  • Determine the new difficulty by multiplying the difficulty of the previous block by the ratio of the intended block time to the real block time.
  • Cap the maximum difficulty adjustment to 4x and the minimum difficulty adjustment to 1/4x.

If not for the cap, this would be the simplest difficulty adjustment algorithm. The cap is necessary to prevent the difficulty from adjusting too quickly. The 4x figure is chosen to be the same as the cap in Bitcoin (albeit per block rather than per 2016 blocks).

This replaces the previous algorithm. I have made this change because in testing the old algorithm didn’t adjust quickly enough as the mining power changed. The new algorithm adjusts much more quickly, so it should be more tolerant of large numbers of users coming or going.


Earlier Blog Posts


Back to Blog

Home · About · Blog · Privacy · Terms
X · Telegram · Discord · reddit · GitHub
Copyright © 2024 Ryan X. Charles LLC