Zero-Knowledge Proof – How It Works
Zero-knowledge proof is a cryptography technique that enables one party to prove knowledge without revealing it. – Read how it works here.
🇺🇦 Hacken stands with Ukraine!Learn more
The user base of blockchain technology is fast moving from a small set of people to millions. As of early 2023, research analysts confirm that over 420 million people own crypto worldwide. Although this incredible increase is commendable, it presents an infrastructural bottleneck to the operations of blockchain networks. This is where the issue of blockchain scalability comes in. If we do not achieve high scalability, blockchain cannot experience mainstream adoption.
It is important to break down these keywords to understand the concept properly. First, Trilemma is a Latin word that suggests difficulty in choosing the best or a better one out of three available options. Scalability means the capacity to conveniently process an increasing volume of transaction data without lethargy. Scalability trilemma is a notion that blockchain networks will have to pick only two among three qualities: battle-resistant security, absolute decentralization, and the capacity to handle more transactions within split seconds.
Interestingly, this nature of trading off some qualities for others also occurs in core Computer Science called the CAP or Brewer’s theorem. Brewer’s theorem provides that distributed systems can pick only two qualities from these three: partition tolerance, availability, and consistency. Moving on, the BNB Chain—for instance—has only 21 validators. Compared to Solana, which has 1,900 validators, BNB Chain is not decentralized enough. However, it’s noteworthy that the BNB Chain sacrificed absolute decentralization to enhance its security and transaction speed.
When the chain was attacked recently, the few validators quickly agreed to pause the chain checkmating the attack this way. From another perspective, Ethereum traded off scalability to enhance its security and decentralization because it has 500,000 validators. The high number of validators signifies two facts. Firstly, a 51% attack is nearly impossible on Ethereum because no one can get 51% of the validators to compromise. Secondly, it shows that the chain is transparent and decentralized.
|Layer 1||Layer 2|
|Change in Consensus Mechanism||State Channels|
How would blockchain technology break free from the loop of scalability trilemma? Some Web3 researchers have come up with a couple of actionable solutions. The blockchain trilemma is solved with various mechanisms to help the networks process activities faster, protect their security, and maintain their decentralized nature.
A Layer 1 network is an underlying blockchain or the main blockchain network. Layer 1 networks are foundational blockchains. They facilitate blockchain transactions and activities themselves. Beyond that, their architecture allows them to host some other dependent blockchains atop them. A layer 1 network has its own blockchain layers, including data availability, consensus, and P2P network.
Examples of Layer 1 blockchains are
Due to higher transaction volumes, each layer 1 blockchain has to either develop or adopt a custom scaling solution for sustainability. These include:
The nodes in each blockchain protocol need to agree before transactions can be approved as valid. On this note, different blockchain networks have diverse methods of reaching agreements referred to as consensus mechanisms
Some consensus mechanisms are not as efficient as layer 1 scaling solutions. A popular example is the proof-of-work method, where the miners solve cryptographic algorithms.
Ethereum is perhaps the best layer 1 blockchain network to utilize as a case study. It moved from proof-of-work to proof-of-stake. It could only process around 10 transactions per second in the former. But the latter increased the data processing load of Ethereum to around 32 blocks. While Ethereum still has a long way to go in terms of scalability, the switch to PoS is a monumental step in that direction.
Forking a chain simply means upgrading or adjusting it. However, it’s noteworthy that forks can either be soft or hard. Soft forks are the new infrastructural changes compatible with the chain’s old nature. On the other hand, hard forks are new changes with a different mode of operation from the previous chain. Bitcoin is the best network that modeled a soft fork in its journey of blockchain scalability.
To facilitate scalability, Bitcoin researchers came up with one of the layer 1 scaling solutions of segregating witnesses in a transaction. This led to the popular SegWit Soft Fork. Ever since the soft fork, the Bitcoin blockchain network has increased tremendously in performance. Its processing load moved from handling over 1600 transactions in a block to processing almost 3000.
Sharding is one of the scaling solutions where data is partitioned into smaller portions for faster processing. With sharding, the state of a blockchain network would be broken into sizeable pieces called shards.
Thus, only the nodes in an individual bit will process transactions. This is more efficient and faster than the time it takes for all the nodes on a blockchain protocol to agree. No particular layer 1 has successfully implemented sharding. At best, it is still a concept that major layer 1 blockchains like Ethereum are working towards in the long run.
Layer 2 networks are overlaying blockchains that enhance the performance of main networks. Since most overlaying networks are not achieving sharding anytime soon, overlaying networks are here to help increase their throughputs.
L2 takes out bundles of transactions from the main chain, processes the transactions on their behalf, and bundles them back into layer 1. Layer 2 scaling solutions lift the heavier part of the burden from the overlaying network, they become less crowded with transactions.
Most overlaying networks rely on a layer 1 blockchain for security and data availability. But they often have their custom consensus and execution layers, even though the execution must be synchronized with the state of layer 1.
The top examples of Layer 2 blockchains include
These are the scaling solutions that most L2 networks have adopted:
Layer 2 blockchain networks often utilize the state channels mechanism to scale their underlying blockchain. State channels are commendable for both their unparalleled speed and privacy. Some portion of the layer 1 state will be moved into a multi-signature wallet outside of the blockchain. The participants in the state channels can carry out activities between themselves directly. For instance, they can send funds by mutual agreement since they are using a multi-sig contract.
They do not need to involve the miners in their activities. When they are done overall, the last state of the channel will be integrated with the current state of the main chain. State channels are currently the best scaling solutions. For instance, the Lightning Network, a state channel on Bitcoin, can process around 1 million TPS.
Rollup is one of the scaling solutions that is gaining wider acceptance in the blockchain ecosystem. Rollups heap up bundles of transactions from the main chain, execute them off-chain and load the processed transactions into the main chain.
This frees the neck of the main chain from processing everything all by itself. With the help of rollups, layer 1 networks such as Ethereum tend to be more scalable. In addition, rollups operate differently. Some utilize the zero-knowledge mechanism, while others use the optimistic method. An example of a layer 2 network with ZK rollup is StarkNet, and Optimism uses an Optimistic roll-up mechanism. Research confirms that a smart contract on ZKRollups can have as high as 100,000 transaction capacity per second.
In engineering, nesting is a state where a program or instruction houses other programs or instructions. Nesting is one of the layer 2 scaling solutions whereby a blockchain protocol houses other blockchains within or on top. The nested chain starts with a parent chain, which also has child chains. When processing the transaction, the parent chain will delegate to the children. The children will execute the transactions and send the eventual result to the parent. Once the parent chain has the executed transactions, it will furnish layer 1 with the result. It is one of the best scaling solutions and is faster because all hands are on deck. Ethereum Plasma, a typical example of a nested blockchain protocol on Ethereum, has a relatively fast transaction capacity of 5,000 TPS.
A sidechain is one of the layer 2 scaling solutions that exists alongside a main chain to optimize its performance. Assets are locked once the sidechain is processing transactions from the main chain. Most sidechains also have a federation or independent third party that cross-checks if there are no anomalies in the activities between the mainnet and the sidechain. The federation can be either smart contracts or some group of people. Although side chains are independent, they still rely a bit on the security of the main chain. However, when the security of a sidechain is breached, the attack cannot affect the main chain. Sidechains such as Polygon process around 65,000 TPS.
There are primary differences between Layer 1 and Layer 2 blockchain networks based on the following:
First, the purpose of Layer 1 blockchains is to work independently. This is evident in their independent, self-existing, and primary nature. They have all the data availability layer, consensus layer, and execution layer within themselves. But that is not the case for Layer 2 scaling solutions. Their purpose is to help Layer 1 blockchain and not to be base blockchains themselves. Thus, layer 2 networks are dependent on the primary network by design.
The second major difference is the dichotomy in how each achieves scalability. Layer 1 blockchains utilize methods such as changing the consensus mechanism, forking the chain, and sharding. In contrast, Layer 2 scaling solutions exist as state channels, nested blockchains, rollups, and sidechains.
|Difference||Layer 1||Layer 2|
|Purpose||To exist on its own||To help Layer 1|
|Scalability Methods||Changing the consensus mechanism, forking the chain, and sharding.||State channels, nested blockchains, rollups, and sidechains|
Without a doubt, L1 and L2 blockchains often host great revenues. As a result, they are the top target of hackers. In October 2022, hackers attacked the BNB chain and stole BNBs worth up to $570 million. Recall that a group of whitehats reported high-severity bugs on Polygon in 2021. Similarly, a whitehat also spotted a critical bug in the Arbitrum-Ethereum bridge.
Whether you are building a Layer 1 or Layer 2 blockchain, ensure you do all your due diligence to ensure tight security. This is why you need the best blockchain security auditor, Hacken. We ensure the security of L1 and L2 blockchains through effective auditing processes. With our 5 years of operation, we have audited over 1,000 projects.
Once you contact us, we will agree on a time you will get the audit results. Internally, our teams of veteran blockchain auditors will look critically into the architecture of your Layer 1 and Layer 2 blockchains. We will deliver an audit report classifying the degree of severity of the bugs. Beyond that, we will also give you expert advice on how to fix the discovered vulnerabilities. Book an audit for your Layer 1 or Layer 2 blockchain here!
Blockchain needs to meet the increasing demand in adoption. As a result, the slow nature of the Layer 1 blockchain network in handling millions of users and transactions is unfit for the optimal growth of the ecosystem. Hence, the reason Layer 2 blockchains came to the scene with their various custom scaling solutions. This article discussed the scaling solutions for layer 1 vs layer 2 blockchain. Meanwhile, the recent developments of modular chains might also have a more impactful effect on the scalability of blockchain layers.