What Is Layer 2?

BeginnerJan 20, 2023
Layer 2 is a protocol built on top of an existing blockchain (layer 1) for increased performance and output. This is achieved without compromising the security of the blockchain. With the rise in the number of users and transactions on layer 1 blockchains like Bitcoin and Ethereum, there is a need for increased throughput without compromising security and decentralization.
What Is Layer 2?

The issue of blockchain trilemma was first proposed by Ethereum founder, Vitalik Buterin. Blockchain trilemma is the inability of the blockchain to be fast, secured and decentralized at the same time. With cryptocurrencies gaining more popularity, there is a continuous increase in the number of users and transactions that occur on the blockchain daily. Hence the need for more efficient and scalable blockchains to meet up with all the transaction processing and product built on them.

Layer 2 scaling solutions have helped a lot to address this issue. Layer 1 blockchains such as Bitcoin and Ethereum are secured and decentralized but very slow. For example, Ethereum can only handle about 30 transactions per second (TPS). With millions of transactions occurring daily, there is a need for a faster solution that will not compromise the security of the blockchain. Let’s understand more about how to achieve this with the aid of Layer 2 scaling solutions.

What Is Layer 2?

Layer 2 is a protocol built on top of an existing blockchain (layer 1) for increased performance and output. Layer 1 shares its transactional loads with this additional layer which in return performs the transactions and sends back the results to the base layer for permanent recording. The goal of the layer 2 scaling solution is to lessen the load on the base blockchain, improve processing speed and most importantly address the scalability issues faced by blockchains. With the interaction between layer 1 and layer 2, the blockchain can achieve scalability without compromising security.

Layer 2 can also be referred to as off-chain solutions. This is because they provide a framework for transaction processing that is independent of the base blockchain. Arbitrum, Polygon and Optimism are layer 2 scaling solutions of the Ethereum blockchain. They process Ethereum transactions and send the transactional data back to the main blockchain. Transactions are cheaper and faster on layer 2. For example, the block time on the polygon network is roughly 2 seconds while on Ethereum it is about 10 seconds. The cost of a transaction using Polygon ranges from $0.0005 to $0.2 while on Ethereum it can be as high as $10 and even more.

Why Are Layer 2 Scaling Solutions Necessary?

The blockchain is desired to be fast, secured and decentralized. But with the issue of blockchain trilemma, only two of these features can be achieved simultaneously. Scaling Solutions are needed to tackle this problem. With the rise in the number of users and transactions on layer 1 blockchains like Bitcoin and Ethereum, there is a need for increased throughput without compromising security and decentralization. Hence the need for layer 2 scaling solutions.

How Does Layer 2 Work?

Layer 2s comprises all the scaling solutions designed to bring about scalability of the base blockchain. They are designed to speed up transactions on layer 1 without compromising security and decentralization. Transactions on layer 1 are transferred to layer 2 for processing. In this way, layer 2 eases the base layer of transactional burden.

Layer 2 after processing these transactions, returns them to the base layer. There is regular communication between both layers, this is to ensure that decentralization and security are not compromised on layer 2. With the transactional burden off layer 1, the base layer becomes less congested and scalable.

Types of Layer 2 Scaling Solutions

Let’s take a look at different layer 2 scaling solutions and how they operate.

Rollups

Rollups combine a bunch of transactions into a single transactional data and push it over to the main blockchain. This protocol saves a lot of space on the blockchain as well as makes transactions faster and cheaper. There are two types of rollups: Zero Knowledge and Optimistic rollups.

Zero Knowledge Rollups

Also known as ZK-rollups, run an off-chain computation and submit the result to the main chain. The results are known as validity proof. Validity proof means that all the transactions have been checked and they are safe to be submitted to the base blockchain. Zero Knowledge rollups are Proof of Work (PoW) taking place off-chain. This reduces the workload on the main blockchain and hence transactions are processed faster.

Optimistic Rollups

They assume transactions are good by default and push them over to the main chain. When the system faces a challenge, the system is checked and any fraudulent transaction found is revoked and the block validator responsible is slacked. The transaction here is slower compared to ZK-rollups but Optimistic rollups offer more security and decentralization.

Sidechains

They are separate blockchains that run alongside the main blockchain. They use the resources inbuilt in them to lessen the workload on the main chain. They use information from the base chain coupled with their virtual machine to execute Smart contracts or validate transactions and then send the final result back to the main blockchain. Sidechains are independent of the main chain and have their validators. Sidechains offer cheaper and faster transactions compared to their parent blockchain. A good example of a sidechain is the Polygon network, a scaling solution for the Ethereum blockchain. Transactions on Polygon are faster and cheaper compared to the parent chain, Ethereum.

State Channels

As the name implies, the channel serves as a link between two transacting parties. Channels allow you to lock up your funds and trade the virtual form on a faster and cheaper network off-chain. In the end, the transactions are forwarded to the main blockchain. This solution is possible using smart contracts or multi-signature and is similar to what happens when using a visa card. You send and receive a virtual number representation of the real money. A good example of this scaling solution is the Bitcoin lightning network. Your BTC is locked up with someone connected to the main blockchain. You can then do your normal transactions which will be cheaper and faster compared to the Bitcoin network, at the end everything is forwarded to the main chain. The lightning network has been used to scale Bitcoin and also avoid high transaction costs.

Nested Blockchain

This is a secondary blockchain that sits on top of the main chain. The main blockchain does not participate in processing transactions but rather delegates work and conditions to the nested blockchain which returns the results after completing the work. The main chain is tasked with ensuring the security of the whole setup. This reduces the burden on the main chain and improves the operation of the blockchain.

Bitcoin Layer 2 Scaling Solutions

The Bitcoin Lightning Network

The Lightning Network has been effective in scaling the Bitcoin network. Like other scaling solutions, transactions are processed off-chain and are returned to the main chain. This takes the transactional burden of the base chain making the network scalable. The average transaction time on the Bitcoin network is about 10 but with the lightning network, this takes place in a matter of milliseconds. Users can experience low transaction costs and faster payments.

Ethereum Layer 2 Scaling Solutions

With the capacity to deploy smart contracts, lots of projects deem it fit to build upon the Ethereum blockchain. This has brought about high transaction fees and slower transactions as the network becomes more congested hence the need for a scaling solution. Since then, many scaling solutions have been on the rise. There are 2 major groups of Layer 2 Scaling Solutions on the Ethereum blockchain, namely: Generalized and Application special layer 2 scaling solutions.

Generalized scaling solutions are similar to the main chain but offer cheaper and faster transactions. All the features available in layer 1 are present in them too. DApps can be deployed on these scaling solutions as they serve the same purpose as the main chain. Examples of generalized scaling solutions include Arbitrum One, Optimism, Boba Network, StarkNet, etc.

Application-specific scaling solutions are designed for specific applications on the network. They are designed for optimisation and improved performance. A good example is the decentralized exchange, dydx for trading crypto assets. Other examples include Loopring, zKSync, ZKSpace, Aztec, etc.

Conclusion

Blockchain trilemma has been the major issue faced with the growth and adoption of cryptocurrency. Layer 1 blockchains are generally slow in processing transactions. Trying to speed them will alter one of the important factors, hence the need for layer 2 scaling solutions. These protocols prevent layer 1 blockchains from becoming too cumbersome and congested, hence transactions are faster and cheaper. Building a layer 2 solution doesn’t require the parent chain to be altered, so the security of the entire blockchain is not compromised in the whole process.

Author: James, Unique
Translator: James
Reviewer(s): Edward, hugo, Cecilia, Matheus, Ashley, Joyce
* The information is not intended to be and does not constitute financial advice or any other recommendation of any sort offered or endorsed by Gate.io.
* This article may not be reproduced, transmitted or copied without referencing Gate.io. Contravention is an infringement of Copyright Act and may be subject to legal action.
Start Now
Sign up and get a
$100
Voucher!
Create Account