Last week a friend of mine asked me to explain Bitcoin mining to him in a way that a five-year-old would understand. That is when I realized that there would be so many out who don’t yet understand the concept of Bitcoin mining.
For starters, Bitcoin mining is an energy-intensive process of introducing new Bitcoins into the ecosystem.
You can think of it for a moment as new currencies creation by different governments around the world. But unlike the governments, Bitcoin’s supply is fixed and regulated by the laws of mathematics that are practically impossible to break.
Also, it is not as simple as banks printing new currency notes. Instead, a lot of work, energy-intensive, and cost acquiring is carried out before producing a single Bitcoin, which is called proof of work.
Also, considering the fact that Bitcoin is based on blockchain technology, I’d recommend you to thoroughly understand the concept of blockchain. Because if the term blockchain is alien to you, this guide might not be of great help to you.
What Is Bitcoin Mining?
Before diving into how Bitcoin mining works, I recommend you to watch this short video on Bitcoin mining to get an overall picture of what mining is.
As stated in the video, unlike printing of the fiat currency by central banks, bitcoins are mined on the Bitcoin network. Think of it like gold mining but on the internet.
And just like gold mining is cost and energy-intensive, Bitcoin mining too is intensive because it is rare and limited by the design of its own protocol.
Also, just like gold miners, Bitcoins are mined by Bitcoin miners and this mining process introduces new Bitcoins in the ecosystem.
The introduction of new Bitcoins happens when Bitcoin miners mine a valid Bitcoin block successfully thereby earning the block reward in new Bitcoins. This process is sometimes also referred to the lottery because this process of winning new coins happens based on guesses which the miners make.
However, these are not simple, random guesses. Instead, they are highly educated and constrained guesses which requires a lot of energy.
For each guess to be even tested, a certain amount of energy needs to spend, in which usually most guesses fail, wasting a lot of energy from the miner’s pocket.
Irrespective of that, every 10 minutes a miner in the world succeeds in guessing it right after a lot of energy spending and is thus allowed to add the block onto the blockchain and receives the lottery amount which is the block reward.
Which means, the miner who was able to guess a valid block must have made innumerable attempts before reaching the correct guess, in turn burning a lot of energy.
As of now, the reward for finding a valid block on Bitcoin’s network is 12.5 newly created Bitcoins.
Back in 2009, at the start of the Bitcoin network, the block reward was 50 BTC. This reward halves every 4 years to maintain inflation and reach the total supply of 21 million sometime in 2120.
This was a non-technical way of understanding what Bitcoin mining is and how it works on a higher level.
Let us now look at a more technical explanation of Bitcoin mining.
What Is Bitcoin Mining? [Explained Technically]
Before diving into Bitcoin mining I would like to explain a few terms to help you relate to what I am talking about.
- Bitcoin Hash Function
Bitcoin uses the SHA-256, a mathematical function that takes an input of any size and produces a fixed-length output every time. The generated output is referred to as a hash or Bitcoin Hash.
- Merkel Tree & Merkel Root
Merkel tree is a tree of hashes and the last hash of that tree is called the Merkel root or root hash. This is a concept in computer science and cryptography based on which Bitcoin is mined. The bitcoin block tree looks something like this after being hashed in a tree:
Note: I have only taken 4 transactions in this example but in reality, there are several hundred transactions in a Bitcoin block.
- Target & Difficulty
Target and difficulty of the Bitcoin network are similar things but difficulty is more understandable in human nature. Target is a 256-bit number (extremely large), obtained by hashing the previous block’s header in a certain way, that all Bitcoin clients share, while difficulty is a measure of how difficult it is to find a hash below or equal to a given target and is measured in hash rate.
- Bitcoin Nonce
‘Bitcoin nonce’ is a particular 32-bit (4-byte) field in the input of SHA-256 hash function whose value needs to set in a way that the hashed output contains a certain number of leading zeros which should be equal to or less than the target. And this is the field with which miners play to get the required output.
Don’t get overwhelmed in case you haven’t thoroughly understood the terms mentioned above. I will connect all the dots to show you a bigger picture that will clarify things.
But for connecting the dots, I need to refer to my explanation of Bitcoin mining in the previous section. If you remember, we discussed how the miners win the lottery by guessing the correct data that is impossible to find without spending energy.
Let us see how a miner wins this lottery.
To successfully mine a block, a miner needs to hash the block’s header in a way that it is less than or equal to the “target.”. This block header is created by hashing all the transactions in a block, thereby forming a Merkel tree with a Merkel root.
Further, this root is combined with a hash of the latest block and a nonce. Now, this raw data of Merkel Root + Previous Hash + Nonce+ Timestamp is put into an SHA-256 function to produce a certain type of hash output which is as per the target.
The target, at the time of writing this article, is that the SHA-256 hash of a block’s header must be a 256-bit alphanumeric string, and must start with 17 zeros. You can also see here that at some point in history the target was to obtain a block hash with 8 zeros. The target changes in tandem with the change in difficulty every 2016 blocks.
The miners then arrive at this particular hash (or target) by varying a small portion of the block’s headers, which is called a “nonce.” A nonce always starts with “0” and is incremented every time for obtaining the required hash (or target).
Since the varying of the nonce is hit and miss, the chances of getting this particular hash (or target), which starts with these many zeros, is very low. Therefore, many attempts must be made by a miner by varying the nonce and continuous varying of the nonce in an incremental way is called mathematically guessing the proof.
And this requires an enormous amount of computational power and hardware resources which proves that a large amount of work is carried out before mining any individual block. That’s why this is called “proof-of-work“.
And in this way, whichever miner obtains the correct Bitcoin Hash as per the target first gets the lottery and gets the block reward of 12.5 BTC.
And this way the block and the transactions present in that block gets added and updated on the universal ledger of Bitcoin called as Bitcoin’s blockchain.
To conclude this, I will show you two simplistic graphics of Bitcoin mining that will further add to your understanding. I have borrowed this from the internet.
The difficulty level decides the start of target hash, which keeps changing every 2016 blocks, roughly every two weeks.
All said and done, it might look like a fantastic idea to get you started with Bitcoin mining and earn because the network is open for anyone to join. However, Bitcoin mining has evolved a lot in the last nine years.
Initially, when there were no Bitcoin exchanges, the only way to get them was to set up a full node and start mining on your CPU until you find a valid block. That, however, is not possible anymore.
Bitcoin mining keeps on getting difficult as more miners join in to maintain the balanced generation of new coins. And over the years many miners with special GPUs and ASIC miners have joined the Bitcoin network, thereby raising the difficulty bar so high that it is no longer profitable or even possible to mine on CPUs.
Now, mining has become a niche task that requires you make hefty investments in special hardware, a lot of electricity and other cooling devices. Therefore, it is now done in data centers and big mining farms.
That is all from my side in this article. I will leave you with a video through which you can take a sneak peek into a Bitcoin mining farm and understand it better.
If you like this article don’t forget to share it with your friends and family!
For further reading:
- 5 Best Altcoins That Activated SegWit On Their Blockchain
- Here Is How You Can Accelerate Stuck Bitcoin Transactions
- Best Bitcoin Blockchain/Block Explorers
- Top 5 Bitcoin Myths That Need To Be Busted
- The 5 Most Popular Ways To Earn Bitcoin
Harsh Agrawal is the Crypto exchanges and bots experts for CoinSutra. He founded CoinSutra in 2016, and one of the industry’s most regarded professional blogger in fintech space.
An award-winning blogger with a track record of 10+ years. He has a background in both finance and technology and holds professional qualifications in Information technology.
An international speaker and author who loves blockchain and crypto world.
After discovering about decentralized finance and with his background of Information technology, he made his mission to help others learn and get started with it via CoinSutra.
Join us via email and social channels to get the latest updates straight to your inbox.