Image by Gerd Altmann from Pixabay
Recap
Last week we introduced solutions being developed to resolve the Blockchain Trilemma. The objective of these solutions is to ensure mass adoption of Blockchain technology so that the maximum number of people enjoy the benefits of decentralized technology & applications.
The solution to getting over Blockchain Trilemma broadly falls under two categories:
On-chain or Layer - 1 Solutions
Off-chain or Layer - 2 Solutions
On-chain or Layer - 1 Solution entails modification to the base Blockchain &
Off-chain or Layer - 2 Solutions entail an additional layer or a side addition to the existing Blockchain.
We started with two design solutions for On-chain / Layer - 1:
Sharding
Improving Consensus Mechanism.
Sharding
Sharding refers to "breaking the Blockchain" into different shards. The consensus algorithm & underlying protocol remains the same in all the shards but each shard maintains its data meaning there are multiple blockchains with a common underlying protocol but individual nodes in a shard maintain their separate data.
The objective of sharding is to scale a Blockchain to be able to process millions of transactions in seconds.
Sharding is also used in databases for efficient data storage.
Let us move to the pros & cons of Sharding.
Sharding - Pros & Cons
Pros:
With each shard holding only a portion of data, the space consumed is less compared to that of a full or un-sharded Blockchain. This facilitates faster processing times & ability to scale without compromising security.
Each node within a shard need to verify only the transactions in that shard & not the others reducing the time to verify a transaction while in a full Blockchain, all the nodes have to verify all the transactions.
Cons:
Seamless communication between nodes in different shards is critical. It is important to remember that individual shards are part of a full Blockchain and not independent blockchains by themselves. If nodes are in different shards, the communication needs to be seamless requiring additional systems resulting in more load on the system potentially reducing the benefits of sharding.
Since the Blockchain is "broken" into different shards, the risk of a 51% attack on each shard is higher compared to a full or un-sharded Blockchain.
Each transaction in a full or un-sharded Blockchain can be traced back to prior transactions which is an important check & balance when verifying the latest transaction. With sharding, these checks & balances will not be available as prior transactions can be in other shards.
Let us now move to the next layer 1 solution.
Improving Consensus mechanism
We discussed consensus mechanisms extensively in Weeks 9 & 10. Consensus simply means that people who are part of a group have to agree on a single truth & everyone adds & reflects the same truth in their ledgers after verifying its validity.
So, for a transaction to be added to a block, all the nodes have to agree on the validity of the transaction & authorize it accordingly. This agreement is encoded into consensus protocols.
The two main consensus protocols are :
Proof of Work &
Proof of Stake
Proof-of-Work
(Please refer to Week 23 - Block Mining for a more extensive discussion on Proof-of-Work)
In the Proof-of-Work protocol, miners solve cryptographically hard equations using resources (CPU & electricity) imposing costs to mine a transaction. This makes the network more secure as the cost of introducing a fraudulent transaction is very high since
a. nodes will not validate such a transaction & consequently
b. the miner would lose both the reward (the underlying token) and the costs of mining the transaction.
But transaction processing takes significant time due to this additional step & requires enormous computation resources in terms of CPU usage & electricity. Specialized types of equipment called Mining ASICs (Application Specific Integrated Circuits) are used for this purpose.
Once the miner completes & broadcasts the Proof-of-Work done on a block, the nodes validate this Proof-of-Work & if other relevant conditions are satisfied, the block is added (Refer Week 25 - Verification & Addition of Blocks).
Proof-of-Stake
In a Proof-of-Stake protocol, transactions are validated by "Validators" based on their stake in the protocol (like the proportion of shareholding in a company) & these validators are rewarded with the underlying token (like miners in Proof-of-Work) to validate transactions.
The validators are required to provide a deposit or in other words, "stake" their cryptocurrency as collateral. A validator with the highest stake has a greater chance to be chosen to validate a transaction & be eligible for the reward.
In case they validate a wrong or fraudulent transaction, they lose their reward & their stake thus ensuring only valid transactions are mined.
Improving Consensus Mechanism by moving to Proof-of-Stake
So, we can see from the above that Proof-of-Stake is faster & requires no special computing equipment as there are no cryptographic problems to be solved.
Ethereum has moved from Proof-of-Work to Proof-of-Stake. Newer Blockchains like Tezos, Cardano, Solana, Algorand etc use Proof-of-Stake protocols instead of Proof-of-Work.
Thus, we can see that Layer 1 solutions involve modification to the underlying Blockchain to get over the Trilemma.
We will now move over to Off-Chain or Layer - 2 Solutions.