A person is likely to be slightly perplexed when they hear the term “mining”. Even if they have been within the cryptocurrency industry for a number of years the entire mining process might still seem a little bit complicated. Sure, they might know a little bit about it, but when they first dig into the nitty-gritty their mind starts to shut down quite quickly.
With terms such as hash rate, block reward, block halving, nodes, difficulty adjustments, double spends, 51% attacks, and blockchains – it is no wonder that the majority of people do not have a solid understanding of the mining process and how it works. One wonders how easily people get to mine any cryptocurrency.
What is the mining of bitcoin?
Mining is an integral part of the creation of new Bitcoins (and other cryptocurrencies). It is like the backbone of the entire Bitcoin network and one which is an essential process to keep the network running.
In the typical financial world, money is printed by the central banking authority. However, in the cryptocurrency world, things are a little different as new cryptocurrencies are issued through a process that is called mining.
So, what is mining for bitcoin? It starts with something that is called the blockchain.
This is a transparent ledger that records all of the transactions that have ever happened within the history of the entire Bitcoin network.
Each time a BTC is moved from one wallet to another, every transaction is logged into this blockchain and will remain there forever as the blockchain is immutable and cannot be changed by anybody. These records are ordered in a series of connected “blocks” that form one chain – hence the name.
Once a transaction is sent, it needs to be verified by the nodes on the network before it is confirmed to prevent users from being able to “double-spend” their coins and cheat the network.
Furthermore, Bitcoin mining provides security to the entire network like in the issuance of new Bitcoins through each new block that is found.
The process is carried out by high-powered computers that work together to solve computational math problems that lock the blocks on the network – this is called Proof-of-Work.
To get blocks, a miner would need a high powered machine called ASICs and a certain amount of luck which is why we use the term Bitcoin ‘mining’ as it is similar to the process of mining Gold in which, like high-powered machines, luck is also required.
To quickly summarize this, what mining Bitcoin enables are three things within the network;
- The issuance of new coins
- The confirmation of transactions
- The security of the network
Let us dive deeper into each of these features that Bitcoin mining provides.
Issuance of new coins
As mentioned earlier, the traditional fiat currency that you have in your pocket (or bank accounts) are issued by the regulated central banking authority within your country. The central bank makes decisions on how much money they would print and pump into the economy.
The big problem with this is the fact that a central bank can produce as much or as little currency as they would like. During times of recession or global pandemics such as the Coronavirus in 2020, the central banks usually print more currency to pump into the economy in order to help “kick-start” it through spending and consumption. However, when the central bank prints more currency, the value of the currency that is sitting in your bank account starts to erode.
You can see how this might cause problems for long term holders of cash. If they continue to sit on their cash it is just losing value so this forces them to put their cash into different types of assets such as real estate and stocks.
Well, the Bitcoin issuance is totally different from our traditional financial model.
Many miners are continuously providing computational power to the Bitcoin Network in order to ‘mine’ or ‘find’ new blocks to add to the blockchain.
Typically, the network difficulty (how hard it is for miners to find blocks) adjusts relative to the hash rate (how much computational power miners are providing) to reach an equilibrium in which blocks are found every 10 minutes. This is called the Bitcoin Block Time and it is hard-coded into the Bitcoin codebase to be as close to 10 minutes as possible on average.
Once a block is found, it is added to the end of the blockchain in the form of a new block.
This is where an event like magic happens.
Within this block lies a “block reward” which is given to the specific mining entity that found that specific block first. This block reward is often considered as a mining subsidy as it provides an incentive for users to mine for the network and provide security. Without this reward, miners would be handing over computational power to the network whilst eating the huge electricity and hardware costs associated with Bitcoin mining.
The block reward started off at 50 BTC per block. This meant that every 10 minutes when a block was found, 50 BTC entered into the circulating supply for Bitcoin through the miners. Typically, the miner would then send this BTC (or a proportion of it) to a cryptocurrency exchange in order to be sold as they would need to pay for their overheads, such as electricity and hardware costs, whilst mining.
However, deep within the Bitcoin underlying code lies a rule that causes the Bitcoin block reward to be halved after every 210,000 blocks are mined (on average every 4 years).
When this block halving occurs, the Bitcoin mining reward is slashed by 50%. This usually causes some of the smaller mining rigs to shut down as they become unprofitable whilst receiving half the number of BTC as rewards. The larger mining entities are positioned to survive as they usually have reserves in which they can dig into until they become profitable again. They would only become profitable if the price of BTC itself continues to rise further higher.
The first block halving occurred in November 2012 in which the mining reward was halved from 50 BTC per block to just 25 BTC per block. At this time, the price for Bitcoin was around $12. It went on to increase exactly one year after the halving by a total of 8,300% as it reached the $1,000 level.
The second halving occurred in July 2016 and the BTC block reward was slashed from 25 BTC per block to 12.5 BTC per block. Bitcoin was priced at $660 at the time of the halving. The cryptocurrency then went on to increase by a total of 286% to reach $2,550 exactly 1 year after the halving.
The third block halving happened very recently in May 2020 and this caused the block reward to be cut in half from 12.5 BTC per block to just 6.25 BTC per block.
The mining reward will continue to be distributed until the entire supply of BTC has entered into circulation. The supply is hard-capped at just 21 million BTC. This means that there will only ever be 21 million BTC in existence and there will be no new BTC available to mine once that last coin has been issued.
Confirmation of transactions
The second feature that miners provide to the network is the confirmation of transactions. Miners include transactions sent by people on the network inside each new block that they find and these are confirmed when they are included in a block on the blockchain.
When somebody makes a payment inside a store with their credit card, the bank monitors and verifies that the transaction has been completed. For cash payments, we use receipts to confirm that money has exchanged hands.
Well, in mining, the transactions are stored inside the blocks on the blockchain and are verified by other nodes on the network to ensure the validity of a transaction.
This removes the need for any sort of middle-man institution to confirm that transactions are valid and final. This is why the Bitcoin blockchain is considered to be a decentralized and trustless network that is not owned by any organization.
Nodes on the network maintain a complete record from the very first block found so any transaction can be verified in the future.
When a person sends a Bitcoin transaction, it gets put into a pool of transactions that are all waiting to be validated – known as the Memepool. The miners will gather as many transactions as they can and publish them inside any newly found block.
Once the block is found and the transactions are published, these transactions are considered to have one confirmation. Once it has this one confirmation the transaction is officially embedded into the Bitcoin network and it will remain there forever.
With each additional block that is found, the transactions in the previous block will receive additional confirmation. Typically, services require 3 confirmations for a BTC deposit to be validated as this ensures that the transaction has been verified 3 times.
For larger transactions that exceed $10,000, services usually require 6 confirmations to be made for additional security.
Security of the network
Miners are also responsible for providing security to the Bitcoin network (or whatever blockchain they are mining). The network becomes increasingly secure with the more miners that are mining at the same time. As the Bitcoin hash rate increases, the security of the network also increases.
Here is a chart of the Bitcoin hash rate from 2019 to 2020;
You can see that the hash rate has continuously been increasing up until the recent Block Halving event. This is due to the fact that some miners would have to turn off their mining rig as they become unprofitable. Typically, once the price of Bitcoin starts to increase again, more miners will enter the ecosystem which will help bring the hash rate higher.
The hashing power provides security as it prevents bad actors from being able to reverse a transaction on the Bitcoin network. To do this, the bad actor would need to have at least 51% of the mining power of the entire network.
This is what is known as a 51% attack.
If an entity manages to gather 51% of the network computation power then it would have the ability to change the blockchain and reverse any transaction that it wishes to do so whilst controlling the 51% – effectively allowing the entity to spend coins multiple times over and cheat the network.
The 51% attacker could also block other miners from mining blocks as well as stopping other users from sending transactions as they would never be confirmed.
However, when more miners are working, it makes it increasingly difficult to get to the 51% computational power required to attack the network and it would take hundreds of millions of USD in computational resources to be able to do so.
How does cryptocurrrency mining work?
So, how does all this cryptocurrency mining actually work?
Well, the process can be seen as in a competition between miners as they race to see who can find the solution to the mathematical problem and find the next block to receive the reward. Once a block is found, the race starts all over again as miners look ahead to find the next block. On average, one block is found every 10 minutes.
But what exactly do the miners have to solve?
In short, they are trying to compute a hash to unlock the next block and receive the mining reward. In Bitcoin, the miners use the SHA256 hashing function which generates a 64-digit hexadecimal number. They use this hash to unlock the next block.
It can be thought of as a bunch of computers trying to solve a very complex jigsaw puzzle. The first miner to complete the jigsaw if the one that receives the block subsidy.
To calculate the hash of the next block, the miners have to feed the current Block Number, the Nonce (an integer number of the current block), Data, and the Previous Hash of the last block – this is all handled through the Bitcoin software.
To calculate the hash, the miners use very sophisticated equipment to be able to compete with other miners. These are known as ASIC (Application Specific Integrated Circuits) devices. These ASICs are fine-tuned to be able to hash the SHA256 algorithm with the most efficient power consumption.
It was once possible to mine Bitcoin with the CPU and GPUs (graphics cards) within a personal computer. However, over time, manufacturers have engineered very specific devices that are fine-tuned to mine Bitcoin. As a result, it has pretty much driven out all GPU and CPU miners as they are unable to compete.
Is cryptocurrency mining profitable?
The profitability of cryptocurrency mining is all dependent on how much computational power can be provided to the network. The more power you dedicate to the network, the higher the chance that you will have to find a block and receive the Bitcoin reward to be profitable.
Bitcoin mining calculators can be used to easily figure out if an operation will be profitable or not. For example, the following mining calculator is taken from https://www.cryptocompare.com/;
As seen above, if a miner can produce a hashing power of around 500 TH/s then they can earn around $1000 per month. However, this is dependent on a $0.12 KWh cost for electricity with a 1500 W power consumption.
To get to 500 TH/s will cost a lot in hardware. For example, the popular ASIC called the Antminer S9 produces only around 14 TH/s and this costs around $3000 to buy. I’m sure you can do the math and see how quickly it would add up to receive the levels of profits shown above. There are many different kinds of ASIC miners available to choose from and you would need to choose one that will work for you.
As a result of the competition, miners often pool their resources to work together and form something called a ‘mining pool’.
What are the mining pools?
In mining pools, everybody combines their hashing power to work together and find the next block. Once a mining pool finds a block, the block reward is shared amongst all the miners within the mining pool relative to how much computational power they provide.
Miners choose to join pools because it helps them to find blocks more consistently and it reduces the volatility on their rewards – making it easier for them to be able to pay their electricity bills every month.
The mining pools themselves pretty much acts as a coordinator for all the members of the pool. The pool automatically manages each miner’s account and record how much hash rate is contributed individually. After each block is found, the rewards are put into a reserve until the mining pool makes the payout which usually occurs daily.
The operators of the pools will also take a fee from this reserve for their service.
Each pool has its own payment structure and it varies from pool to pool. Following is a list of the different payout structures that pools utilize;
- Pay Per Share (PPS) – The pool operator absorbs all of the risks in this payment structure and it reduces the variance for the miners. With a PPS structure, the miner is always guaranteed a payout for their contribution to the pool based on the probability that the pool finds a block. The miner always gets paid, even if the pool does not find a block. This helps to reduce the element of luck from the mining process for the individual miner.
- Proportional – Miners receive “shares” as they contribute to the hashing rate for the pool. The miner continues to receive shares until a block is found by the pool and then the miner is rewarded according to how many shares they have in that specific block. Once a new block is found, the mining shares are reset.
- Pay Per Last N Shares (PPLNS) – This is similar to proportional but when a block is found, the miner will be paid corresponding to all of the shares they have collected in previous blocks as well as the current block.
How long does it take to mine 1 bitcoin?
It is important to distinguish between mining 1 BTC yourself and finding a block.
To mine 1 BTC yourself, you would need to have an enormous amount of computational hashing rate to compete with the rest of the miners. At the same time, you would need a great amount of luck to be that miner that finds the next blocks.
On the flip side, BTC is mined every 10 minutes because this is what the Block Time dictates. The network difficulty is adjusted according to the hashing power to make it that a block is located every 10 minutes.
Once a block is found, the block reward is released to the miner who solved the problem first and this is the length of time it would take to mine one Bitcoin.
GPU vs CPU mining
Considering the fact that specialized hardware is needed to mine Bitcoin, many miners choose to mine different altcoins instead as they are able to use their CPUs and GPUs on their computers.
Whilst mining a different cryptocurrency blockchain the miner would have the ability to compete just by using the central processing unit and graphics cards on their own computer. However, even mining some of the larger altcoins has become very competitive, and sometimes it requires a GPU mining rig to become profitable. This is a collection of GPUs (graphics cards) housed in one unit like the image below;
The entire industry started with CPU mining. Miners used to be able to mine BTC using the CPU on their own home computer! However, over time, people started to shift to GPU mining, and then it involved in ASIC mining when the competition became tough.
However, just because miners cannot mine Bitcoin with the CPU on their computer does not mean that CPU mining is not relevant today.
There are a number of coins out there that strictly only allow CPU mining to be done on their blockchain. This is to make sure that the mining operation does not end up in the hands of a few single entities.
For example, Monero recently released its RandomX hashing algorithm that is preferential for computer CPU miners over GPU miners – and it does not even allow ASIC miners to enter! The problem with mining on a CPU is that it does not give a very high hashing rate. This would usually mean that mining on the CPU is likely to be unprofitable.
However, if the miner holds onto the mined coins for the longer term, and the altcoin surges, then your mining operation would have been profitable. This takes an enormous amount of research and dedication to knowing which coins will survive over a longer period.
Other CPU hashing algorithms include; CryptoNight, X11, X16Rv2, and LXR Hash.
GPU mining is also still very relevant in 2020. Coins that are ASIC resistant all tend to allow GPU miners to mine on their blockchain. For example, Ethereum can be mined right now with a GPU farm.
GPU mining farms tend to put out a higher hashing rate than a CPU can provide but a miner would need to be very careful to choose a coin that prefers GPU mining as opposed to CPU mining.
Is cryptocurrency mining legal?
This is the all-important question.
The legality of cryptocurrency mining is dependent on your local government. In the majority of the western world, holding and owning Bitcoin is completely legal. In fact, there is a regulatory framework that provides the oversight necessary to make cryptocurrency legal.
As a result, this means that mining crypto is also considered to be legal.
On the other hand, there is a number of countries that have made holding Bitcoin illegal which would mean that mining within these countries is also considered to be illegal. Furthermore, in some countries (like Russia), the law is pretty ambiguous as the government sends mixed messages about owning Bitcoin.
For example, Bitcoin is currently banned in Russia (as of mid-2020). The recent legislation to ban Bitcoin use and mining was withdrawn – sending mixed messages about the legality of the operation. As a result, mining in Russia is considered to be very high risk and could even result in jail time for such miners.
Another example where Bitcoin is banned in Ecuador. They have explicitly outlawed the production of digital currencies. Other governments such as in India have anti-Bitcoin stances but have not outright banned the ownership of the cryptocurrency assets.
It all really depends on where the mining operation is located and further research of local laws would need to be conducted for a fuller understanding of whether or not it is legal.