CryptoNight Mining Algorithm is a mining algorithm intended to be especially CPU efficient and ASIC resistant. This with the aim of allowing a greater decentralization of the mining of cryptocurrencies that apply it, but also, allowing these cryptocurrencies to offer advanced privacy and anonymity options.
One of the best known mining algorithms is CryptoNight . This mining algorithm is part of the well-known consensus protocol CryptoNote . CryptoNight uses the mining scheme of Proof of Work (PoW) for its operation, and seeks to offer a high dependence on CPU , resisting ASIC, FPGA y GPU.
Its main feature is that it is an algorithm of hash very fast. It also allows good scalability and performs a series of cryptographic tests that are extremely dependent on the cache of the CPU processors. But not only that, its core or cryptographic core works around the AES encryption algorithm, a very secure algorithm and even considered, in some versions, as military-level encryption.
All this makes CryptoNight a mining algorithm highly focused on security and that has been its main vehicle for success in the crypto world. In fact, the fact that cryptocurrency Monero Choosing it as the hash algorithm for the proof of work of the consensus of its blockchain, boosted the visibility of CryptoNight and opened a space for it in the crypto world.
Now what is the story behind CryptoNight? How does this interesting algorithm work? As always, you can get the answers to these and other questions below.
But far from the field of speculation, CryptoNote is a reality. The launch of this protocol on such a striking date (to be precise, 12/12/12) caught the attention of the crypto community. This is because CryptoNote featured advanced features that promised things like confidential transactions. In addition to non-linkable transactions, ring signatures, smaller transactions, and enhanced security.
Later in March 2013, the CryptoNight full specification, the mining algorithm that would make CryptoNote a reality. Behind this development are the developers Seigen, Max Jameson, Tuomo Nieminen, Neocortex and Antonio M. Juarez.
The CryptoNote project and its mining algorithm was initially taken over by Bytecoin (BCN) who applied it to their blockchain. But it was not until the creation of Monero (XMR) that this project began to be widely known in the crypto world.
CryptoNight works based on a series of properties that make it very friendly for GPU mining. These properties are:
It uses native AES encryption. CPUs with hardware acceleration capability for AES calculations can greatly benefit from this fact and have superior mining potential.
Using secure hash functions like Keccak and Blake-256.
It uses a set of 64-bit fast multipliers. Because of this, pure 64-bit CPU architectures are highly efficient. It is also possible to use it on CPUs of the type VLIW 128 to 512 bit, where the algorithm could take advantage of parallel mining pools by increasing performance.
Heavy use of CPU caches. CryptoNight's algorithm adjusts its cache usage to get the most out of it. In fact, the more cache the CPU has the better performance it will have.
If we look at these four pillars, we will see that they are all very CPU focused. In fact, some of those functions are much more efficient on a CPU than on any other computational structure, including ASICs. This is what allows CryptoNight to be resistant to them.
But of course, this is just the pillars and not the way the algorithm works, we'll explain that below.
Starting the hash system
CryptoNight work begins with initializing your workspace. For this CryptoNight makes use of a series of cryptographic primitives that are:
Keccak hash function, which is used as the main hash generation vehicle within the algorithm.
SHA-3 hash function. SHA-3 is a hash function derived from Keccak, and is used in conjunction with BLAKE-256, Groestl-256, JH-256 and Hank-256 to strengthen the hash generation of the CryptoNight crypto workspace.
Creation of the AES key and encryption of the Keccak hash
The most important part of the process is the creation of the AES key. This is possible during the first round of hash functions. First of all, CryptoNight takes a data input and takes it to the Keccak function. To do this, prepare a 1600-bit wide Keccak-1600 function. By comparison, Bitcoin and its SHA-256 hash function use 256-bit or 64-character words. Whereas Keccak-1600 produces much larger hashes, 1600 bits or 400 characters in their entirety, with a size of 200 bytes.
It then takes the first 31 bytes of this Keccak-1600 hash, and transforms them into the encryption key for an AES-256 algorithm, the highest value within the AES family. For this, this small piece of data is encrypted in ten rounds. The rest of the hash is encrypted using AES-256 and is also subjected to a round of 10 encryption cycles.
The rest of the information from the Keccak hash is then taken and encrypted using AES-256. This process generates a huge amount of data that is then sent to the CryptoNight workspace or scratchpad. Upon completion of this process, the CryptoNight workspace has been prepared and the hash generation cycle begins.
Final hash generation
Now the data collected by these actions feed the core or core of hash functions. As we said the main one is Keccak, which is joined by BLAKE-256, Groestl-256, JH-256 and Hank-256.
What CryptoNight does is take the entire dataset created by the AES-256 and Keccak functions in the previous step, and pass it through the rest of the hash functions. At the end you get a final hash, which is the result of CryptoNight proof of work. This hash has a 256 bit extension or a total of 64 characters.
Pros and cons of the algorithm
Highly customizable. Data such as the mining target and the difficulty can be adjusted between blocks without them posing a danger to network security.
It is focused on the CPU. This makes mining using ASICs complex and expensive to perform.
It is extremely secure at the crypto level. The use of AES-256 and the binding of encryption techniques and hash functions in a determined way ensure that a high level of security will always be obtained.
It is energy efficient and computationally speaking.
For the level of security provided, the size of CryptoNight cryptographic test results is small. This allows to maximize the number of transactions within the blocks.
Given the way CryptoNight handles information to mine blocks, there is the possibility of creating natively non-traceable transactions.to. In fact, Monero was able to build these transactions thanks to CryptoNight.
ASIC resistance capability is no longer feasible. This is because the ASICs were able to adapt to successfully mine for this algorithm.
CryptoNight is extremely complex and difficult to audit. For this reason, developers have a large complexity curve to check for possible errors in this algorithm.
The use of specific CPU instructions like AES, can lead to the algorithm being attacked from the side. There is a possibility of exploiting vulnerabilities within the processor that may break the security of the algorithm.
How much do you know, cryptonuta?
Does abandoning CryptoNight development mean it is no longer a secure algorithm?
The abandonment of CryptoNight in favor of RandomX by Monero (the main development community), will gradually make CryptoNight an unsafe algorithm. If any vulnerability or failure is discovered, it may not be corrected and instead, some projects that make use of CryptoNight will surely make the leap from other more secure and active maintenance protocols.
CryptoNight is one of the few cryptographic algorithms that has undergone large amounts of modifications throughout its history. Since the appearance of version 1, demonstrated in its whitepaper, until the creation of CryptoNight-R, the latest version of CryptoNight developed by Monero.
Despite this, the changes and new versions of CryptoNight are aimed at preventing ASIC mining from ruining the algorithm's effort to offer resistance. But each new change in structure to that end adds more complexity and more failure points. This was the main reason why its development stopped (at least from Monero, its most important member in the community).
So for the moment we can say that CryptoNight is an algorithm that has reached the peak of its evolution to prevent ASICs from exploiting this algorithm openly.
Blockchains that use the algorithm
Bytecoin (BTN) is the first blockchain to use CryptoNight. The next blockchain to use it was Monero, and in fact, it is where this algorithm has been developed the most. However, Monero has abandoned this algorithm in favor of RandomX, a complete evolution of CryptoNight that is highly ASIC resistant, and will be for at least a long time.
Another blockchain that CryptoNight uses is Electroneum (ETN), which is designed so that mobile devices can serve as full nodes and mining nodes.