Crypto mining algorithms: how they work
A lot of modern cryptocurrencies, for example, Bitcoin, are built using PoW (Proof-of-Work) consensus algorithm. This way of building a blockchain allows you to mine cryptocurrency using mining – a special computing process, for which miners receive a reward.
Cryptocurrency mining algorithm is one of the key mechanisms that ensure the operation of PoW blockchains. With its help, information from previous block with transactions is encoded and transmitted to the next block – building the entire chain of blocks in the blockchain.
In this article, I talk in detail about mining algorithm, the principles of its operation, and consider the most well-known algorithms.
What is a cryptocurrency mining algorithm?
Cryptocurrency mining algorithm is a set of rules by which hash is calculated. Hash is a character string that serves as a link from the current block of the blockchain to the previous one and links the entire chain of blocks. To obtain a hash, special hash functions are used, for example, SHA-256 for Bitcoin, Scrypt for Litecoin and Dogecoin, Equihash for Zcash, etc.
It is important to understand that the mining algorithm and hash function are not the same thing. Mining algorithm is a set of calculation rules, and a hash function is the method by which calculations are performed. However, in cryptocurrency space, these two concepts are often used interchangeably. Later in the article, I will do the same.
Top most used mining algorithms in blockchain
There are a huge number of cryptocurrency mining algorithms. Next, I will focus only on the most popular ones.
SHA-256 – Bitcoin algorithm
SHA-256 is a hash function of the SHA-2 family of functions, developed by the US National Security Agency in 2002. Its main technical parameters are: limitation on the amount of encoded information (the number of transactions in a block is limited), irreversibility (the original data of the previous block cannot be obtained by decrypting the hash) and a limitation on the length of the resulting hash (for SHA-256 – 256 bits).
Cryptocurrencies using the SHA-256 algorithm: BTC, BCH, NMC, PZM, LCC and others.
Ethash – Ethereum Classic algorithm
Ethash was used to calculate the hash in Ethereum. After the network switched to the PoS (Proof-of-Stake) consensus algorithm in September 2022, Ethereum Classic became the main cryptocurrency with the Ethash algorithm. Ethash continues the development of the ideas of the Dagger-Hoshimoto algorithm, authored by Vitalik Buterin and Thaddeus Driya, having inherited much from its predecessor. Distinctive features of the algorithm are high requirements for RAM and support of GPUs.
Cryptocurrencies using the Ethash algorithm: ETC, CLO, QKC, EXP, WHL and others.
Scrypt – Litecoin and Dogecoin mining algorithm
Scrypt is one of the first algorithms developed in an attempt to improve and optimize SHA-256. The Scrypt algorithm belongs to the family of KDF functions (Key Derivation Function). Such algorithms generate keys (for cryptocurrencies – the hash of the previous block) based on some initial information (for cryptocurrencies – a list of transactions in the block). The main difference between Scrypt and similar functions is the high requirements for using memory of a computing device.
Scrypt is considered a less complex mining algorithm than, for example, SHA-256. It allows reduce energy consumption due to fewer hash calculation operations, works faster (for example, in the Litecoin network, a block is formed 4 times faster than in Bitcoin) and makes it possible to set lower commissions for transactions on the blockchain.
Cryptocurrencies using the Scrypt algorithm: LTC, DOGE, SYS, NLG, MONA and others.
Equihash – Zcash and Komodo mining algorithm
The Equihash algorithm is based on the process of finding solutions for a generalized birthday puzzle. The hash function was developed in 2016. Like Scrypt, Equihash is memory intensive and was considered an ASIC-resistant algorithm for some time. The hash function has several associated settings that allow developers to set the difficulty, mining time, and amount of memory needed to solve the puzzle. This way you can control the block creation time and its size.
Cryptocurrencies using the Equihash algorithm: ZEC, BTG, ZEN, KMD, BEAM and others.
X11 – Dash algorithm
The X11 algorithm was developed in 2014 to solve one of the most serious problems of PoW-based cryptocurrencies – the gradual centralization of the network by the owners of ASIC miners. X11 consists of 11 hash functions that are applied in turn and randomly to the hash value. Today, X11 is considered one of the most complex algorithms for cryptocurrency mining. There are advanced versions – X12, X13, X14 and others (the number after “X” indicates the number of hash functions used).
Cryptocurrencies using the X11 algorithm: DASH, BLU, RTM, SYNX, HYP, etc.
Cryptonight – Monero and Bytecoin mining algorithm
Cryptonight is one of the most popular mining algorithms. Developed as part of the CryptoNote algorithm, which appeared in 2012. Often chosen by developers due to its ability to resist cryptocurrency mining using ASIC miners and is optimized for mining on PC CPUs. One of the main features of Cryptonight is its speed – hash can be calculated very quickly. Although, this heavily loads the CPU cache memory.
Cryptonight uses the AES (Advanced Encryption Standard) encryption algorithm, which is considered a very secure way to encode information. Because of this, the hash function is often used in projects that place increased emphasis on privacy and security.
Cryptocurrencies using the Cryptonight algorithm: BCN, BDX, ETN, CCX, XMV and others.
RandomX – the evolution of CryptoNight
RandomX is an advanced mining algorithm created by the Monero blockchain community to counter the growing capabilities of ASIC miners. The first version appeared in 2019. The algorithm is based on the version of Cryptonight that was used to power XMR. RandomX is optimized for CPU-based cryptocurrency mining. It supports two mining modes, increased protection against unauthorized mining, uses Blake family hash functions, password generators and AES symmetric encryption. RandomX is one of the few algorithms that has been third-party audited by cybersecurity companies, confirming its reliability.
Cryptocurrencies using the RandomX algorithm: XMR, BBPP, QRL.
Mining algorithms comparison table
|Mining algorithm||Supported cryptocurrencies||ASIC-supported||Energy efficiency|
|SHA-256||BTC, BCH, NMC, PZM, LCC, etc.||Yes||Medium|
|Ethash||ETC, CLO, QKC, EXP, WHL, etc.||Yes||High|
|Scrypt||LTC, DOGE, SYS, NLG, etc.||Yes||Medium|
|Equihash||ZEC, BTG, ZEN, KMD, BEAM, etc.||Yes||Medium|
|X11||DASH, BLU, RTM, SYNX, HYP, etc.||Yes||High|
|Cryptonight||BCN, BDX, ETN, CCX, XMV, etc.||Yes||High|
|RandomX||XMR, BBPP, QRL||No||High|
Types of consensus algorithms
Consensus algorithms set the rules by which distributed network nodes determine that a new block in the blockchain can be considered true. The PoW and PoS consensus algorithms were already mentioned above in the article – these are the two main types of these algorithms. Let’s take a closer look at them.
A consensus algorithm that, in order to obtain and confirm a solution (a hash value), requires the work of calculating this hash. This allows you to close the previous block with transactions in the blockchain and get a link to it (hash), which is then written into a new block. The process of computing is called mining, and the blockchain nodes that perform the calculations are called miners. For their work, miners receive a reward in the form of cryptocurrency from the network in which they perform calculations.
PoS has become a logical development of PoW. The proof-of-stake consensus algorithm does not require hash calculations. Instead, there are validator nodes are selected within the blockchain. This nodes store a certain amount of cryptocurrency in their addresses and are constantly connected to the network. For ensuring the blockchain operates in this form, validators, like miners, receive a reward in the form of network cryptocurrency.
Mining algorithms are used in cryptocurrencies that operate using PoW consensus algorithm. There are a large number of mining algorithms, the most popular of which are SHA-256, Scrypt, X11 and its variants, Cryptonight and its variants. Algorithms differ in the types of puzzle they solve, the level of energy spent on solving the puzzle, encryption mechanisms, and many other parameters. In this case, it is necessary to distinguish between mining algorithms and consensus algorithms. The most popular consensus algorithms are PoW and PoS. Their main difference is that in PoW you need to calculate the hash value using mining algorithms.
- Select a cryptocurrency for mining;
- Set the necessary setup for its mining process;
- Select a mining method (solo, pool, cloud);
- Download (if necessary) and configure the mining software;
- Start mining.
For example, current payments in the Monero network have practically reached their minimum of 0.6 XMR per block, and in April 2024 the next BTC halving will occur (it cuts payouts in half), after which the reward to miners will decrease to 3.125 BTC per block.
At the same time, for example, the current architecture of the DOGE meme coin does not imply either restrictions on the issue of coins or a reduction in payments to miners. However, in fact, no one can guarantee that any cryptocurrency will be mined forever.