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 created 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 called proof of work.
Also, because Bitcoin is based on blockchain technology, I’d recommend you to understand the concept of blockchain thoroughly. Because 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 watch this short video on Bitcoin mining to get an overall picture of mining.
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 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, thereby earning the block reward in new Bitcoins. This process is sometimes referred to as the lottery because winning new coins happens based on guesses that the miners make.
However, these are not simple, random guesses. Instead, they are highly educated and constrained guesses which require a lot of energy.
For each guess to be even tested, a certain amount of energy needs to spend, 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. Thus, it can add the block onto the blockchain and receive the lottery amount, the block reward.
This 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.
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 Bitcoin mining 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 there are several hundred transactions in a Bitcoin block in reality.
- Target & Difficulty
Target and difficulty of the Bitcoin network are similar things, but the difficulty is more understandable in human nature. A 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. At the same time, the 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, forming a Merkel tree with a Merkel root.
Further, this root is combined with a hash of the latest block and a nonce. 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 as per the target.
At the time of writing this article, the target 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 the target was to obtain a block hash with 8 zeros at some point in history. The target changes in tandem with the change in difficulty every 2016 block.
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 meager. Therefore, a miner must make many attempts 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 get added and updated on the universal ledger of Bitcoin called 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 the target hash, which keeps changing every 2016 block, 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.
Mining has become a niche task that requires you to 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 to 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