Skip to content

Crypto Mining: the essence of proof-of-work

The Bridge

Abstract

Mining is essential to blockchain ecosystems that use the proof-of-work consensus mechanism. Bitcoin, the most popular crypto-currency, runs on a proof-of-work blockchain.

Crypto-assets mining is similar to traditional mining in many respects, as it ultimately leads to an increase in supply. There are nonetheless important differences. Crypto miners validate transactions and add new blocks to the blockchain. The more productive they become, the more difficult it is to mine the next block.

In this article, we also present the kinds of mathematical puzzles miners solve, how they perform this task and finally how the mining technology has evolved over time.

What is mining?

Crypto asset mining is analogous to real-world mining. New bitcoins are discovered through a process of mining in the same way as raw materials are discovered in the process of mining. Traditional mining requires manual labour or machine power; bitcoin mining requires computational power. As a result, both raw material and bitcoin mining have an operational cost associated with them. Finally, as with raw materials, the bitcoin supply is also finite, i.e., the more one mines, the scarcer bitcoin gets.

However, bitcoin miners act as the network’s transaction validators in addition to suppliers1 of new bitcoins. Miners verify all the transactions before including them in a block and then adding the latter to the blockchain. As miners are free to enter or exit the market, they act as decentralised clearinghouses.

The miner’s primary role is to validate transactions, bundle the transactions into a block and then append them to the blockchain. By verifying transactions and adding new blocks to the blockchain, miners earn block rewards denominated in crypto-currencies such as bitcoins for the work done2. These block rewards generate new crypto-currencies in the network according to a predetermined supply function. In the case of bitcoin, the current supply function assigns a block reward of 12.5 bitcoins for each block added to the blockchain.

Now that we have an initial idea of how mining operates in the bitcoin network, let us dig deeper into how the mining process works.

Using a game of dice to understand the mining process

Imagine a game where players must simultaneously roll five dices with the aim of obtaining a total of digits below a certain number, N. The player who obtains the number below N first wins the game. The expected time of a game is 10 minutes, which means there is a winner every 10 minutes on average. If players find ways to increase the number of throws per minutes (productivity increases), the expected time of the game becomes shorter than 10 minutes. The difficulty must increase in order to bring the expected game time back to 10 minutes. It can be done by choosing a smaller number N or adding another dice to the mix and resetting N to a different value. As the probability of finding the new number decreases, the expected number of throws to win increases. Consequently, the expected game time once again becomes 10 minutes.

In comparison with the bitcoin network, the dice throwing players are the miners. The number of throws per unit time is equivalent to the computational power (measured in hash rate). The number N is similar to the network difficulty in bitcoin mining. A bitcoin block is created approximately every 10 minutes (this is hardcoded in the bitcoin’s code, and is similar to the rules of a game). With every new block, new bitcoins are issued as a reward to the successful miner; this is how new bitcoins enter the circulating supply.

One might question why transactions are kept in blocks, and this is where the challenge lies. To avoid double-spending, it is essential to order transactions chronologically. As there is no synchronous clock in the world, it is not possible to order transactions based on one clock. Therefore, to resort to some other mechanism, transactions are bundled together in blocks, and then blocks are used to order transactions. Every block points to the previously accepted block by the network, and this is why the database is called a “blockchain”.

Step-by-step guide to mining a transaction

Understanding how transactions take place in the bitcoin network provides an insight into how mining actually works.

  1. A user authorises sending bitcoin from their wallet3. The wallet application broadcasts the transaction to the network.
  2. All unconfirmed transactions are pooled together as they wait to be placed in blocks. This collection of unconfirmed transactions is called a memory pool or mempool.
  3. Miners pick transactions from the mempool, verify them, hash4 them into what is called a Merkle root (exhibit 1), which is then added into the candidate block5 along with the hash of the previous block and other data6.
  4. This is where the process of generating a signature begins (exhibit 2). The signature is created by guessing a nonce7 through trial and error8 in order to generate a required signature for their transaction block. In other words, to obtain the required signature, miners need to keep hashing the block header with different nonces (at a hash rate speed of billions per second) until one of the miners produces a valid signature, i.e., a signature with a specific number of zeros at the beginning (the number of zeros sets the difficulty).
  5. When a miner finds the eligible signature for their block, they immediately broadcast the block to all the nodes on the network.
  6. All other nodes will check if the hash is valid, and if so, they add the block to their copy of the blockchain and move on to mining the next block.
  7. After a new block is added to the network, miners restart the mining process for the next block.

Exhibit 1: Merkle tree

Source: AMINA Research

Exhibit 2: Block addition process

Source: AMINA Research

Difficulty adjustment

Though there are similarities between bitcoin and commodity mining, there are certain differences as well. The most significant difference is the fixed rate of supply of bitcoins. If the efficiency of traditional mining equipment increases, then the mining rate also increases, and thus the estimated supply schedule is disrupted. However, if bitcoin mining becomes more efficient due to improvements in mining equipment, the network automatically increases the difficulty to mine bitcoins and vice versa. The issuing of bitcoins is therefore adjusted in line with efficiency improvements so that on average 12.5 bitcoins are added every ten minutes.

As efficiency improves, the hash rate increases and blocks are found quicker than expected. The issuing of new bitcoins needs to be controlled so as to stick to bitcoin’s predetermined supply schedule. Hence, the difficulty needs to be adjusted as the hash rate changes.

The mining difficulty is adjusted every 2,016 blocks, or roughly every two weeks9. It is adjusted in a manner that constantly keeps the average time it takes to mine a block at 10 minutes. If 2,016 blocks are mined in less than 14 days, the difficulty increases; if it takes more than 14 days to mine 2,016 blocks, then the difficulty decreases.

Development of bitcoin mining

In the early days, the hash rate of the bitcoin network was only a fraction of its current level. Mining on laptops with a good Graphics Processing Unit (GPU) was profitable as the processing power requirement was very low. As public interest in bitcoin grew, companies started building dedicated hardware to mine bitcoins, called Application Specific Integrated Circuits (ASICs). When compared to high-end laptops, ASICs are far more efficient in mining bitcoins as they have thousands of integrated circuits10 that run the hashing algorithm in parallel at incredible speeds. A typical mining rig has thousands of ASICs running in parallel.

Mining pools – The block reward is given to the miner who discovers the signature first, while individual miners with a low hash rate may not be able to find a block. Therefore, to solve this problem, individuals with low processing power pool their mining resources. These setups are known as mining pools. Whenever the network accepts a mining pool’s block, the bitcoin reward is shared among the individuals based on their resource contribution to the pool. Anybody can join a mining pool. It doesn’t matter whether you have a single small mining machine or a warehouse of thousands of mining rigs.

Conclusion

The mining process is the backbone of any proof-of-work based blockchain network. It is one of the key elements that keeps the network up and running. Miners perform two critical functions for the network: they clear and settle the transactions and supply new bitcoins to the network.

In recent times, as the bitcoin price has increased from a few cents to several thousand dollars, mining has turned into an industrial-scale operation with many big companies operating mining farms. This has increased the safety in the system, as safety and difficulty go hand in hand, and has raised questions about the energy wastage caused by mining activities. An alternative to proof-of-work and mining is proof-of-stake and staking. We will explore this topic in the next edition of the Bridge.


1They generate new bitcoins according to a predetermined supply function. ↵
2To be complete, they also receive the transaction fees. These are however very low in comparison to the block reward. ↵
3A wallet contains users’ keys. These keys are used to access users’ bitcoins in the blockchain ↵
4/sup>A hash is a string and/or number generated from an input. The resulting string or number is a fixed length, and will vary widely with small variations in input. ↵
5This is a block that a miner tries to mine in order to receive the block reward. ↵
6A block comprises the previous block hash, Merkle root hash, timestamp, difficulty, size, nonce, version and transactions. ↵
7A nonce is a variable input that is fed into the bitcoin’s hash function. ↵
8Contrary to popular belief, miners don’t solve blocks by solving complicated maths problems. They do so by sheer brute force, checking trillions of nonces per second. ↵
9Expected block time = 10 min. This translates to 144 blocks per day and 2,016 blocks every 14 days. ↵
10Integrated circuits are small electronic circuits designed on one chip to perform a dedicated function. ↵

Share this article

Authors

Yves Longchamp

Head of Research AMINA Bank AG

Saurabh Deshpande

Research Analyst B&B Analytics Private Limited

Ujjwal Mehra

Research Analyst B&B Analytics Private Limited

Subscribe to AMINA Research

Subscribe to AMINA Research for our latest perspective.

More Research

  • 09.08.2024

    /

    The Bridge

    The Quantum Threat to Blockchains

    Explore the myths surrounding quantum computing and its impact on blockchain technology and stay informed about the blockchain security.

    Read more
  • 08.08.2024

    /

    The Digital Investor

    July Jolts Crypto

    In July, the key factors driving the mixed performances in Bitcoin, Ethereum and other cryptocurrencies and SEC's stance on altcoins.

    Read more
  • 04.07.2024

    /

    The Digital Investor

    June’s Crypto Odyssey

    In June, while traditional financial markets flourished, the cryptocurrency markets faced significant challenges.

    Read more