A Simple Guide to Understand Blockchain with a Real World Analogy
Everyone is talking about Bitcoin these days, from your barber to your friends working at stock market. Don’t worry this article is not about several other articles talking about making money from Bitcoin. However, I will try to help you understand the underlying technology which makes Bitcoin work and how this concept of blockchain can be useful in the coming decades.
October 31, 2008, a white paper from an anonymous person or organization named Satoshi Nakamoto was published which explained a novel approach to send money from sender to receiver directly without involving any financial intermediaries. The paper gave a name to this concept — Bitcoin. Since, Bitcoin uses some underlying concepts of cryptography, this new way of exchanging money was categorized as cryptocurrency. The only purpose of Bitcoin was for financial transactions but researchers realized that its foundational technology can be harvested to build other secure and robust applications that can revolutionize the way current systems work. “Blockchain” was the name given to this foundational technology. Lots of technical words? Let’s simplify!
What is Blockchain? — A Real World Analogy
Let’s imagine that you live in a city, which has a big parking space to park 200 cars at one time (assume that the parking space just has a ground floor). This parking space has a main gate which stays locked and is only opened when a car moves in or out. Now let’s analyze this single parking building from different points of view —
- Price: Since some private company built this parking space exclusively for parking purposes and all the maintenance cost will be beared by the owner company, there will be a high renting fee for renting out a single parking space.
- Security: If thieves get access to the main door, they can easily get to your car (take its wheels, or fuel, or damage the brake, anything!)
- Limit: What if the number of cars in your city grow from 200 to 300? The parking space will not have enough space for all cars and some other private agency will have to built a new parking space.
- Trusted: You trust the parking space company and they are responsible for taking care of security and reliability.
- Centralized: Since all the cars are in one building, we can consider it to be a centralized parking.
Now, let’s modify the current scenario. Imagine that there are 200 houses in your city and all 200 houses have two garages each. However, to simplify our explanation, let’s assume each house just has one car (all cars filling up all the slots of big parking space described above). So, each house has one empty garage out of the two garages available. Now, let’s say people of the city decide to rent out the extra garage to anyone who needs a parking. This model of providing parking space will solve the problem of parking 200 cars or more cars (in case people move in and out of the city) without the need of building any central bigger parking space for the entire city. Similar to the previous scenario, let’s analyze this scenario —
- Price: Since people didn’t built the second garage exclusively for renting purposes and the cost of maintenance will be little, the cost to rent that extra space will be low comparatively to the big central parking space
- Security: Each car is locked in a different garage therefore thieves will have to unlock all the garages to get access to the cars, thus providing more security. (Security in blockchain is a bit different but for simplicity let’s consider it this way for now!)
- Limit: As the number of houses grow, assuming each new house also has extra garage space, the space to keep more cars will keep increasing. Thus, increasing the network of lessee and lessor.
- Trustless: Since, no central authority controls these distributed parking spaces, we assume that there will be certain rules set by all the participating garage owners for renting out their places.
- Decentralized: As mentioned in the previous point, these parking spaces are distributed throughout the city, we can consider it to be a decentralized parking.
The above analogy provides the foundation for understanding the actual technical infrastructure of the Blockchain.
Parking Model to Technical Model
The parking model presents a very basic overview of Blockchain in some real world language. Now, let’s try to match the components of our parking example to the actual technical model —
- The big central parking is a centralized system like AWS, Google Cloud etc. (these cloud platforms are also distributed at some level but for the sake of simplicity, we will assume them to be a single entity).
- The cars are the data and applications.
- The distributed parking is a decentralized system — Blockchain.
Wait! We missed something.
All decentralized systems are not Blockchain!! Yes, Blockchain is a particular type of decentralized system that has a unique property. Which property? Let’s talk about it.
“Blocks” make Blockchain
Let’s revisit our distributed parking example and make a small change. Let’s assume that the lock to a particular garage is generated when a car is parked inside it (we assume that the same car goes to the same parking everyday). Also, assume that we have numbered all the distributed garages in serial order. The lock-key pair of garage #50 is based on the lock-key pair of garage #49 and also on the features (like color, weight, engine number etc.) of the car parked inside garage #50 and this process starts from garage #1 and moves till garage #200 or even more.
Each garage’s lock-key pair depends on the garage’s car features and previous garage’s lock-key pair.
Therefore, if a thief tries to break into garage #49 and modifies any feature of the car, say its color or registration number, the features of car in garage #49 will change which means a new lock-key pair for garage #49 will be generated and since lock-key-pair for garage #50 depends on lock-key pair of garage #49, lock-key pair for garage #50 will also change and same goes on for future garages.
Now, let’s make one last assumption that computing a lock-key pair requires lots of computing resources which means if we have to recompute these pairs in case any thief modifies any car feature in any garage, it will be practically impossible to recompute all the pairs again.
What happens if a lock-key pair is changed?
Hope you remember that we talked about all garage owners abiding by some rules? One of these rules is to check for a valid garage. A garage is valid if you can validate its lock-key pair and if any lock-key pair gets changed, the lock-key pairs of all the following garages get invalid because every pair depends on the previous pair. (Process to validate a lock-key pair for a particular garage is very fast as compared to generating one).
This dependence of one pair on the previous pair makes it a chain of garages and in technical world, these garages are “blocks”, thus getting its name — Blockchain (a chain of blocks).
Blocks in Blockchain are tied to the next block by hashes just like lock-key pairs in our example. Similar to garage example, if data in one block is modified, hashes need to be recalculated for all the following blocks and since calculating the hash is a very resource intensive operation, it gets practically impossible to do that and hence the network rules out the invalidated block. The calculation of hash is called mining and we will talk more about it in the next release of this series.
How do the blocks recover from modification?
All the computers on the blockchain network, keep a copy of the full blockchain, so if one block or one complete chain at a particular computer or multiple computers is modified, the whole network tries to compare it with their own copies of the full chain.
If majority of the nodes (or computers) on the network find that the modified chain is invalid, the modified chain is replaced with valid chain from other nodes. This makes Blockchain vulnerable to 51% attack. In simpler words, if more than 50% of the nodes on the network are malicious (or say have a modified chain), then the whole network can be compromised.
Ethereum, Bitcoin or some X-coin
Everyone of you must have heard at least once about any type of X-coin whether its Bitcoin, Litecoin, Ether or any other coin. What are these? These are cryptocurrencies, getting their names from cryptography — the concept that powers the underlying technology of your favorite coin. But, why we need these digital coins? Apart from sending money to your friends or receiving some from them, these coins are used to incentivize the computers on a Blockchain network. Woah! To much of technical jargon!! Let’s move back and bring in our parking garage example in to the picture.
Pay for the Garage vs Cryptocurrency
If you remember from previous article, we mentioned that garage owners will rent their parking spaces to those in need. Now, you might be thinking, how would a lessee pay the lessor? Simple! through the bank transfer. But why would someone share their bank details with a stranger in case they are renting their garage? That’s a valid question.
Let’s solve this problem by using a Paypal (or any other digital Wallet). The garage owner uses their Paypal email address to receive payments. This way they don’t have to share their bank details to strangers. Did you notice something in this situation except privacy? Yes! anonymity. By using an email address to receive payments, the garage owner can stay completely anonymous to the tenant and same goes for the tenants as they will also be paying from their Paypal accounts.
Now, let’s compare this with cryptocurrency. In crypto world, it’s almost the same except with a small difference that instead of using an email address you use a Bitcoin or Ethereum or any other coin’s wallet address, which is unique to you. You send the coins from your X-coin wallet to the receiver’s X-coin wallet. Since, the network is full of strangers so revealing bank details for money transfer would be a big problem. Therefore, using wallet addresses facilitate the users to send and receive payment by staying anonymous to everyone on the network and this is also one of the reasons why some countries have banned crypto or why it is very popular in the illegal world.
If you are with me till this point, I am sure you must be thinking that you can transfer money from bank to Paypal but how does that happen in crypto world? Let’s look in to this!
Genesis of the First Coin or New Coins
Just like transferring money from your bank to Paypal, you can transfer money from your bank to you X-coin wallet by buying coins from some registered Exchange. But, the question here is, how the first X-coin came into existence or how new coins are added to the system? But before we answer this question, let’s take a look at another familiar term “mining”.
WTF is mining?
If you remember, in the previous article, we talked about computation(process to calculate lock-key pair) and validation (process to check if a lock-key pair is correct or not). Let’s assume that all the garage owners participate in the process of calculation of a new lock-key pair, which requires lots of computing power (brain power) and time (Just like those tricky calculus questions you got stuck at during your high school). So, the rule of this game of computation is whosoever calculates the correct value first, wins! (Just like a quiz round in your high school you can say!). This entire process of computing the correct lock-key pair is termed as “mining”.
But why would a garage owner spend time to work on computing a lock-key pair? We need to incentivize them! Let’s assume that the winner gets a cash prize, similar to the cash prize you got after winning the quiz at your high school.
Did you notice one thing here? The prize money is the money that wasn’t with the garage owners before (or you can say it wasn’t a part of the parking system before). It is the fresh or the new money that was introduced to the garage parking system after mining in the form of prize money. Now, let’s use this analogy to understand the mining in crypto world.
Crypto World Mining
As you know from the previous article that all the blocks in blockchain are safeguarded by hashes, which are calculated based on previous block’s hash and current block’s data. Thus, binding all the blocks in a chain. This hash computation is resource intensive because it requires you to hit and trial every possible value to get a correct hash (just like what garage owners did). So, the more values you can try per second, the faster you will be able to compute the correct hash (This is why you might have seen your friends buying big machines to mine Bitcoin or any other X-coin).
But the same question arises again, why would someone lend their computer to the X-coin network to perform these resource intensive computations? Correct! the same answer — incentives. Any computer that is able to calculate the correct hash first is awarded with a new X-coin. This new coin wasn’t a part of the system before. This is how the new coins come into the system.
But why the name “mining”?
Well, all the cryptocurrencies are considered to be digital assets or commodities just like the Gold or the Silver or any other metal or mineral. Since, the process of extracting these metals from their mines is known as mining, the cryptocurrencies computations also got the name “mining” because mining brings a new coin to the system.
Now, let’s move out of the cryptocurrency world and dive in to application development on Blockchain!
Decentralized Applications (DApps) & Smart Contracts
If you remember, I mentioned in the part I of this article about researchers realizing the benefits of the underlying technology of Bitcoin (which is Blockchain) for different applications apart from just cryptocurrencies. This is where smart contracts can be useful. Before we dig in the technical side. Let’s continue with our parking example. For a moment let’s assume that there is no prize money included for mining winners (Why? we will discuss in the next section).
Consider that, you have to pay for moving your vehicle into the garage. So, to simplify that, every garage has a fee collecting machine outside it which allows you to read a barcode using your phone and send in the payment from your Paypal. This machine collects the money and as soon as the garage is closed all the garage owners start computing the lock-key pair (mining) and once that garage’s lock-key pair is generated, the machine sends that money to the garage owner who won the mining contest.
The fee collecting machine in the above scenario is a smart machine because it figured out on its own, whom to send the collected money once lock-key pair was generated. And in case anything buggy happens like, a technical error, the machine refunds you the money and either you can pay again or can take your car out.
Similarly, on Blockchain this smart machine is called smart contract — a piece of code that does everything for you on blockchain. As all garages have smart machine, all the computers on the Blockchain have a copy of the smart contract. So, when you send money, it makes sure that you have enough money to send and the receiver gets the money and in case of any error, it just reverts the transaction.
However, smart contracts are not just for money transactions, you can use them to store or modify data on the Blockchain which can be Youtube like model for videos (such as Viuly), or a dropbox type model for storing files (such as Storj.io or SiaTech) or even games like Cryptokitties. The list of use cases is endless!
What Happens When No New Coin?
Do you remember that in the previous section, we assumed that there is no prize money to the winners for computing correct hash value. This gives birth to a new question — Why would someone rent out their computers in case they will not be rewarded with any new coins? Yes, you know the answer. Just like, the fee collecting machine outside the garage collected money and gave it to the winning garage owner, every transaction on the Blockchain costs a very small fraction of money. This small fraction is deducted from all the transactions. When a block on the Blockchain is mined ( its hash is computed by all the computers on the network), the computer winning the mining contest, gets the money deducted from all the transactions mined in that particular block (each block contains a fixed number of transactions) as a reward or incentive. This keeps the crypto model sustainable even after no new coins are issued. Now you know why your friends are buying big machines!
Bravo! You finally acquired the basic knowledge about the Blockchain and its components. I hope this series of articles helped you strengthen your foundations in this emerging technology. From here on, if you are a tech person, you can start learning about developing applications on Blockchain or even setting up your own Blockchain.
However, if you are a non tech person, you can start looking out for problems that can be solved using Blockchain. This will help you deepen your knowledge about the application part of this amazing technology.