Source:
https://forum.megacoin.co.nz/index.php?topic=893.0The Newbie's Guide to the Kimoto Gravity Well
[1]Many of you may have heard of Kimoto's Gravity Well and that it is supposedly a major part of what makes Megacoin unique from other cryptocurrencies. However, many of you may also not know what exactly it is and what makes it so special. If that is the case, then this guide is for you.
What Is a Mining Difficulty Readjustment Algorithm, Anyway? To understand what the Gravity Well algorithm is and what it does, you first need to understand what a "mining difficulty readjustment algorithm" is and why is it important for all current cryptocurrencies based off of the original Bitcoin source code. First, let's pull a few important definitions from the Bitcoin wiki:
Difficulty Difficulty is a measure of how difficult it is to find a new block compared to the easiest it can ever be.
Difficulty Readjustment (for Bitcoin) The difficulty is adjusted every 2016 blocks based on the time it took to find the previous 2016 blocks. At the desired rate of one block each 10 minutes, 2016 blocks would take exactly two weeks to find. If the previous 2016 blocks took more than two weeks to find, the difficulty is reduced. If they took less than two weeks, the difficulty is increased. The change in difficulty is in proportion to the amount of time over or under two weeks the previous 2016 blocks took to find.
So basically, the "difficulty" of a coin determines how hard it is for miners to find and mint blocks of that coin. The more miners there are mining a coin, the faster blocks will be found and at the end of this difficulty readjustment period (approximately every two weeks for Bitcoin), the difficulty will change accordingly so that the number of coins minted will follow the intended distribution curve. This has worked well for Bitcoin (so far) because of it's extremely slow adoption rate in the early days and now because of the sheer number of miners on the network. However, this method of difficulty readjustment is flawed for new altcoins entering the market today for a number of reasons which I will discuss below.
The History of the Gravity Well Mining Difficulty Readjustment Algorithm When Megacoin first launched, it used a more traditional difficulty readjustment algorithm based off of Bitcoin's original proposal. (Author's note: I have forgotten what the original implementation was for Megacoin, but if anyone knows the details please let me know so I can put that here for perspective and history's sake.) By this time, some SHA-256 coins had already felt the pain of difficulty readjustment problems due to the influx of ASIC miners and an activity known as "pool-hopping".
If you are familiar with cryptocurrency mining at all, you may already know that in most cases, solo mining is usually impossible without extremely powerful hardware due to the large number of people now aware of cryptocurrencies and willing to mine for them. Most miners mine through pools, which provide proportional payouts of coins based on the amount of hashing power you provide to the network. This mitigates some of the risk of mining in that you receive a steady stream of coins based on your network hashing rate, so even small-time miners can still earn their share of the pie. However, as pool mining became more popular and more altcoins arrived on the market, services known as "multipools" began to appear. These were special pools that allowed miners to automatically switch to the "most profitable" coin to mine based on the current exchange rates. However, these new multipools introduced some new problems to the cryptocurrency landscape, one of those being major difficulty readjustment woes.
As Megacoin began to rise in price several months after its inception, it started to become a target for these multipools. What happens when this occurs is that suddenly the Megacoin network gets barraged by an influx of new (and very powerful) miners. This causes the block confirmation time to plummet and subsequently causes the difficulty to skyrocket at the next difficulty readjustment. When this occurs, the mining profitability also drops due to the higher difficulty which then in turn causes all of the multipool miners to leave the network in search of the next most profitable coin. What remains is an extremely high difficulty and only the "core" group of Megacoin miners left to deal with the aftermath. In extreme cases, the difficulty may be so high in proportion to the number of miners left that the entire network grinds to a halt. This has happened in the past to Terracoin and Feathercoin, among others. The only solution if this occurs is to hard fork the coin in an attempt to readjust the difficulty (or change the difficulty readjustment algorithm) or simply grind out the mining at an extremely slow pace (during which time the coin is basically unusable) until enough blocks are found to make it to the next difficulty readjustment. The more blocks required until the next difficulty readjustment, the longer this period of unusability will be, and in some cases could mean the death of the coin completely unless drastic measures are taken.
When this happened to Megacoin, Kimoto decided to come up with a better way to perform difficulty readjustment, and the result is the Kimoto Gravity Well (which is now also used as the difficulty readjustment algorithm for Anoncoin as well after it met a similar fate as that described above). And thus, we have the Megacoin we know and love today. Next I will discuss what exactly the Gravity Well does and how it works to keep mining stable and fair for all Megacoin miners and users.
Gravity Well: Explained Now that you know how the Gravity Well came to be, let's take a look at what exactly it does and how it works. At the most basic level, Kimoto has changed how difficulty readjustment works so that the difficulty is adjusted after every single block that is mined on the network. I'm not 100% sure about the exact mathematics behind the calculations, but so far since its introduction on the network the difficulty has adjusted smoothly and flawlessly no matter how many miners there are on the network and even throughout the huge price (and subsequent mining hash rate) increase we have seen over the past couple of weeks. This keeps mining fair and secure for all miners and users of the coin, and prevents the rampant multipool abuse that was (and still is) common with most all other altcoins out on the market today. This is even more important to consider when one day ASIC miners are developed for Scrypt coins and a small number of miners will suddenly have access to extremely powerful mining hardware. If and when this occurs, a malicious (or simply greedy) miner can simply point his or her ASIC miner at any Scrypt-based coin and cripple it because of the extreme difficulty fluctuation this will cause. (This is actually what happened with Terracoin after SHA-256 ASICS began to flood the market.) Megacoin, however, will be safe from this type of malicious mining behavior due to the smooth difficulty readjustment that Kimoto's Gravity Well provides.