Blockchain — The Backend Evolution Powering Web 3 (Part 2)
In continuation of the previous article “Blockchain — The Backend Evolution Powering It”, If you haven’t read it, click this link https://www.linkedin.com/pulse/blockchain-backend-evolution-powering-web3-matti-jeremiah/
After the article, I got questions centred around “what is the difference between the current web2 backend and that of web3?
More so, I think there is a need to elaborate more on the consensus process that leads to the production of the next block on the blockchain network.
Without further ado, let us dive in!
Web2, the current internet as you know it today, operates on a centralized backend owned and controlled by big institutions.
Everything we do on the internet today is stored in a central database located somewhere around the world.
For example, if the app you use uses Amazon Web Services (AWS). All your information and transaction records will be stored on an AWS server in the United States.
Only the app developer has direct access to such information.
Let me bring this home; using a few examples.
Most of us are registered on one or more social media apps. For this article, let us take Facebook.
As a user of Facebook, all your personal information, pictures and other details are stored on a Facebook database. Facebook gathers all this information about their users and sells it to companies interested in advertising on its platform, making you the product.
So the big question is, “How is blockchain changing this current model?”
Blockchain, also known as the Distributed ledger technology (DLT), is evolutionizing this current backend by ensuring information is not stored in a single location but rather they are stored on many distributed computers called nodes worldwide.
Not only are these records stored in a decentralized manner, but they are publicly available for anyone to verify. Therefore, no entity has autonomy over those data.
Suppose we want to send money to friends, family or business associates. First, we must open a bank account with a financial institution in our locality. We then need to keep our money in the bank and finally use the bank to send that money to the intended party. So the bank stores our information and money and acts as a middleman; we have to use to send our money.
However, blockchain changes this entire process. First of all;
Blockchain technology eliminates the middleman, in this case, the bank. Meaning blockchain allows us to make a peer-to-peer money transfer in a trustless manner without the need for a central authority.
Secondly, you don’t need to give anyone or an entity (bank) access to your money. Users have complete control over their funds.
It doesn’t stop there, imagine; you want to send money to a family member on the weekend. If you were to use the banks, you would have to wait until a business day before transactions can be done, and it doesn’t come cheap because the banks will charge handsomely for it.
On the flip side, blockchain technology allows instant transfer of funds at any given time of the day or week, and the icing on the cake is that transaction charges are way lesser than that of banks.
With these few examples, I am sure you can conclude what makes the web3 backend different from that of web2 and what it means when we say blockchain is the backend evolution.
To the next big question, if blockchain keeps all this information and transaction records decentralized, how do we trust the integrity of these computers and, by extension, the records stored on them?
Integrity here refers to the inability of anyone to tamper with or alter information stored on the computers.
This is where the “Consensus Mechanism” comes to play.
A Blockchain network confirms each block of data using a consensus mechanism. Consensus is a system where all nodes (computers) on the blockchain network agree before a new block is formed.
In other words, the consensus process is where all nodes connected to the blockchain network agree on a result based on a set of mathematical computations before storing any data.
Mathematical computation is when transactions are cryptographically converted to set numbers. This process is called Hashing.
Follow this flow; whenever transactions, say, for example, MOJ wants to transfer $100 to John.
The transaction is broadcasted on all the computers on the blockchain network. Then all the computers called nodes to try to solve a mathematical calculation called Hashing. The computer with the correct answer (hashed numbers) immediately broadcasts to other computers, agreeing with it, and all stores the information. The agreement process is called consensus, and the transaction’s conversion to a set of numbers is called Hashing.
There are two significant types of consensus mechanisms which are;
- Proof of Work (PoW)
- Proof of Stake (PoS)
Let me break down these two primary consensus mechanisms into a more straightforward form.
Proof of Work
Using our initial example, MOJ wants to transfer $100 to John. Here is how the consensus flow on the proof of work goes.
The transaction is broadcasted to all the computers on the network; once that is done, the nodes try to hash (converting the transaction to numbers) the transaction.
The first computer to hash the transactions correctly broadcasts to the rest of the computers. Then check to confirm and immediately permit the computer, which was the first to solve the mathematical solution to record the transaction on the network.
The network then rewards the computer with some coins called mining rewards.
Another way to see it is to imagine a mathematics quiz competition where we have ten contestants. The rule of the competition is that once a mathematical quiz pops up, all the contestants are required to try to solve the problem immediately and simultaneously.
The first contestant to solve the quiz hits the buzzer in front of them, indicating to the other participants that they have the answer. The other participants check and confirm he’s right, then records the quiz as solved and move on to the next question. The contestant who was the fastest to solve the quiz gets a reward in the form of coins.
This is how the proof of work consensus mechanism works. At the same time, all computers must use computation effort (The Work) to solve a mathematical problem called hashing and immediately share the answer with others. Others check and agree with the computer.
The Bitcoin blockchain is one of the networks that use this model, and computers are rewarded with bitcoin coins.
Proof of Stake
Using the quiz example shared earlier. Imagine each contestant in the mathematics quiz competition is required to stake some money down before they can participate in the quiz. Then when a quiz pops up, a system is set in a place where it randomly selects a participant to answer the question. However, the probability of selection is based on the amount staked by the participant.
For example, let us assume we have 10 participants who staked varying amounts. The participant with a higher staked value has a high chance of being randomly picked over the others who staked lesser.
Once the participant solves the quiz, the answer is shared with other participants to verify it is correct, after which they all record it, thereby creating a new block on the network.
In the blockchain context, all computers participating in the network must stake some of the network’s coin. When a transaction is broadcasted, the system is set in motion where it randomly picks a node; however, nodes with high staked coins have a higher probability of being selected to hash the transaction and broadcast it on the network.
A significant advantage of this mechanism is that it is climate-friendly and reduces emissions by 99% compared to the proof of work.
Also, it is said that this will improve transaction throughput and reduce the cost of gas fees.
Gas fees are what network users pay for performing transactions on the blockchain network.
In the coming days, we expect the Ethereum blockchain to move from the Proof of Work to the Proof of Stake consensus mechanism.