Home/Guide/Blockchain Encyclopedia/DeFi/Understand Ethereum Layer 2 in One Easy Example

Understand Ethereum Layer 2 in One Easy Example

Related Articles
2024.08.15 MEXC
0m
Share to


Just what is Layer 2? Before answering that question, let's review the basics:


1. Blockchain Layered Architecture


Usually, blockchains are divided into several layers: Layer 0, Layer 1, Layer 2, and Layer 3.


Layer 0: The foundational infrastructure of blockchain.
Layer 1: The basic blockchain for building dApps, such as Ethereum and other public blockchains.
Layer 2: The scaling solution for Layer 1.
Layer 3: The layer used to develop different types of dApps on top of Layer 1.


Let's use a street analogy to explain the layered architecture of blockchain. Layer 0 would be the foundation of the road. With the foundation in place, we construct Layer 1, which represents the actual road.


As the traffic on this road increases, congestion becomes an issue. To address this problem, we need additional solutions, like constructing elevated highways. These solutions, such as elevated highways, represent Layer 2 in the blockchain context.


Furthermore, on the road, we have various service stations like gas stations and convenience stores that provide us with various services. These service stations are analogous to the different types of dApps offered on Layer 3 of blockchain.


2. Why do we need Layer 2?


As mentioned in the previous example of traffic congestion, Layer 2 is necessary to address the issue of transaction congestion on the Ethereum public chain. When transaction volume is low, the fees and the transaction speeds are within an acceptable range. However, during periods of congestion, transaction efficiency decreases and fees skyrocket, often outpricing the transaction itself.


Let's look at three recent examples of network congestion on the Ethereum blockchain. The popularity of the CryptoKitties game in 2017 was the first event that caused congestion on the Ethereum network, which led the CryptoKitties team to create the Flow blockchain. In 2020, the DeFi Summer boom once again resulted in prolonged congestion on the Ethereum network, with average transaction fees exceeding $20. In 2021, the NFT sector caused network congestion on the Ethereum blockchain once again. As a result, users offered higher and higher gas fees to encourage miners to prioritize their transactions in order to secure popular NFTs.


It is important to note that, while these examples focus on the Ethereum network, Layer 2 networks are not exclusive to Ethereum. For example, Bitcoin's Lightning Network also falls under the category of Layer 2 solutions.


3. How to Address Ethereum Congestion


There are generally two approaches to resolving Ethereum's congestion issues. The first approach involves Ethereum's own scalability, enhancing its capacity to handle a higher demand. While this approach can fundamentally address Ethereum's congestion issues, implementation is technically challenging and may require a significant amount of time to complete.


The second approach is off-chain scalability, specific to Layer 2. This approach involves deploying a new environment on top of the existing Ethereum infrastructure, where a portion of the transaction demand from the Ethereum mainnet is migrated to the Layer 2 environment, thereby alleviating the congestion on Ethereum.


Continuing with our previous analogy of roads, the fundamental solution to alleviate traffic congestion is to widen the roads. However, road expansion can be difficult and time-consuming. As an alternative solution, elevated highways can be built on top of the existing roads to divert traffic and relieve congestion.


4. Common Layer 2 Solutions


Currently, the mainstream Layer 2 solutions adopted in the market include the Rollup approach, which can be further divided into Optimistic Rollup and ZK-Rollup.


In addition, there are other solutions such as Sidechains, State Channels, Plasma, Validium, etc.


The Rollup solution involves keeping the data on the Ethereum mainnet and transferring the transaction process to Layer 2 for execution. After the execution is completed on Layer 2,the transaction data is transmitted back to the mainnet. The key difference between Optimistic Rollup and ZK-Rollup lies in how they ensure the accuracy of the data results returned to the Ethereum mainnet on Layer 2.


Sidechains connect themselves to the main chain by means of bridging, with the assets locked on the Ethereum mainnet. Asset derivation and computational execution occur on the sidechain. Once completed, the assets are transferred back to the main chain, the derived assets on the sidechain are destroyed, and the locked assets on the main chain are unlocked.


Sidechains are independent blockchains that run in parallel with the mainnet and are compatible with the Ethereum Virtual Machine (EVM). They bridge bidirectionally with Ethereum and operate according to their own selected consensus protocols and block parameters.


State channels are an early Layer 2 solution that allows participants to securely conduct off-chain transactions before confirming the result with the mainnet.


Similar to sidechains, Plasma is a standalone blockchain anchored to the Ethereum mainnet. It executes transactions off-chain and returns proofs of the transaction result to the main chain. Plasma utilizes fraud proofs to arbitrate disputes.


Validium is similar to ZK rollup, with the difference being that Validium's data is stored off-chain.

For a comparison of the different Layer 2 solutions, please refer to the following figure:


SNARKs/STARKs
Fraud Proofs
Data On-chain
ZK Rollup
Optimistic Rollup
Data Off-chain
Validium
Plasma


5. Comments on the Expansion of the Current Market


There is no doubt that Layer 2 networks are currently the best solution for addressing Ethereum's scalability issues, with the Rollup approach being the most mainstream and popular solution.


As the industry continues to progress and develop, the concept of Layer 3 has emerged in the current market. Unlike the Layer 3 application layer mentioned earlier, Layer 3 in this context refers to solutions built on top of Layer 2 that offer more customized designs and address problems that cannot be solved by Layer 2, ultimately achieving a multi-layered network structure.


The concept of Layer 3 is still in its early stage of discussion, and Layer 2 remains the focus at the moment. In the future, it is not unlikely that more Layer 2 solutions will emerge to facilitate larger transaction volumes on the Ethereum network.


6. Notes:


Lightning Network
A scalability solution built on top of Bitcoin, which allows users to send and receive Bitcoins quickly and at virtually no cost.

Fraud proofs
Transactions are assumed to be valid, but they can be challenged if there is suspicion of fraud. When that happens, fraud proofs will run the transaction to determine if fraud has occurred.

Zero-knowledge Proofs
Zero-knowledge proofs allow users to prove to others that they possess knowledge of critical data or ownership without disclosing sensitive information, such as wallet private keys.
There are two types of zero-knowledge proofs: Zero-Knowledge Succinct Non-Interactive Argument of Knowledge (ZK-SNARK) and Zero-Knowledge Scalable Transparent Argument of Knowledge (ZK-STARK).