Amid the frenzy around Bitcoin, and cryptocurrencies in general, I found that far too many people don’t actually have a clue about what it really means to “mine a bitcoin”. All most people seem to know is that it takes a lot of computing power to mine for one. So I figured it might add a certain amount of sanity to the environment if there was a real explanation of what mining means.
Here’s how things work. The entries in the Bitcoin blockchain look like one of two types:
- User A is transferring X bitcoins to User B
- The Bitcoin network grants Y bitcoins to User C
All these transactions in the blockchain are grouped together into “blocks”. Think of each block as a sheet of paper with one transaction per line. At any point of time, there is a large stack of these sheets starting with the first one, that recorded the first transactions of bitcoin. Each of these sheets is numbered and “signed”.
So what does it mean for these sheets to be “signed”?
Let’s first talk about the Magic Number. In Bitcoin world, this magic number is also called a nonce. What makes this number “magic”? This number combined with everything written on the sheet, in some sense completes a jigsaw puzzle. It is the missing piece. It takes a lot of computing power to figure out which number completes the puzzle. And it is the search for this number that miners undertake. It is important to realise that this number intimately depends on every single thing written on the sheet. If one were to change even a single character, a different number would have to be found.
Now notice the special transaction, number 132. This transaction was added to the sheet by Alfred himself. When Alfred decides to try and find the magic number, he first adds this transaction to the other ones. If instead Peter were to look for the magic number, he would have the community grant 12.5 bitcoins to him rather than to Alfred.
Finally, notice that on top of the page, we have copied over the magic number from page 466. What does this do? If someone were to change anything on page 466, the magic number on that page would have to change. That would in turn make page 467 invalid. Therefore, by adding page 467, we have now made sure that it is even harder to change page 466.
Once Alfred has calculated this magic number, he puts it on the sheet and shares a copy with everyone in the network. All recipients check that the number does in fact complete the jigsaw puzzle. Having checked this, all members effectively accept that all the transactions on page 467 are valid. They will now wait for the next sheet of transactions. Also, for the service provided by Alfred, i.e. the effort he expended in finding the magic number, the community accepts that he now has 12.5 newly mined bitcoins, which he is entitled to spend.
Why exactly 12.5 bitcoins?
That’s part of the Bitcoin protocol. This is the pre-decided amount that the community is willing to endorse. As time passes, this number will go down to 6.25… halving after every 210k sheets that are signed. This will go on until a total of 21 million bitcoins have been granted to the miners. Thereafter, there will be no new bitcoins, thus fixing the supply of bitcoins forever.
Where do the transactions come from?
Whenever a user wants to send bitcoins to another user, he effectively makes a public announcement that he is transferring X bitcoins to B. Miners (as well as all other users) listen to all such announcements. Miners, such as Alfred, then collect these transactions on a sheet and perform the steps described before.
* In fact, a user can even have multiple wallets but effectively the system doesn’t care
** Featured image credit BTC Keychain
With no new bitcoins available after 21 million, how will future puzzles be solved without any incentivization?
A very good question Mayank. Sorry, I did not talk about this detail to keep the discussion simple in the article.
But in reality, in all the transactions – say where Alice sends 5 bitcoins to Bob – the actual transaction that Alice will make will be something like:
I’m sending 4.99 bitcoins to Bob and 0.01 to whoever will “mine” this transaction.
So by including this transaction in the block when he mines it, Alfred will get this additional 0.01 bitcoins as well. Each transaction will pay this small “transaction fee” which Alfred will get in addition to the incentive. When all the bitcoins are mined, the transaction fees is all that Alfred will get.
There will be no new bitcoins available to be mined. Only the existing bitcoins will be traded like any other currency is traded.