I met a friend who was visiting India and as we got talking, the topic did go to cryptocurrencies and NFT. He was thinking of dabbling into the NFT space. This got me excited and I asked him how much he understands blockchain and it’s potential
“Honestly, I do not know much”, he replied
Excited, I started my rant on what is a blockchain, how it came into the mainstream through Bitcoin, the economic & monetary reason why the Bitcoin was invented. I was trying to impress upon him on how the blockchain technology gave us the ability to have trustless, decentralized transactions without the need of third-parties
Naturally each of these topics are rabbit holes by itself and with each question from him, I had to jump from one topic to another – from history to economics to monetary policies to cryptography. I am not sure how much he understood however this incident made me realize that I will need to structure my thoughts & lay it out there for a novice to appreciate this great invention. What better way to structure one’s thoughts than writing about it? Therefore I decided to do a series of blogs on Blockchain
In the first series of blogs, I plan to cover the fundamentals in terms of technology. I will use Bitcoin as a reference. In further blogs, I may dwell into the other aspects such as the economics & monetary need which Bitcoin aims to solve
Since we are using Bitcoin as a reference, let us understand the as-is situation and then understand how blockchain solves for this
How does things work now?
It is important that I explain the as-is situation because we are all so accustomed by the current way of working that we do not realize the complexity involved in a financial transaction
Let us say you visit a grocery shop and use your SBI credit card to pay your weekly groceries. To make this payment, the merchant (grocery shop) would have a swipe machine (Point of Sale – PoS machine) which would have been given to the merchant by an Acquirer bank, let’s say Axis bank. When you key in your PIN for the payment, the PoS machine connects to SBI (your CC issuing bank) through the MasterCard, Visa or RuPay network. SBI now checks your credit limit and if it is in good standing, it authorizes the payment while debiting this amount from your SBI CC account. At the end of the day, all the receipts collected by the merchant is submitted to Axis bank. Axis bank through the network sends this request to SBI. SBI after subtracting the interchange charges transfers the remaining amount to Axis bank. Axis bank then subtracts the merchant charges and pays the balance to the merchant
Actors | Standard Terminology |
---|---|
You | Customer |
SBI CC | Issuer’s Bank |
Grocery Shop | Merchant |
Axis Bank | Acquirers Bank |
Master, VISA, RuPay | Network |
It would take at least 1-3 business days for the grocery shop to get the money into their bank account and because multiple players are involved, all of them need to be paid a commission. Usually the total ranges from 1.4% to 3.5%. Therefore as you can see, the whole process is complex and expensive
Why do we need such a complicated process?
The short answer is that, we are in a trust based system, therefore when there is an interaction between two parties, we need third parties to ensure “trust”. In the simplest form you would need a third party such as a Bank to confirm “yes” this person does have the balance to pay for the purchase
If you deliberate further, if we need a third party to ensure trust, then that would also mean they are centralized bodies in the current system
What could be the issue due to this?
The first obvious issue when you have “middle men” is the cost. They bring a sophisticated solution for a complex problem, therefore the service cost is high. The second issue is the centralization i.e. their systems has to be highly fault tolerant plus these parties have enormous power over their users. They could arbitrarily remove you off their service based on their “rules”. Imagine if Master/VISA decides not to process any transactions for Indians
We have seen such concerted centralized actions in the recent past; examples of these being de-platforming Donald Trump from all social media platforms, VISA & MasterCard suspending their operations in Russia, SWIFT stopping transfers to Russia, etc. While you can debate on the reasoning, it is a question of time when you can get onto the wrong side
Bitcoin solves this through blockchain. Btw, Bitcoin tries to solve something more fundamental, we will discuss that in a later post
What is a blockchain?
The blockchain was first conceptualized by Stuart Haber and Scott Stornetta way back in 1991. Satoshi Nakomoto, the person behind Bitcoin, repurposed this finding and wrote the Bitcoin Whitepaper
Blockchain in the most simplified form can be considered as a continuous series of records, which are grouped together in blocks and each of the blocks are linked to the each other in the form of a chain using cryptography
The above diagram shows a snapshot of the attributes of a blockchain, every block has at least these five attributes: the block number, the nonce, the data within the block, the previous hash and the new hash. When you make a transaction in the Bitcoin blockchain, that transaction will be picked by a miner, who would group your transaction along with many other transactions and this forms the data part of the block. The goal of the miner is to get this block linked to the blockchain, for which he will receive a reward. Similarly there would be thousands of other miners, who would have their own data, trying to link their block to the blockchain. Whoever cracks the cryptography puzzle first, gets to write their block to the blockchain
Let us understand each of the attributes briefly and later I will explain them in detail. For now you can consider ‘hash’ as a cryptographically generated alphanumeric text which is unique i.e. with the same set of data, you will always generate the same hash. If you change just one variable (say a letter), the hash of the block would be totally different from the earlier hash
Block #: The block number is added to every block sequentially and a block contains a series of records (transaction data) along with the other information mentioned in the above diagram
Nonce: This is an arbitrary number (Number use only once) that the miner adds to the current block in order to generate new hashes. The goal of the miner is to find out a hash which will allow the miner to write to the blockchain. Since the data and the previous hash in the miner’s current block will be the same, the only way to generate new hashes, to try to guess the hash which will allow them to write to the blockchain, is by changing the nonce
Previous Hash: As the name suggests, this is the hash of the previous block. This ensures the traceability of the current block to the previous block. If the previous hash attribute in the current block does not match with the earlier block, then this block will not be linked to the blockchain and will be orphaned. This would mean none of the transactions which is within this block will be included in the blockchain
Data: As the name suggests, this is the actual data that needs to be written to the blockchain. This could be as simple as a set of transaction records between multiple people
New Hash: With the block data i.e. previous hash, nonce and data, a new hash is generated. The miner then checks if this value is below the difficulty coefficient, if yes, then this would allow the miner to write to the block and obtain the reward. If it does not match, the miner changes the nonce and generates a new hash and compares & so on until this or some other miner finds the hash which is below the target. If another miner has cracked it, then that miner writes to the block. Now every other node & miner has to change the previous hash to the latest head of the blockchain and they continue this exercise
What have we learnt so far?
So far, you have understood that
- There are thousands and thousands of miners who are trying to append a new block to the blockchain. Your Bitcoin transaction, say at the grocery store, would be part of one or many of the miners block
- Each of the miners are individually trying to guess the hash which is below the arbitrarily set target; if they guess it first, they get to write their block onto the blockchain and thus get the reward i.e. Bitcoins
- Each block contains multiple attributes such as the previous hash, data, nonce and current hash
What we still do not understand is, how is this allowing us to remove “trust” from the system and make “trustless” transactions, how do we ensure that a miner does not cheat i.e. enters an arbitrary transaction as part of his block, what is this target & who sets it? For this, we will need to understand a few more concepts such as what is hash cryptography, consensus protocol, P2P network… we will unpack one by one in the subsequent blogs. The next blog that you can read is on hash cryptography
Meanwhile if you would like to understand a practical use of a blockchain, then do read this blog