What Is Crypto Mining?
- Crypto mining is a process that adds new blocks to the blockchain and issues new bitcoin into the circulating supply.
- The proof-of-work (PoW) consensus protocol sets the criteria for reaching a decentralised consensus.
- Crypto mining is costly. For their efforts, miners get block rewards in the native coin (e.g., bitcoin) and transaction fees.
Explaining Crypto Mining
Crypto is now a trillion-dollar asset class. Bitcoin, alongside the thousands of other cryptocurrencies (known as altcoins), is revolutionising the traditional financial landscape. But how do we mine bitcoin? What does it mean for miners to reach a consensus? Is now a good time to buy bitcoin? And is it profitable to mine bitcoin? In this explainer, we demystify these questions and more.
If you missed it, check out our introductory crypto explainer. It explains the concepts of blockchains, distributed ledger technology and decentralisation. We described the blockchain data structure as a collection of smaller data structures, called blocks, which we can think of as packages of transactions.
The Process of Mining Cryptocurrencies and the Consensus Protocol
As we know, each bitcoin transaction gets recorded on a public ledger, which we call the blockchain. But in the decentralised and permissionless ecosystem that bitcoin and most other cryptocurrencies reside in, how do we agree on what block should be added to the blockchain at any point in time?
You often see phrases like ‘miners validate new blocks on the blockchain’. But who decides what constitutes validation and how should it be verified? This is the purpose of a consensus protocol.
A consensus protocol is an algorithm. It determines how the network of nodes reaches a decentralised agreement on things like which blocks to add and what transactions are valid. It also prevents things like double spending (the risk that the same digital token can be spent more than once). Bitcoin uses a consensus protocol called proof-of-work (PoW).
How Hard Is Mining Crypto?
The PoW algorithm sets a computationally difficult problem that miners must solve before a new block is added to the blockchain. The problem is random in that you can only solve it by trial and error. It is difficult to solve, but the solution is easy to verify once known.
The Work in Proof-of-Work
Bitcoin uses the SHA-256 algorithm during mining. The SHA-256 algorithm is a cryptographic hash function. We encountered hash functions in our blockchain explainer – they are operations that map data of arbitrary size to encrypted values of fixed size. The key takeaways were:
- They are one-way operations so you cannot retrieve the input from a hashed output.
- The same input will always produce the same output.
- Any change to the input data will change the hashed output.
The actual mining process involves repeatedly modifying a candidate block’s hash by one number, a number only used once (nonce), and evaluating the SHA-256 function at the modified hash until the resulting hash meets a specified target. Due to the three properties above, this means the only way you can hit the target is via trial and error.
For example, the SHA-256 hash of the string of text ‘Welcome to Macro Hive!’ is a16ef826115c1efc0a85b5665a1531f2d92176d0b34f1ff2d1c86ecad7010478.
Now, let us add three different nonces (0, 1, and 2) to the end of our input string of text:
- The SHA-256 hash of ‘Welcome to Macro Hive!0’ is 2549f159c279e6d5cbc6662e2dba134ac62f4116f73cdade0d5c19ee2b87eba0
- The SHA-256 hash of ‘Welcome to Macro Hive!1’ is abeb0d9b67d527ca34bd5891bdf2d7d0a1ff50e59951c9f97a3eb98532b27b34
- The SHA-256 hash of ‘Welcome to Macro Hive!2’ is 14a52512b6791357ed02ca116e395e12e7c85725d0f78ed98b0273e7a54d4dfb
With the addition of each nonce to the end of the input string, the hash value changes completely. In the cryptocurrency framework, the input string in our simplified example is analogous to the hash of a block header (used to identify a particular block on the blockchain). And a miner adds a nonce to the end of the hash of the block header until a target is achieved.
The number of iterations needed to solve for the target is astronomical. And this is how bitcoin and other cryptocurrencies naturally ensure safety against attacks.
Once the problem has been solved by a miner, they broadcast the new block to the entire network of nodes. Those nodes can then validate the block by simply evaluating its hash against the difficulty target – i.e., validating its PoW. At that stage, the new block is added to the growing chain.
Hash Rates and a Computational Arms Race
The computational cost of solving for new blocks on the blockchain is massive. Miners with more computing power can yield solutions faster on average than those with less. Across the bitcoin network, there are hundreds of thousands of miners. And one way to measure the aggregate computing power of the network is the hash rate.
The hash rate is the number of hashes per second produced by miners in the network. To give an idea of the scale of the bitcoin network, the hash rate is currently around 180 quintillion hashes per second (180 followed by 18 zeros) (Chart 1).
The difficulty of the PoW problem increases as the hash rate increases and vice versa. That is, mining difficulty is a function of the hash rate. This ensures mining remains competitive. It has led to people investing vast amounts of money into mining rigs and high-power processors. And that creates a computational arms race as miners compete to solve for new blocks.
Is Mining Crypto Profitable? Block Rewards and Transaction Fees
Mining bitcoin has a cost. This includes an investment of time, electricity, money, and hardware. Why would anyone invest all that to solve for new blocks on the blockchain? Because of the rewards.
The bitcoin network needs to incentivise miners to keep mining. It does this through the block reward. In theory, to make any money doing this, the block rewards need to cover the cost of running the high-power mining hardware.
Miners receive block rewards in two components:
- Every time a new block is solved for on the blockchain the miner responsible receives block rewards in the native coin (e.g., bitcoin). This is the only way new bitcoins that did not previously exist are issued into the circulating supply.
- Miners also receive transaction fees paid by senders to prioritise their transactions for addition to the blockchain.
Satoshi Nakamoto (bitcoin’s anonymous inventor) designed bitcoin such that a new block is added on average every 10 minutes. The initial block reward was 50 bitcoins per block. To provide resistance to inflation, bitcoin’s block reward (i.e., the issuance rate) halves every 210,000 blocks or roughly every four years. And the total circulating supply is capped at a maximum of 21mn bitcoins.
To date, there have been three halving events: November 2012, July 2016, and May 2020. During these, the block reward decreased from 50 to 25, then from 25 to 12.5, and most recently from 12.5 to 6.25 (Chart 2). Currently, the block reward of 6.25 bitcoin is worth around $240,000. Once all 21mn bitcoin have been issued into circulation, miners will no longer receive block rewards in the native coin and will only receive transaction fees for their work.
Mining Pools
Given mining is incredibly competitive, individual miners (or commercial operations too) can combine their hashing power into a mining pool to achieve an aggregate hash rate that is more competitive. The block rewards are split between all members of the pool in proportion to each constituent miner’s contribution.
How Much Electricity Does Mining Bitcoin Use?
Quantifying how much electricity the bitcoin network consumes is hard. Various research efforts have tried to address this using several assumptions. One of the ones we track at Macro Hive is the Cambridge Bitcoin Electricity Consumption Index (CBECI).
The CBECI is a real-time estimate of the electricity demand of bitcoin miners (Chart 3). The model assumes a theoretical lower bound based on the best-case assumption that all miners always use the most efficient mining equipment available. Equally, the model assumes a theoretical upper bound based on the worst-case assumption that all miners always use the least efficient mining equipment available (though still profitable to mine with). The index value is calculated as a best-guess estimate that lies between these extremes based on the assumption that all miners use a combination of profitable hardware.
Different Methods of Mining Crypto Currencies: Mining Hardware
In the early days, mining was typically performed on general-purpose graphics processing units (GPUs) and field-programmable gate arrays (FPGAs). GPUs tend to have greater parallel processing capabilities than traditional CPUs, making them more applicable for the computationally intensive task of mining. FPGAs are hardware circuits that users can program to carry out specific workloads (e.g., for mining). Standard chips (e.g., the Intel or AMD ones you have in your personal computers) cannot be programmed or optimized for specific workloads.
The real game changer was the introduction of application-specific integrated circuits (ASICs) to the space. ASICs are an extension to FPGAs. The main difference is that they are designed for a very specific application, whereas FPGAs can be programmed and reprogrammed for multiple applications. In the mining context, an ASIC can be specialised for mining, and mining only. This gives them superior performance and efficiency over FPGAs and GPUs.
One of the most powerful mining machines today is the Bitmain Antminer S19 Pro. It is an ASIC miner designed to solve SHA-256 algorithm cryptocurrencies. Mining farms and large commercial operations will often invest in huge quantities of such machines and run them in parallel to maximise profits.
The Bottom Line
Mining is essential to PoW-based cryptocurrencies. It is a costly venture, but miners are compensated for their efforts with block rewards in the native coin (e.g., bitcoin) as well as transaction fees. In our next explainer, we will look at an alternative consensus protocol for addressing some of the shortcomings of PoW (high energy consumption and scalability issues etc.) called proof-of-stake (PoS). With bitcoins nearest competitor ethereum about to switch to PoS, the days of bitcoin dominance might be near an end.
FAQs
→ Is Crypto Mining Illegal?
In general, no. However, the legal status of crypto mining and crypto in general varies a lot from country to country. A notable example is China’s crackdown on crypto mining last year. It eventually ended in a full ban, causing huge amounts of hash (computing power) to come off the network.
→ How Long Does It Take to Mine One Bitcoin?
Satoshi Nakamoto designed bitcoin such that a new block is added to the blockchain every 10 minutes. The current block reward is 6.25 bitcoin per block added. So in theory, it would take 10 minutes to mine one bitcoin (included in the 6.25 bitcoin block reward). However, mining is a (computationally) difficult, costly, and highly competitive activity.
→ Is Crypto Mining Worth It?
It will be impractical for an individual minor with simple hardware to compete with mining farms and commercial operations that employ the latest and most efficient hardware. Instead, joining a mining pool where hundreds or thousands of miners combine their compute power can help you become more competitive.
→ Is Crypto Mining Free?
Absolutely not. Anyone can start mining bitcoin. But it requires a significant investment of time, money, and electricity, among other things, to do so. Electricity bills and the cost of the specialized mining hardware are some of the more expensive overheads that need to be factored into your calculations on whether mining will be a profitable exercise.
Dalvir Mandara is a Quantitative Researcher at Macro Hive. Dalvir has a BSc Mathematics and Computer Science and an MSc Mathematical Finance both from the University of Birmingham. His areas of interest are in the applications of machine learning, deep learning and alternative data for predictive modelling of financial markets.
Once the block reward decreases and the supply of bitcoin is more ‘limited’ would it make it more or less rewarding to mine bitcoin?
Thanks for your comment Erin. Miner profitability is sensitive to a number of factors and the block reward is one of them. It is an important factor but not the only one. It needs to be considered alongside other factors that impact profitability, including electricity prices, the exchange rate of BTC and the efficiency of the hardware being used to do the mining. If the exchange rate goes up then naturally it is more profitable for miners to mine bitcoin, the opposite is true if it goes down. This creates a dynamic mining ecosystem that changes as the value of bitcoin changes.