Last week my friend asked me to explain Bitcoin mining to him like he is five and that time I realized that there would be many people just like my friend who don't yet understand Bitcoin mining.
So that's why I decided to sit down today and pen down Bitcoin mining for you in such simplistic way that you may not find anywhere.
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, governments Bitcoin's supply is fixed and regulated by the laws of mathematics that are practically infeasible to break. Also, it is not as easy as central banks just printing new currency notes. Instead, a lot of work which is energy intensive and cost acquiring is carried out before producing a single Bitcoin. (This work is called proof of work)
But if you know that Bitcoin is based on Blockchain technology that's why I recommend you to go through the concept of blockchain if you have not gone through it already otherwise this guide might not help you fully in understanding the full concept of 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 said in the video too that unlike fiat printing of money by central banks, bitcoins are mined on the Bitcoin network. Think of it just like Gold mining but on the internet.
And just like Gold mining is cost and energy intensive Bitcoin mining is too intensive because Bitcoin is rare and limited by the design of its protocol itself.
Also, just like Gold miners, bitcoins are mined by Bitcoin miners and this mining process introduces new bitcoins in the system.
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 lottery because this process of winning new coins happens based on guesses which the miners make.
But mind you, these are not simple random guesses instead they are highly educated and constrained guesses which require a lot of energy to be spent before guessing them right.
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 miner's pocket.
But irrespective of that every 10 minutes some 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.
So this means anyone who was able to a valid block must have done several hit and trials before reaching the correct guess which means he/she must have, certainly burnt energy for all the guesses. And this called proof of work and as a reward for burning their energy miners get the block reward in the form of bitcoins which they can later sell or HODL at the current market price.
As of now the reward for finding a valid block on Bitcoin's network is 12.5 newly created bitcoins and at the start of Bitcoin network in 2009, the block reward was 50 BTC. This reward halves every 4 years to maintain inflation and reach the total supply of 21 million somewhere in 2120.
So, this was a non-technical way of understanding what Bitcoin mining is and how it works on a high level.
That's why now let us dwell on a more technical explanation of Bitcoin mining.
What Is Bitcoin Mining? [Explained Technically]
Before diving into Bitcoin mining I would like to tell about following terms so that it becomes very easy for you to relate to what I am talking about.
Bitcoin Hash Function
Bitcoin uses SHA-256 hashing function which is a mathematical function that takes an input of any size and every time produces a fixed length output. This output is called 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 here but in reality, there are several hundred transactions in a Bitcoin block.
Target & Difficulty
Target and difficulty of Bitcoin network in a way are the same things but the difficulty is more understandable in human nature. A target is a 256-bit number (extremely large) that all Bitcoin clients share which obtained by hashing the previous block's header in a certain way. And Difficulty is a measure of how difficult it is to find a hash below or equal to a given target and this difficulty 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 such a way that the hashed output will contain a certain number of leading zeros which should be equal to or less than the target. And this the filed with which miners play to get the required output.
For now, don't get overwhelmed if have you not understood all the above terms because in a while I will connect all the dots to show you the bigger picture that will clarify everything.
But for connecting the dots, I need to refer to my explanation of Bitcoin mining in the previous section. If you remember, there we discussed how the miners win the lottery by guessing the correct data that is impossible to be found without spending energy.
So let us see how a miner wins this lottery…
To successfully mine a block, a miner needs to hash the block's header in such a way that it is less than or equal to the "target.". And this block header is made 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 previous latest block and a nonce. So 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 as the difficulty change every 2016 blocks.
And the miners 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 first obtains the correct Bitcoin Hash as per the target 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.
Conclusion
To end with I will show you with two simplistic graphics of Bitcoin mining that will further add to your understanding. I have borrowed this from a internet for you all!
Difficulty level decides the start of target hash, which keeps changing every 2016 blocks that are about in every two weeks.
So when all said and done, it might be looking a fantastic idea to you to get started with bitcoin mining and earn because the network is open for anyone to join. However, Bitcoin mining has evolved a lot in last 9 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 but that is not possible now.
Bitcoin mining keeps on becoming 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 hence making difficulty so hight that it no longer profitable or even possible to mine on CPUs.
Now, mining has become a niche task that requires you do a hefty investment in special hardware, a lot of electricity and cooling devices. So that's why now this is almost done everywhere in data centers and big mining farms.
That's why until you are ready to become a miner, keep working hard in your current profession, HODL Bitcoin and stay tuned to CoinSutra to keep learning more about the Bitcoin revolution.
So that's all from my side in this article. I will leave you with a video through which you can sneak peek into a Bitcoin mining farm to see it for yourself.
If you liked this article don't forget to share it with your friends and family!
No comments:
Post a Comment