CryptoNight vs. EquiHash by MinerGate Mining Pool

There have been many algorithms discussed and proposed over the years in the cryptocurrency space. There are many arguments for and against each Proof-of-Work algorithm, however, we’ll discuss two most widely known of them – CryptoNight and EquiHash.

CryptoNight

CryptoNight is a memory-bound proof-of-work algorithm created by Bytecoin (BCN) developers in cooperation with the team of developers at CryptoNote, an open-sourced protocol that allows for increased privacy in cryptocurrency transactions. This algorithm provides egalitarian terms for all users who mine CryptoNight with CPU as the main mining device.

The general idea behind this algorithm is to allocate a large block of data which would mainly be a Notepad data to RAM with an unpredictable sequence in it. The algorithm also needs to prevent internal parallelism, i.e., N simultaneous threads should require N times more memory at once. The block should be large enough to make data storage more convenient than computing it every time it is accessed.

CryptoNight relies on random access to the slow memory and emphasizes latency dependence. Each new block depends on all the previous blocks. The algorithm requires about 2 Mb per instance and follows the principles of CryptoNote listed on their website:

It fits in the L3 cache (per core) of modern processors.

A megabyte of internal memory is almost unacceptable for the modern ASICs.

GPUs may run hundreds of concurrent instances.

GDDR5 memory is slower than the CPU L3 cache and remarkable for its bandwidth, not random access speed.

“Heavy” calls in a trustless p2p network may lead to serious vulnerabilities because nodes are obliged to check every new block’s proof-of-work.

A node can be easily DDoSed by a flood of fake objects with arbitrary work data (nonce values).

Pros and Cons

The main advantages of using this algorithm are:

Smoothly decreasing emission.

Higher profitability and expediency of production.

A small time interval between blocks.

Lesser heating up of the processor and graphics card than other algorithms.

The only major disadvantage would be that memory-bound algorithms with massive scratchpads could argue that they are too big for ASICs (or equivalently that most of the ASIC cost would be a memory which is already well-optimized).

Popular Coins

At the end of 2017, the CryptoNight algorithm became sufficiently expanded for mining on GPU from AMD, it is used by such cryptocurrencies as:

EquiHash

Developed by Alex Biryukov and Dmitry Khovratovich at the University of Luxembourg, the Equihash algorithm is an asymmetric memory-orientated proof-of-work system that is based on the generalized birthday problem. Equihash is memory-orientated in that it is ‘memory-hard’, meaning that the amount of proof-of-work mining that can be done is predominantly determined by how much memory i.e. RAM that one possesses. In other words, “memory-hard” refers to a situation in which the time taken to complete a given computational problem is primarily decided by the amount of memory required to hold data.

Equihash is also described as being asymmetric. This is significant because a key feature of existing proof-of-work systems such as Bitcoin is that the proofs that are computed are difficult to prove but easy to verify. Most memory-hard schemes do not offer memory asymmetry (they are memory symmetrical), which means that a verifier must use the same amount of memory as the prover in order to validate a proof. Effectively, the verifier would have to be almost as powerful as the prover.

Biryukov and Khovratovich posit the Equihash algorithm has to possess the following properties:

Progress-free process: In order to avoid the centralization, mining must be a stochastic process, where the probability of generating a proof at any given time is independent of previous events.

Large AT cost: By requiring the computation of proofs to be memory-intensive optimizing ASIC chips for memory should come at a large cost.

Small proof size and instant verification: Proof sizes are small and verified quickly enough such that minimal memory is used on part of the verifier.

Tradeoffs: Memory requirements imposed by the Equihash algorithm are worthwhile as long as attempts to optimize for memory disproportionately penalizes the user.

Flexibility: To account for future algorithmic improvements and architecture changes, variables such as the memory must be tunable.

Pros and Cons

The main advantage that the team as focused on is to make EquiHash ASIC resistant in that its proof-of-work algorithm should be completely memory oriented. In general terms, it means that the amount of mining directly relies on the amount of memory your hardware has. The fact it allows equal contribution to the proof-of-work process means that it is known more like a democratic than a traditional SHA256 mining protocol. EquiHash also gives rise to efficient verification in the sense that it would help future light clients on constrained devices.

The only disadvantage to this algorithm is that with the advent of new and better technology in the ASIC space, it cannot remain resistant to ASIC mining for a long time.

Popular Coins using EquiHash

The EquiHash algorithm has gradually been adopted in many cryptos such as:

Where CryptoNight and EquiHash differ

CryptoNight has been vetted a lot longer than the EquiHash algorithm on account of it being in use for more than two years by the people at Monero (XMR). The Equihash algorithm was purely theoretical until its implementation in ZСash (ZEC).

CryptoNight is also more oriented towards doing 2 MB allocations, which is something that modern CPUs can cache directly, which makes it excellent for CPU mining. EquiHash, on the other hand, supports higher Sol/s with faster GPUs.

CryptoNight also claims that since GPUs and ASICs do not include the CPU memory cache so either would be very expensive or just not viable enough to make mining fair.

Where CryptoNight and EquiHash are similar

Both the algorithms are related to the memory-oriented proof of work mining philosophy.

CryptoNight and EquiHash have both been a result of the need for creating an ASIC resistant mining algorithm.

Conclusion

There is no clear winner here out of the two algorithms. On the one hand, where CryptoNight is the go-to choice for a CPU based mining, EquiHash has made a name for itself when it comes to using GPUs for mining its coins. Arguments always come down to EquiHash failing as a fair Proof-of-Work algorithm. However, development teams of both algorithms’ are working on improving them and making them as effective for mining as possible.