Never stuck again: the new BitcoiNote algorithm

BitcoiNote is a fork of Bytecoin. Our team recently released version 1.2 which solves the high load issues that caused the Bytecoin network to get stuck. Read further to find out what we did to resolve those issues.

BitcoiNote
4 min readMay 8, 2018

The new difficulty adjustment algorithm (DAA) we are introducing deals with difficulty jumps and, in combination with a new recovery algorithm, ensures that the network can not get stuck for long periods of time.

This is accomplished by adjusting the difficulty level constantly, allowing a new block to be mined. This adjustment happens if the network gets stuck for a few hours. It ensures that mining can continue without any intervention from our team. This solution is a revolutionary feature and solves an issue many coins are still struggling with. We’re proud to incorporate these features in this release of BitcoiNote.

Linearly Weighted Moving Average (LWMA) algorithm

The LWMA (by zawy12) resolves a common problem users were experiencing; difficulty levels frequently overshot after a large hashrate increase. Malicious parties could take advantage of this by launching a very large amount of hashing power to the coin for a short time, earning many blocks’ rewards in quick succession while exploiting the lag in the difficulty adjustment, and then leaving the coin once the difficulty went up, while the rest of the users then had to cope with the high difficulty that remained.

In short the LMWA works as follows to resolve this issue:

It estimates current hashrate in order to set difficulty to get the correct solvetimes by dividing the harmonic mean of the difficulties by the Linearly Weighted Moving Average (LWMA) of the solvetimes. It gives more weight to the most recent solvetimes. It is designed for small coin protection against timestamp manipulation and hash attacks. The basic equation is:
next_difficulty = harmonic_mean(Difficulties) * target_solvetime / LWMA(solvetimes)

What this means is that the issues users experienced with difficulty levels are behind us. Learn more about LMWA here. Mining BitcoiNote has just become a lot easier because of this update.

Emergency algorithm

The emergency algorithm steps in when the network is about to get stuck after a big drop in hashing power. Normally, the difficulty can only be adjusted as part of a new block, affecting future blocks. However, the first block after a big drop can already take a very long time (hours, days, even weeks), since it must still match the high difficulty that came from the large hashing power that was previously on the network. This can be fatal for the network and its users because nobody can process transactions during that time.

In the following condition we detect that something must be wrong:

Weighted average of last (window / 10) blocks plus time since last block is more than 25x the target

“Window” means the difficulty window, which is (for LMWA) configured as 60 blocks, i.e. in the above calculation at current settings it is 6 blocks + time since last.

In this situation, blocks with lower difficulty start to be accepted. Essentially, the difficulty is continuously reduced without a block being mined.

It starts at 25x the target, and the maximum reduction is at 100x the target. No further reductions are done. At that point the difficulty is ~0.45% of what it would normally be.

This effectively means that if the network gets stuck, it only takes a few hours until the lower-difficulty blocks will be accepted. This happens until the weighted average is back down low enough to ensure that the emergency modifier is no longer used.

Normally, algorithms involving timestamps in a decentralized world would raise concerns of fraud, since there is no way to verify whether a block’s timestamp is actually correct or was manipulated in order to “game” the system. However, in this case, that risk is not relevant, because the algorithm only takes effect after the network is stuck for an amount of time that is several orders of magnitude larger than the maximum accepted time discrepancy between a node’s internal clock and a block coming from another miner.

Start mining yourself: it’s super simple!

We invite you to try these new features yourself! BitcoiNote offers an extremely simple mining utility, because you can mine straight from our GUI wallet for Windows or Linux.

Get the wallet or Get the miner

We love to hear from users like you. Please share your feedback with us in our Telegram group and help us to make BitcoiNote the best coin out there.

--

--

BitcoiNote

IN PRIVACY WE TRUST. Ring signatures and unique algorithms make BitcoiNote the most private, secure and lightweight coin on the market. See www.bitcoinote.org