There is a lot of confusion right now about the definitions of what are Layer 2 solutions and what are not. The reason for this is that every scalability solution is called Layer 2, which is technically not always correct, as not all solutions fall into this category.
If you try to understand this on your own, it is extremely difficult to find accurate and clear answers to these questions. So, in this article, we will take a closer look at some of the most popular Ethereum scalability solutions today and find out how they differ from each other. We will also understand exactly what sidechain, Layer 2, ZK-Rollup, and Optimistic Rollup are.
Why is there a need for scalability?
Let's start with why there is a need for scalability in the Ethereum network.
The Ethereum main network has a throughput of only 15 transactions per second. As its popularity grew, this was insufficient, and transactions on the main network became expensive and slow. The high cost of transactions is a result of the network's growing popularity and the limited throughput.
What if more transactions are sent than can be processed? Validators (those who add transactions to the blockchain) will select transactions that have a higher reward (fee). In this case, there is competition between the senders of transactions, and the cost starts to skyrocket. As the network becomes congested and costs increase, the speed of transactions also decreases.
Blockchain scalability challenges
In understanding how scaling solutions work and the limitations they come with, it's easier to start with the blockchain trilemma, a theorem that says that the blockchain network has three main characteristics:
Security - responsible for the network's resistance to attack.
Decentralization - responsible for the resistance to control by a lesser number of people.
Scalability - responsible for the blockchain's ability to handle large volumes of transactions.
Only two of these three parameters can be increased to the desired level at the same time.
The Ethereum network is designed to have extremely high decentralization and security, which in itself is very good for the network. But as we found out from the trilemma - you can't have all three parameters at a huge level at once, so the Ethereum network doesn't have the highest throughput.
There is a demand to process a high volume of transactions at a lower cost, which results in the need for scaling. Off-chain solutions for scaling the Ethereum network are being actively developed. Off-chain means that the main computations are moved outside the main network.
The most popular solutions are sidechains and layer 2. Let's discuss them in the following.
What are Ethereum's off-chain scalability solutions: Sidechains and Layer 2?
Layer 2 is a platform or service that is an overlay on top of the main network (Layer 1). All transactions in Layer 2 change the state of the main network, this way the security of the main network is inherited. Rollups are a way to implement layer 2 solutions. It's worth noting here that Layer 2 solutions are a platform, and it doesn't have to represent a blockchain.
Sidechains - This is a separate blockchain that runs in parallel with the main network. It is important to understand that Layer 2 always changes the state of the main network, inherits its security, and is on top of it, while sidechain is always a separate blockchain.
What is a sidechain?
A sidechain is an isolated blockchain. This means transactions in sidechains do not change the state of the main network (layer 1/Ethereum).
Because it is a separate blockchain, it could have its own consensus algorithm, set of validators, configurations that may differ from the main network, and its own native currency.
This also means it may have a different balance of security - scalability - and decentralization. Sidechains usually sacrifice a level of decentralization or security to achieve high throughput. They are linked to the main network only by a cross-chain bridge that allows assets to be moved between the sidechain and the main network. Sidechains can be non-EVM compatible as well. A prime example of a sidechain is Polygon POS (MATIC).
What are Layer 2 solutions? Take rollups as an example
Rollups are a Layer 2 scaling solution for Ethereum.
The general principle of rollups is that the transactions (TX) are being processed on a platform outside of the main network; a rollup is made from a multitude of transactions and sent to the smart contract in the main network (Layer 1), changing its state.
As the rollup of these transactions is stored in the main network, its security is inherited. Actually, there are two types of Rollups implementation - Optimistic and Zero Knowledge.
How are Optimistic Rollups designed?
As mentioned above, transactions are packaged into a rollup and sent to the smart contract on the main network. In the case of Optimistic Rollup, the smart contract in the main network does not check the sent data and trusts it by default, so it is called Optimistic.
But what if someone wants to cheat? The idea is that these transactions are not being considered confirmed for a certain amount of time. During this period, any validator can send a fraud proof. Here, it should be noted that to become a validator, you need to place a stake in a smart contract.
When a fraud proof is sent, the smart contract checks it. If cheating is detected, the validator who tried to cheat is penalized from his stake, and the validator who sent the cheating evidence is rewarded, motivating everyone to stay honest and watch the honesty of others.
If a wrong fraud-proof is sent, the validator who sent it is penalized to prevent spamming. If no one has sent a valid fraud proof within this period of time and the period has expired, the transactions are moved to the confirmed status.
The special feature here is that until this period expires, transactions are not confirmed, which means a long period of transaction confirmation. An example of a protocol working on the Optimistic Rollup principle is Optimism.
What is the general structure of ZK Rollups?
ZK Rollups, different from Optimistic Rollups, do not depend on trust but on zero-knowledge cryptographic proofs called validity proofs.
Zero Knowledge Proofs allow one prover to cryptographically prove something to another verifier without providing any additional information.
The way it works is as follows: a set of transactions is computed and compressed into a rollup.
After that, a validity proof for this data is generated. With the data, the validity proof is sent to the smart contract of the main network. The smart contract verifies this proof, and if everything is correct, the transactions are immediately considered confirmed. In this case, everything is cryptographically linked, and there is no long waiting for confirmation of transactions. An example of this kind of protocol is StarkNet.
What are the differences between Layer 2 and sidechains?
Layer 2 is a solution that takes the computation and transaction processing outside the main network, but data verification still takes place in a smart contract on the Ethereum network. While sidechains are completely separate blockchains and are not directly
linked to the Ethereum network, they work in parallel.
Conclusion
Blockchains can only have two of these three parameters at the right level simultaneously: security, decentralization, and scalability. Sidechains are individual blockchains that reduce one of these parameters to achieve high throughput.
Layer 2 solutions inherit the security of the main network and modify its state. Optimistic Rollups and Zero-Knowledge Rollups are Layer 2 solutions.
Optimistic rollups work on the basis of trust and use fraud proofs within a certain time period. Therefore, they have a delay in confirming transactions.
With zkRollups, there is no such delay in transaction confirmation because they are not based on trust and instead are based on zero knowledge cryptographic proofs. These proofs are called validity proofs.
Solutions are compared by key parameters in the table.
It is important to understand that Layer 2 solutions inherit the security of the main network and are on top of it, while sidechains are just separate blockchains with different
configurations.
Top comments (0)