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.

    The consensus algorithm determines how blockchain nodes decide whether the data in new block is correct. And mining algorithm determines the mechanics of the computation process.

    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.

    Read also: Mining calculators.

    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.

    One of the features of the algorithm is that the calculation speed parameter in Equihash is called Sol/s (solutions per second) in contrast to the commonly used H/s (hashes per second). Nevertheless, 1 H/s = 1 Sol/s.

    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.

    Proof-of-Work (PoW)

    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.

    Proof-of-Stake (PoS)

    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.

    Conclusion

    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.

    FAQ

    Which factors should I consider when choosing a mining algorithm?
    For a potential miner, the most important factors will be energy efficiency and the range of devices that can run the algorithm (CPU, GPU, FGPA, ASIC). Energy efficiency affects the amount of electricity that will have to be spent on mining, and hardware support will determine how the chosen coin can be mined.
    What are the basic steps to start mining cryptocurrency?

    1. Select a cryptocurrency for mining;
    2. Set the necessary setup for its mining process;
    3. Select a mining method (solo, pool, cloud);
    4. Download (if necessary) and configure the mining software;
    5. Start mining.

    Will crypto mining last forever?
    Theoretically, cryptocurrency mining can last for quite a long period. Many projects incorporate a mechanism for gradually reducing payments to miners, so that the volume of rewards for mining blocks will decrease over time.

    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.

    Is cryptocurrency mining taxed as income?
    It depends on the legal regulation of mining in a particular region. For example, in France, mining income is taxed like any financial activity. The mining tax is 45% in this country. In contrast, in Malaysia, cryptocurrencies are not considered monetary assets, and therefore any income from transactions with them (including mining) is not a subject to tax.
    Agatha Redich
    Agatha Redich
    Articles author, editor
    Articles author and website editor. Works with texts for over 12 years. Among Agatha’s clients: Rossman, Zara, Bosch, ING Bank, Lexus and others. Crypto journalist since 2018. She wrote more than a hundred articles about cryptocurrencies and the crypto market. Agatha's professional credo is to reveal complex topics in an accessible and simple way.
    Read more
    Emil Rabin
    Emil Rabin
    Site expert
    Cryptocurrency expert and financial analyst. Emil has working experience in Bain and KPMG, collaborated with PayPal and Revolut, organized more than 30 educational events about blockchain and cryptocurrencies in Eastern Europe. An expert of the TGDRatings.com portal since 2022.
    Read more

    Comments (0)

    Add a comment to the article

    Other users will see your name. Your email won’t be shown.
    Clicking the button “Leave a comment” I give my consent to the processing of personal data and agreed with privacy policy.
    Your comment sent successfully!
    Now it’s on moderation and will be published after checking by our specialists.