This article is the continuation of Supply and Semi-anonymity of the Bitcoin
Let’s play Poker
To understand the system of Bitcoin and the way it works, let’s take an example of a game we all know. Imagine you are playing poker with your friends, but none of you has the poker chips or cash to play. So a few of you decided to use some papers & pens and started writing down who bets: how much, who wins and who loses. You don’t trust anyone completely, so everyone keeps their recordings separately and at the end of every round you all compare what you have written down. So that if someone tries to cheat or makes mistakes that action is caught. After a couple of rounds, you might fill up a page of your notebook with notes about the money movement. Each completed page in the Bitcoin network is basically a block of transaction. Eventually, your notebook will have a chain of those blocks. Hence it is known as Blockchain!
But, if hundreds of thousands of people are individually maintaining the Bitcoin blockchain, how are all these ledgers kept in sync? Going back to our poker analogy, consider the entire Bitcoin peer-to-peer network as a huge poker table with millions of people. Some are exchanging money, and a lot of volunteers are maintaining these transaction ledgers. So essentially when you want to send or receive Bitcoins, you will have to announce it to everyone at the table, so the people keeping track of the transactions can update their ledgers. For every transaction you do, you are announcing a couple of things to the entire Bitcoin network. One being your Account Number and the Account Number of the person you are sending Bitcoins to, and the other is the number of Bitcoins you want to send. All of the volunteers keeping copies of the blockchain will update their current block by adding your transaction to it.
Security through Cryptography
But if all it takes to successfully transact Bitcoins are just a couple of account numbers, that seems like a security problem. It’s a big problem with regular money. Just think about all the ways hackers try to steal other people’s credit card information and with Bitcoins, there’s no central bank to notice anything weird happening to shut down fraud. Then, how are Bitcoin transactions secured? They are kept pretty safe due to Cryptography. In specific, Bitcoins stays secure because of the keys, which are basically a stream of information. They help in making mathematical guarantees about the messages like “Hello, this is from me!” When you create an account on the Bitcoin network, that account is linked to two unique keys, a private key, and a public key. The private key can take some data and basically mark it, also known as “signing” it. So others can verify the signatures later if they want.
So let’s say Shyam wants to send a message to the Bitcoin network that says, ‘Shyam sends three bitcoins to Shiva’. Shyam is then supposed to sign that message using his private key which only he has access to and nobody else. Then Shyam sends that signed messaged out to the bitcoin network, and everyone can use Shyam’s public key to make sure his signature matches and checks out. This way, everyone maintaining ledgers knows to add Shyam’s transaction to their copy of the Blockchain.
Simply put, if the public key works, that is proof that the message was signed by that person’s private key and is something he/she wanted to send with their consent. Unlike a handwritten signature or credit card number, this proof of identity is something that cannot be faked by a hacker or a scam artist.
The ‘who’ part of the transactions is obviously essential to make sure the right people are exchanging Bitcoins, but the ‘when’ matters as well. For example, let’s say you have five hundred rupees in your bank account and you tried to buy two things worth five hundred rupees each. The bank will honour the first purchase and decline the second one as you do not have five hundred rupees for your second purchase after completing your first purchase. If the bank didn’t do that, you would be able to spend the same five hundred rupees multiple times which might sound awesome but equally terrible. Because a financial system can’t work like that. There is a check that’s built in the Bitcoin system to tackle this problem. Bitcoin network automatically will check your previous transactions to make sure you have a sufficient number of Bitcoins to send in the first place. But there is another problem with respect to timing. As there are lots of people keeping copies of the Blockchain all over the world, you won’t always receive the transaction requests in the same order because of Network delays.
Solving Math Problems
Now you got a bunch of volunteers with a bunch of different blocks to pick from, but none of them is necessarily wrong. The Bitcoin system solves this problem of delay by actually solving problems. Math problems. To add a new block of transactions to the existing Bitcoin chain, each person maintaining a ledger will have to solve a complex math problem created by a cryptographic hash function. A hash function is nothing but a complex algorithm that takes an input of any size and turns it into an output of fixed size. The hash function that Bitcoin uses is ‘SHA256’, which stands for Secure Hash Algorithm 256 bit. Computers that were specifically designed to solve SHA256 hash problems can take about 10 minutes to guess the solution to each of the problems. That means they are going through billions and billions of guesses before they get it right. The volunteer who solves the hash first gets to add the next block of transactions to the blockchain which then generates a new math problem that needs to be solved to create another block.
If multiple volunteers make blocks roughly at the same time, the network picks one block to keep building upon, which becomes the longest, and the most trusted chain. These volunteers spend thousands of dollars on special computers which are specifically built to solve SHA256 problems. This consumes a lot of electricity, and their electricity bills go up extremely high as they keep those machines running. Bitcoin has a built-in system to reward the volunteers who are contributing to the maintenance of the blockchain. These people who keep and maintain ledgers are generally known as miners. When Bitcoins were first created in 2009, they didn’t have any value. Every single Bitcoin that exists right now was created to reward a Bitcoin miner.
Along with the big reward miners get when they add a new block of transactions, they are also tipped with a very small amount of Bitcoins for each transaction they add to the ledger. It is important to know that after every 210,000 blocks created the reward generated goes down by half. So what started as a reward of 50 Bitcoins decreased to 25 then 12.5 and 6.25 Bitcoins and keeps dropping! Currently, miners are receiving 12.5 Bitcoins for every block they add to the Bitcoin blockchain. According to planned projections, the last Bitcoin will be mined in the year 2140. This is how the Bitcoin network and the complex yet amazing system of Bitcoin works.
Next theme: Bitcoin Units & Their Importance.