Exploring the options
Research was conducted on what other coins had done in similar situations. Web searches on coin forks, the reason why, and results were reviewed, and lively discussion ensued on the Strayacoin Discord channel.
Github provides a ready reference of code changes and when they were implemented on various coins. A number of coins moved to ASIC resistant algorithms or changed the difficulty adjustment
There are a myriad of different algorithms available. Some are listed below
· X11 (this means 11 different algorithms)
· Scrypt N – adaptive N factor
Alas, with popularity (coin price/incentive) comes innovation, and now all of these have ASIC’s developed. It becomes an arms race with the cryptocurrency coins sometimes forking multiple times to try to stay ahead…so why do they want to stay ahead…because they don’t want mining centralized, and they realize that for broad adoption and security, having distributed miners (using CPU or GPU’s) is the best path.
This is a recent example from Monero on their fork to avoid asics.
Currently, there are some great algorithms available, listing of some of them below
A number of coins adapted the Difficulty Algorithm. Kimoto Gravity Well (KGW) was introduced, with an average of a small number of recent historical blocks used to adapt the difficulty on every block. The current “flavor of the month” is to use an adapted version of this called Dark Gravity Wave (DGW).
Below is an excellent article on diff adjustment
With an existing chain, and many tool/wallet developments, it is critical to minimize the impact and carry forward as much as possible. In particular, the Android and IOS Wallets connect directly to the blockchain as SPV Clients (Secure Payment Verification). This means that they also validate the blocks presented to them, rejecting blocks and nodes that present invalid blocks (considered invalid by the rules embedded in their codebase). This must be considered so those platforms are upgraded at the same time if necessary.
Moving forward with a consensus of path has been the most difficult task, with many opinions on which algorithm or difficulty adjustment is best. The following tests were identified as being easy to implement, while testing the necessary elements required.
Introducing SCRYPT-NAH (Non-ASIC-Hash)
Scrypt-NAH is a newly developed Hash function (by David Higgins and David Gilbert) based on Scrypt, so it has the same randomizing hash performance and close to the same speed of calculations/second. After the standard Scrypt hash function is calculated, the output is scrambled before passing to the Difficulty Check. This function will be ASIC and GPU resistant, especially if the scrambling method is not disclosed, requiring extensive reverse engineering to figure out what is going on.
It has been chosen because there are minimal changes to the existing codebase, which would be required not only in the strayacoin-qt, but also the Android and IOS wallets.
To test this algorithm, the Difficulty must be reset to the Genesis Difficulty, then the integrated CPU miner uses the hash function in the straya-core software iteratively to find the Nonce.
The following three test scenarios have been decided on
1. Scrypt-NAH with diff reset to genesis diff
2. Scrypt-NAH / DGW - with diff reset to genesis diff
3. DGW - working down from existing diff, no reset
Forking an existing blockchain requires careful planning to ensure that any updates to the codebase are controlled in a test environment. Fortunately, live, on main-net testing can be conducted, because the blockchain actually protects itself from “attacks” with consensus of the rules being maintained among the peers, and banning of peers who don’t follow the rules.
The only requirement is that the updated strayacoin-qt software is limited in distribution so it doesn’t take over the majority of nodes through installs.
The Strayacoin core software Tests
Strayacoin is developed in C++ (pronounced CPlusPlus), and cross compiled for Windows on Ubuntu Linux 14.04. Below shows that we are able to compile the existing code and build the distribution zip file.