CryptoNight For Dummies [Explained]

CryptoNight For Dummies [Explained]

CrytptoNight is a hashing algorithm that is specifically designed to be CPU friendly and prevent ASICs from entering into the network. If you have been wondering what this mining algorithm is all about and why some huge projects implement it, then I have you fully covered! 

So, What IS The CryptoNight Algorithm?

CryptoNight is a mining algorithm that was originally designed by the Bytecoin and CryptoNote teams. It was created as part of the CryptoNote suite in 2013 and its first implementation was on the CryptoNote platform.

Originally, the algorithm was structured to advocate for CPU mining whilst resisting GPU, FPGA, and ASIC mining. However, as time has developed, some implementations of CryptoNight allow for GPU mining but CPU mining still remains heavily favored.

So, CryptoNight is a memory-bound mining algorithm that relies on random access to slow memory (RAM) and emphasizes latency dependence. This helps to deny ASICs from entering the network and mining.

Why Is CryptoNight Trying To Prevent ASICs?

The CryptoNight algorithm is often considered as an egalitarian algorithm as they strive to make all participants within the network to have equal rights. 

According to the CryptoNote website, they describe the PoW mechanism as a “voting system” in which users vote for the right order of transactions, an honest money supply distribution and to enable new features on the network. Thus, the CryptoNight algorithm brings equality as the hashing function is suitable for ordinary PCs. It does this by utilizing built-in CPU instructions, which are very difficult to replicate within ASICs.

ASICs create problems for the network as they typically skew the power distribution within the network because they are specialized pieces of equipment that are tuned to produce incredibly high hash rates - something which CPU and GPU miners cannot compete with. If the hash rate starts to shift into the hands of a few players, this results in the network becoming highly centralized - this is something cryptocurrency is trying to keep away from!

ASIC stands for Application-Specific Integrated Circuit and it is basically a chip that is designed to mine a certain algorithm. This gives them a considerable advantage as GPUs and CPUs are not specifically designed to mine certain types of algorithms. Of course, anybody can buy ASICs, however, the manufacturing of ASICs is also highly centralized leading to further uncertainty about power distribution.

Making memory access a bottleneck and preventing ASICs allows for CPU and GPU miners to have a fair opportunity which will result in a stable network.

How Is CryptoNight Resistant to ASICs?

CryptoNight prevents ASICs from mining by requiring random access to memory. You see, ASICs are traditionally suited to hashing algorithms such as SHA-256 as these algorithms do not require access to memory. However, in the CryptoNight algorithm, a total of 2MB of memory is needed per instance.

The choice of requiring 2MB was based on a host of reasons that include the fact that 2MB fits into the L3 cache (per core) of modern processors making it compatible with upcoming mainstream processors. Another reason is that 1MB of internal memory is very difficult to implement into ASICs, so 2MB makes it extremely hard for ASICs to enter the industry. 

Latency dependency is also cited as another method to prevent ASICs. Latency is the length of time it takes for a calculation to be processed and for the result to return. The dependency relates to the fact that another calculation can not be performed until the result has been returned. In the case of CryptoNight, this means that each new block depends on the values of all the previous blocks.

Let us get a little deeper...this could get technical!

There are basically 3 steps to the memory bottleneck created by CryptoNight;

The first step is to create a ‘scratchpad’ which is basically a large area of memory used to store intermediate values during a hashing function. This scratchpad starts with the input data being hashed with the Keccak-1600 hashing function resulting in 200 bytes of random data.

The 200 bytes of randomly generated data then becomes a seed to generate a larger 2MB of random data. They are subjected to AES-256 encryption which is performed on 128-byte-long payloads until 2MB has been reached. Each 128-byte payload will eventually be encrypted 10 times to reach the 2MB target.

The second step is to perform numerous read/write operations (524,288 to be precise!) at a random address on the scratchpad. This is known as the ‘memory-hard’ loop. The goal of this memory-hard loop is to create the memory latency bottleneck described above.

The final step is to hash the entire scratchpad to produce the resulting value. It involves combining the original Keccak-1600 output with the whole scratchpad to help to determine the type of hashing algorithm that will be used. The hashing algorithms that may be selected are BLAKE-256, Groestl-256, HJ-256, and Skein-256. After a function has been selected, it will be used to perform the final hash and produce the resulting 256-bit hash that is the final output for the CryptoNight algorithm.


Which Coins Have Implemented The CryptoNight Algorithm?

There are a host of cryptocurrencies that have implemented the CryptoNight algorithm with the first-ever instance being CryptoNoteCoin - the reference implementation for CryptoNight. Following is a list of some projects that have already implemented the CryptoNight algorithm;

Monero (XMR) - A cryptocurrency that is primarily focused on keeping its transaction data anonymous for its users through technology such as Ring Signatures and Confidential Transactions. Monero was actually one of the first CryptoNote coins and still sits within the top 20 projects until this day!

ByteCoin (BCN) - Another privacy-focused cryptocurrency that was the actual first implementation of CryptoNight on a live blockchain.

Other projects include Boolberry (BBR), Dashcoin (DSH), DigitalNote (XDN), DarkNetCoin (DNC), and Pebblecoin (XPB)

How do you rate this article?




in for the long haul :P

Passive Income Crypto
Passive Income Crypto

My personal experiences with staking, mining and other ways of making money in crypto.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.