I was introduced to the cryptocurrency & blockchain topic almost 4 years ago around 2017. However, besides recalling the generic terms of “distributed database” & few flash headlines of large enterprises using the blockchain technology for solving certain solutions , I really could not grasp the key concepts. It all appeared abstract and driven by PR needs of large enterprises attempting to reinvent itself. In Summary, the “What” & “When” was covered in news but very limited details on “Why” & “How”.
The Internet( Medium, News websites) is littered with articles which explain the technology & topic in the same pedantic manner. One of the key obstacles to communicating the power of cryptocurrency has been the inherent complexity, counterintuitive themes & how it really attempts to restructure fundamental problems of the “traditional centralised” world we are so attuned to & surrounded by.
Then around mid of 2020 I really got into the speculative game of investing in cryptocurrency. I gained some & lost huge . In addition, the recurring news regarding the government banning cryptocurrencies & making it a criminal offence led me to exit the investment couple of times. Out of my desire to select the right coins for investments & filter out the news ( especially from random trading groups & news apps), I got into the basics of cryptocurrency. “Skin in the game” is indeed a source of unpredictable motivations that leads to concrete learnings. As an observer & reader of Blogs/Article, i had zilch gain.
Through this writing, I attempt to crystallise my understanding in layman terms.Hopefully , it will provide others with a similar sort of structure to understand this complex industry.
In this article, we will simply view how a general cryptocurrency looks in the system itself & how different it is from the traditional databases with rows & columns.
Before moving forward though, it is important to rehash the topic of Hashing - to help explain why there is a “crypto” in cryptocurrency. It does not necessarily require any heavy technical background to grasp the theme behind the keyword.
Hashing
A hashing is a mechanism to derive a unique fingerprint of the actual data/info. It is converted into a garbled text which looks nothing like the original.
A specific data point e.g. a random mobile number , say 8582837179, will have hashing output as - 64cc974a73eb01bbcfb04d614f3fe2bbd3db5c2116091f0391337b9c887c283c.
How to derive the hashing output & various algorithms are out of scope as of now.
* Source
A specific input data will always have the same output data no matter how many attempts I make to derive the output.
Hashing is also one directional( unlike Encryption) where the hash output of my mobile number cannot be converted back into my original mobile number.
An output itself can be further hashed, if need be. So for example, when you hash the output of my mobile number further, we get below new output.
1e8fd2d7233da80bf72d719e282a043a584c0185ed79127c44ed356ff7cdd7ab
You can try it once if you wish here.
A Sample Plot
I have come across quite a few crypto naysayers who equate crypto with “Chit funds scams”. Hence, now that we are armed with the very basics of cryptography , let's run through an imagined but sophisticated scenario.
The example below has been simplified & does not exactly mirror how crypto works exactly. However, the aim is to detail the basics first & cover the technicalities later.
Imagine an isolated “Banana Republic” - bananas are available plenty on the island(pardon the lack of imagination here in naming).
Since the island is isolated, it is extremely difficult & costly to import “Apple” in Banana Republic. Hence, the quantity of Apples on the island is limited at any time.
The banana republic has a democratically elected government( the executive branch) , an independent judiciary(judicial branch) & a parliament ( legislative). Other major institutions are Banks, police force & the residents.
The main character of our story is - Sminem. Sminem is educated & entrepreneurial in spirit. The jobs on the island are limited anyway.
Sminem starts a venture - a chit fund with fellow partners to pool in money. The goal was to create a capital pool from wherein he/other partners could borrow & repay later.
Unfortunately, one of the partners in charge of managing the accounting book was a crook. Let’s call him bogandoff. Bogandoff started fudging the data & pilfered significant funds from the pool. Once the fudging was detected by Sminem, he filed a case. Bogandoff though was well connected, both in law enforcement & with politicians. No to mention, the case was expensive & progressing very slowly.
The whole experience left Sminem traumatised. But being independent minded & entrepreneurial in nature, he started thinking deeply. There has to be a better way. He broke the down the current system as follows:-
In order for the group such as “Chit Fund” to work, record keeping(the ledger) is extremely vital. Here are few ways we can think of the implementing the process:-
Assign an individual from the group as central record keeper. The system he tried.
Pros :- The record keeping process will be fast & will require minimum cost from maintenance perspective. It is also simply quite convenient to have one copy with a central individual.
Cons :- The individual has too much power & can fudge the data to enrich himself. The individual could also censor/deny other members from joining the chit fund.
Hire an Employee for a salary & assign him/her the task of maintaining the Ledger.
Pros :- Convenient & fast.
Cons :- The individual can fudge the data , collude with a certain member or , assuming the employee can access funds through ledger, can simply run away.
In both the above cases, if the centralised ledger keeper’s “incentive derived/salary ” < “funds it can earn with fudging the ledger /running away ” , the chit fund will likely collapse with serious losses.
We can attempt to solve this with additional certain accountability measures (contracts signed). In case there is an accusation of misconduct, other victim participants can sue the individual central administrator. The government or relevant authority on the island is tasked with enforcing the ruling & compensating the victim.
As we see above, That's what Sminem did. But the results were not rosy.
Problems with the above Approach
As you have noticed, this is how any corporation system works currently. The issues are easy to capture & highlight :-
All major institutions ( Banks, MF providers, corporations) are governed by law.You are essentially relying heavily on this enforcement system of law to work in case things go haywire.
Few large corporations have tremendous power which are often misused.
An effective, impartial judicial system is key to ensure that Contracts are enforced.
The law enforcement is overworked & overloaded & expensive for litigants . The justice takes quite long & favorable outcome though is not guaranteed.
The enforcement of the verdict is limited to national boundaries.Imagine, if bogandoff simply ran away to another far away country.
Sometimes the scam itself takes years to be discovered.
Broadly speaking, centralised & powerful organization’s could simply punish you or outright cheat you & simply rely on expensive legal process to bankrupt you.
Now , say , we have few residents on the island who wish to run a chit fund. The participants in the chit fund are 5 individual investors ( say Bogandoff, Sminem, Ramesh,Suresh & Vitalik).
Primary Goal :- Pool in money together ( 10K each). Participants can borrow from the funds as and when needed based on certain terms.
An Alternate System
Moving on to an alternate decentralized system wherein the ledger can be secured by solving the incentive problem & with cryptography.
Let’s propose another system with below guidelines.
Each member of the chit fund will maintain a copy of the ledger. The individuals will be called “participant nodes”.
Anyone from the island of the Banana can be the accountant. These random individuals can also download the ledger copy & help maintain/update it. We will call them “accountant nodes”.
Members of the chit fund can also be “accountant nodes” & vice versa.
Any random individual can download the Ledger & join the Chit fund system,if need be.
Bogandoff & Sminem decide to be accounting people.
The 2 key parts here are ownership(who owns how much) & consensus(post any transaction, what is the new version of Ledger look like).
Accounting Ledger
Entity & Balance
Bogandoff(A)- 10K,Sminem(A)- 10K,Ramesh- 10K,Suresh- 10K, Vitalik- 10K
We will now establish a decentralised system wherein no single intermediary is control. The crucial components to be solved to enable such a system are :-
Identity :- Ensuring the ledger is able to identify the participant node uniquely.
Consensus :- Correct state of the ledger post transactions for all nodes.
Incentive :- Participants need to cooperate & rewards system needs to be aligned towards desired goal.
At this stage, if you recall, apples are extremely expensive & limited on the island. As per the process above , each time Bogandoff( or any Accountant node) verifies the ledger entry , he/she attaches an apple with it( i know it sounds ridiculous, but could not think of another example).
The “Apple attachment” here aims to solve the incentive problem for the accountants. You see, Bogandoff( Accountant Node) is spending limited expensive resources in order to have the privilege of verifying the ledger. Without such constraints, accountant nodes could refuse to entertain/update the ledger( Attack on Ledgers will be a separate in depth article)
Between the accountant nodes, whoever attached Apple first & sent to others, is considered verifier & he receives rewards upon successful verification. In public blockchains such as Bitcoin & Ethereum, the “accountant node” & limited resource on Island - “Apple” counterparts are “Miners” & “expensive specialised” hardwares which are needed to solve random puzzles. Post successful verification, the process of rewarding the accountant node/verifier is called minting coins.
Let’s say , between the 2 accountant nodes, Bogandoff & Sminem , Bogandoff was able to verify the transaction first & update the ledger. The update goes out to all the participants( both other accountant nodes & participant nodes). Each participant updates their copy of the ledger.
Bogandoff is rewarded for his task with a certain amount( say 100 rs- calculation to reward is a separate topic).
But for our example, just assume that reward amount ( 100rs) > cost of procuring apples( 90 rs).
Since the ledger verification & updation has reward associated with it , both bogandoff & Sminem compete to verify the transaction first & receive the reward consequently.
For the health of the system, the higher the number of accountant nodes that are competing to verify the transactions, the better it is. You can imagine it as an axis below.
The increasing competition & robustness of the Ledger has price though. As you can imagine, as more & more “accountant nodes”/”Miners” join the system to earn rewards, the Demand for Apple/Specialised Hardware goes up. In Public blockchains, this sort of side effect is increasing Electricity consumption & subsequent environment impact. The consensus mechanism is constant Work In Progress through & quite a few alternatives have come that do not rely on using scarce resources.
Ledger - 101
Let’s view how the ledger started & was updated.
Sminem creates the first of the Ledger. The ledger will contain the below details
Block Number ( similar to rownum in DBs) - starts with 0
Previous Hash - starts with 0 since this is the first block
Timestamp - In milliseconds. It will keep the ledger in order.
Data - The data we want to add in ledger. It starts with balance that Sminem has added - Sminem - 10K
Nonce - Its the AppleID that was added.
Now if let's look at the value of each variables
Block Number- 0
Previous Hash- 0
Timestamp in milliseconds- 1630423602206
Ledger Data- Sminem - 10K
Nonce- 1234
When you combine all the data & calculate hash i.e.
f(SHA256(0+”0”+1630423602206+”Sminem - 10K”+ 1234) = SHA256( 001630423602206Sminem - 10K1234) = f98cdd0a6d9eeed9a54f71f8b51513d7160cbe50732229c1fb572c072f941cd3
We can use this link to try out the sha256 generation. PFB the screenshot.
The first block is called “Genesis Block”.
Visually, you can imagine the blocks as shown below:-
At this point, the node & ledger structure will looks like image shown below.
Transaction -2 :- Bogandoff -as second participant , downloads the ledger copy containing genesis block & adds his share of 10K to the ledger.
Block Number- 1
Previous Hash- f98cdd0a6d9eeed9a54f71f8b51513d7160cbe50732229c1fb572c072f941cd3
Timestamp in milliseconds - 1630424064084
Data- Sminem - 10K, Bogandoff - 10K
Nonce- 2345
When you combine all the data & calculate hash i.e.
f(SHA256(1+”f98cdd0a6d9eeed9a54f71f8b51513d7160cbe50732229c1fb572c072f941cd3”+1630424064084+”Sminem - 10K, Bogandoff - 10K”+ 2345) =
SHA256( 1f98cdd0a6d9eeed9a54f71f8b51513d7160cbe50732229c1fb572c072f941cd31630424064084Sminem - 10K, Bogandoff - 10K2345) = 82110f5d6d8d6bdbdb717e723ab7dd3b0d51838270649df82c2a58594f8a0712
The Node & Ledger structure now updates to image below :-
Transaction - 3 :- Three other participants- Ramesh , suresh & Vitalik
Block Number- 2
Previous Hash- 82110f5d6d8d6bdbdb717e723ab7dd3b0d51838270649df82c2a58594f8a0712
Timestamp in milliseconds - 1630424064084
Data- Sminem - 10K, Bogandoff - 10K, Ramesh - 10k, Suresh-10k, Vitalik -10K
Nonce- 3456
f(SHA256(2+”82110f5d6d8d6bdbdb717e723ab7dd3b0d51838270649df82c2a58594f8a0712”+1630424064084+”Sminem - 10K, Bogandoff - 10K, Ramesh - 10k, Suresh-10k, Vitalik -10K”+ 3456) =
SHA256( 182110f5d6d8d6bdbdb717e723ab7dd3b0d51838270649df82c2a58594f8a07121630424064084Sminem - 10K, Bogandoff - 10K, Ramesh - 10k, Suresh-10k, Vitalik -10K3456) = 007549b4493647ad7728c0866d393c514e00c66088ad0be2d88978d2294e9f33
Now finally, the node & Ledger looks like below image:-
At this stage now, balance of each individual member is established.
If anyone specific node attempts to modify , say block-2 data , independently of others, such fraud attempts will be easily identified by other 4 nodes & hence rejected.
Due to linked Hashes , if any modifies previous blocks( 0 & 1) , then all subsequent nodes for that node will become invalid.
The other type of action trigger will be needed when any individual member borrows some funds from the available pool of funds of 50K. From the date of withdrawal, interest is charged on a certain agreed rate to the borrower. The interest calculation will be segway for us to introduce the concept of Smart contracts in the next article.
For understanding of transactions in detail, go through this article.
This article is well written. However, I think more intuitive details about basic blockchain design would be great for general readers. Kindly provide an example with Bitcoin of Ethereum as major cryptocurrency with basic diagram.
Connecting Crypto with banana and apple republic is quite relevant and interesting too. Cryptos are in background sync of Blockchain technologies which I believe going to be revolutionary technology of this century in Banking & Finance domain. In someway its challenging the sovereignty of Fiat currency and overall Banking structure. No shock why facing more criticism and non acceptance from regulators. Its still a challenging for regulators to consider it in Assets class of balance sheet.