Understanding mining algorithms
Mining algorithms are the backbone of blockchain-based networks like Bitcoin and other protocols.
In blockchain technologymining algorithms are necessary for transaction verification and network security. A mining algorithm instructs miners’ computers to follow a set of rules to generate a valid block.
Proof-of-work (PoW) is the well-known consensus algorithm used by Bitcoin and other cryptocurrencies. In PoW, miners compete using computational power to find a specific hash value that will give them the new block. Application-specific integrated circuits (ASICs) are the specialized hardware necessary for miners to be competitive in such an energy-intensive process, but before ASICs, lower-scale CPU and GPU mining equipment was utilized by users at home.
ASIC mining primarily uses the SHA-256 hash function, which was designed by the United States National Security Agency (NSA) and published in 2001 as a data integrity standard. Bitcoin uses SHA-256 to ensure maximum security and integrity, as the slightest change to the algorithm would alter the mining hash function output.
To keep up with industrial-scale mining operations, many miners join mining pools to combine their computational power, thereby increasing the chances of successfully mining a block. Block rewards are shared proportionally based on each member’s contribution.
Choosing the mining algorithm is a crucial decision for a cryptocurrency project, as it determines the rules and requirements necessary to create and secure the blockchain network, other than how the participants are rewarded with newly minted coins. Examples of other popular mining algorithms include Ethash, used by the Ethereum blockchainand CryptoNight, used by the Monero Network.
What is the CryptoNight algorithm?
CryptoNight is one of the fastest mining algorithms and part of the CryptoNote consensus protocol.
CryptoNight is a PoW mining algorithm for CPU and GPU miningdesigned to be ASIC-resistant to prevent the centralization of mining power. It hopes to help users mine more efficiently using a combination of hashing functions, including the CryptoNight and the Keccak hash functions.
Its cryptographic hash function works around the Advanced Encryption Standard (AES), a military-level algorithm for extreme security, making CryptoNight a mining algorithm highly focused on security. Since Monero started using it as the hash algorithm for its blockchain consensus, CryptoNight’s reputation as a security algorithm has strengthened across the crypto world.
The CryptoNight algorithm’s creation is fascinating and recalls the origin of Bitcoin. Its creator — who goes by the fictitious name of Nicolas van Saberhagen — disappeared, just like the famous Satoshi Nakamoto.
Given the similarity, many believe that the two developers are the same person, with the mystery further enhanced by the spooky release date of CryptoNote, Dec. 12, 2012 (12/12/2012). CryptoNote was a security protocol and a privacy tool that promoted confidential transactions, non-linkable transactions and ring signatures.
How does the CryptoNight mining algorithm work?
CryptoNight uses the CryptoNote consensus protocol to strengthen privacy so that nobody can tell which participant in the transaction is paying and who is receiving the money.
CryptoNight is GPU-mining friendly, but its characteristics make it ideal for CPU mining. With its set of 64-bit fast multipliers for maximum speed, the CPU architecture is very efficient; moreover, the heavy use of CPU caches guarantees the best performance.
Its working process involves three main steps:
Creating a “scratchpad”
A large memory with intermediate values is stored during a hashing function. The first input data is hashed with the Keccak-1600 hashing function, resulting in 200 bytes of randomly generated data.
Encryption transformation
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.
Final hashing
CryptoNight takes the entire data set created by the AES-256 and Keccak functions in the previous step and passes it through the rest of the hash functions. Ultimately, a final hash results from the CryptoNight proof-of-work. This hash has a 256-bit extension or a total of 64 characters.
Why is CryptoNight important?
CryptoNight was designed to give CPUs and GPUs an equal opportunity to mine blocks and discourage ASIC miners’ use.
CryptoNight is important for three crucial reasons: It provides stronger privacy with untraceable transactions, its ASIC resistance feature, and scalability. Most cryptocurrencies, including Bitcoin (BTC), are all but private, as someone’s transactions and balance can be easily traced on the open-source blockchain through a public address.
On the other hand, CryptoNight was designed to satisfy more privacy-concerned users who want to execute private blockchain trades. Its creators integrated two crucial privacy tools into the algorithm to achieve maximum security and anonymity: ring signatures and stealth addresses, both developed by the Monero team.
Mitigating growing concerns around cryptocurrency centralization due to ASIC mining rigs was one crucial rationale behind the development of CryptoNight. The project’s developers focused on challenging ASIC dominance and advanced a system where GPUs and CPUs could retain their competitive edge in mining.
Scalability and high efficiency are also at the core of CryptoNight, which has its computation increased exponentially, guaranteeing greater scaling through faster transactions.
Which cryptocurrencies use the CryptoNight mining algorithm?
Bytecoin was the first cryptocurrency to apply the CryptoNote protocol to its blockchain, but its application on Monero helped the project gain more reputation and notoriety.
A number of cryptocurrencies have integrated the CryptoNight algorithm, with the first-ever example being CryptoNoteCoin, a clear reference to the CryptoNight project.
Bytecoin
Though initially committed to resisting ASIC dominance, the first CryptoNight coin that supported the project’s development announced in 2018 that it would integrate ASIC mining while keeping the algorithm to prevent security and anonymity issues.
Monero
Despite Monero no longer using CryptoNight, it was one of its strongest supporters for its stance against ASIC power. Monero inherited CryptoNight as its proof-of-work in 2014, and since then, it has slightly evolved the algorithm, creating CryptoNight-R to intentionally break compatibility with the existing ASICs.
However, an efficient ASIC-compatible CryptoNight was developed in 2017 by Bitmain, and by 2018, ASICs had rejoined the Monero network. In 2019, Monero changed its mining algorithm to RandomX, which focused on CPU mining.
Electroneum (ETN)
Electroneum utilizes the CryptoNight mining algorithm, with a notable innovation in its mobile version, allowing users to mine the cryptocurrency not only through the conventional method but also by utilizing their smartphones via a mobile miner.
Other lesser-known projects that implement the CryptoNight algorithm include Boolberry, Dashcoin, DigitalNote, DarkNetCoin and Pebblecoin. However, these projects have been exposed to malicious attacks in 2017, raising concerns around the security of their networks and the reliability of the CryptoNight algorithm.
Different variants were created for the CryptoNight algorithm, and CryptoNight Heavy is one version of the hashing algorithm. It is implemented in various cryptocurrency projects, including Ryo Currency, Sumokoin and Loki.
However, since CryptoNight Heavy relies on a trustless peer-to-peer network, it may lead to serious vulnerabilities. Since nodes must check every new block’s PoW and spend a significant amount of time evaluating every hash, they may become more vulnerable to distributed denial-of-service (DDoS) attacks, coordinated botnet-targeted activities that overwhelm a network with fake traffic.
What’s ahead for CryptoNight algorithm?
Since its inception in 2012, the CryptoNight algorithm has undergone significant changes, upgrades and slight modifications to accommodate the different cryptocurrency projects until the ultimate version created by Monero, CryptoNight-R, was introduced.
Is CryptoNight still a valid mining algorithm, or has it failed its mission to become an egalitarian tool? All the different versions had one common goal: ASIC resistance and preventing its further dominance in crypto mining.
Many believe this did not happen, and the project failed to deliver on its original stance. The Monero team stated that the failure was due to security reasons. Since the CryptoNight hash is rather expensive and time consuming to verify, it may represent a DoS risk to nodes as previously highlighted for some of CryptoNight-based cryptocurrencies.
Others think it did its best to prevent further expansion of ASIC corporate power. It was born as an egalitarian type of algorithm that could guarantee equal rights for people to mine, not only to the corporate world.
It still works as a mining tool open to everyone, even though the ASIC resistance capability is no longer feasible since the ASICs were able to adapt to successfully mine for this algorithm. Nevertheless, it can still be a good starting point for developing future cryptocurrency projects, especially for users who value privacy and fair mining.