Beginner's Guide to Layer 2 Chains

Beginner's Guide to Layer 2 Chains

A First Glance at Layer 2 Blockchain

·

7 min read

Introduction

In this day and age, you must have heard of mainstream layer 1 blockchain like Ethereum, Solana and BNB Smart Chain. If so, you may have heard of "Layer 2 Blockchain" but don't know what it means. This blog is to help you demystify your thoughts regarding layer 2 blockchains.

In simple terms, a layer 2 blockchain is a solution built on top of an existing blockchain to improve its scalability. But before that, it is very important to know the term blockchain trilemma.

Blockchain Trilemma

The blockchain trilemma is the concept that decentralization, security and scalability can’t all be represented in one blockchain. It is a widely accepted theory that decentralized networks can only provide two of three benefits at any given time. In other words, it claims that trying to improve two of these variables will negatively affect the third one. An analogy to perfectly describe this would be to imagine you are trying to build a car that's fast, safe, and fuel-efficient. You can make it fast and safe, but it will consume more fuel. Or you can make it safe and fuel-efficient, but it won't be as fast. Or you can make it fast and fuel-efficient, but it won't be as safe. Similarly, in blockchain technology, developers face a similar challenge when trying to achieve all three, decentralization, security, and scalability. It claims that trying to improve two of these variables will negatively affect the third one.

The Blockchain Trilemma | SEBA

What the heck are layer 2 solutions?

Layer 2 solutions are becoming increasingly popular as they offer a way to address some of the challenges traditional blockchain networks face, such as slow transaction processing times and high fees. As discussed earlier, in order to realize decentralization and security in a blockchain network, addressing the challenge of scalability is crucial. A simple explanation in layman's terms of layer 2 blockchains would be like a busy highway during rush hour. Imagine if another highway was built on a busy highway, the traffic would be smoother, and everyone could reach their destination faster.

How Layer 2 Helps

Reduced Transaction Fees

The current situation of layer one blockchains, such as the Ethereum network, suffers from high transaction fees (gas fees) due to the high traffic that is going on inside the chain. Because of that, one of the goals for layer 2 blockchains is to help reduce traffic in layer 1 blockchains by diverting the transactions from the layer 1 blockchain to another blockchain to process the transaction off-chain. This helps reduce the data load on the layer 1 blockchain and cuts down the transaction fees.

More Value Added to the Blockchain

Layer 2 blockchains also help to add more utility to the blockchain by providing lower transaction fees, higher amounts of transactions per second, and new technology towards the blockchain. Builders can focus on building new projects on the blockchain and improving the user experience overall.

Layer 2 Scaling Solutions

Layer 2 scaling solutions are protocols built on top of an existing blockchain to achieve higher throughput and transaction speeds without compromising decentralization or security. There are some examples of layer 2 scaling solutions that will be mentioned here.

Rollups

Rollups are layer 2 solutions implemented to reduce the load of the main network. There are two main types of rollups: Optimistic and Zero-Knowledge (ZK). Their primary purpose is to process many transactions off-chain, compile them, and send them back to the main network. But different rollups have different transaction verification methods.

Optimistic Rollups

Optimistic Rollups are protocols that increase the transaction output by compiling multiple transactions into batches and processing them off-chain.

Optimistic rollups validate transactions by determining all the transactions are valid by default. After that, the rollup will have a period to prove whether a transaction is a fraud. This is known as a 'challenge period.' Within this period, verifiers will review the batches and submit fraud proof if they find the transactions invalid. If the transaction is proven to be a fraud, the rollup protocol will correct them by re-executing the wrong transactions and updating the block.

The downside of Optimistic rollups is that they will take a long time to wait for the 'challenge period' to finish verifying the transaction.

Examples of Layer 2 Chains that use Optimistic Rollups include Optimism, Arbitrum, and Boba Network.

Zero-Knowledge (ZK) Rollups

Similar to Optimistic Rollups, ZK rollups are protocols that also increase the transaction output by compiling multiple transactions into batches and processing them off-chain.

Instead of using fraud proofs like Optimistic rollups, ZK rollups use validity proofs to verify the transactions on the layer 2 chain before submitting them back to the layer 1 chain. By doing this, ZK rollups have a faster withdrawal time than Optimistic rollups.

The downsides for ZK rollups are that it uses more computational power than Optimistic rollups due to validity proofs. ZK rollups are harder to implement in Ethereum due to their complexity compared to Optimistic rollups.

Examples of Layer 2 Chains that use ZK Rollups include Polygon, zkSync, and Loopring.

Sidechains

Sidechains are secondary blockchains that run parallel to the main blockchain. They can use resources and borrow information from the main blockchain. Sidechains can then execute smart contracts and validate transactions on their virtual machines on the side, and submit the data back to the main blockchain.

Sidechains cannot operate without the main blockchain, but the main blockchain does not need the sidechain to operate.

The notable examples of sidechains are Polygon and Gnosis.

State Channels

State channels are a way to allow parties to conduct multiple transactions off-chain. This solution improves the scalability and reduces the transaction fees for transactions on the blockchain. This works by locking up funds in a payment channel and facilitating transactions inside it until one of the parties decides to withdraw their funds. Then, real cryptocurrency is withdrawn from the payment channel and deposited into the party. State channels are only used for transactions, and it does not work with the application of smart contracts.

One example of a state channel is the Lightning Network for Bitcoin. This allowed Bitcoin to scale and reduce transaction fees on the network significantly.

Comparison between Layer 1 and Layer 2 Chains

Transaction Speed

  • Layer 1 blockchains can have high transaction fees due to the high transaction amount, all having to go through the main blockchain. This means that the network for the layer 1 chain is congested, resulting in high transaction fees (gas).

  • Layer 2 blockchains have lower transaction fees than layer 1 because it offloads the load from the layer 1 solution and processes it off-chain. This results in lower transaction fees due to a lesser load on the main blockchain.

Security

  • Layer 1 blockchains, such as the Ethereum network, are known for their high level of security. Transactions on the main blockchain are validated and recorded by a network of decentralized nodes, making it difficult for malicious actors to manipulate the system.

  • Layer 2 blockchains can also be secure, but they rely on the security of the layer 1 blockchain. For example, a layer 2 solution built on Ethereum will have all of Ethereum's security features.

Scalability

  • Layer 1 blockchains face scalability issues because all transactions must be recorded on the main blockchain. As a result, this also creates congestion inside the network, slowing down all the transactions.

  • Layer 2 blockchains are designed to improve the scalability of the layer 1 chains by processing transactions off-chain or on a separate sidechain, reducing the main blockchain's load and improving overall efficiency.

Conclusion

In conclusion, layer 2 blockchains are changing how we view blockchains as a whole by introducing better transaction fees, transaction speed, and scalability. With the further development of layer 2 blockchains and solutions, we expect to see even more exciting projects published that will counter all the issues of the current blockchain. Layer 2 blockchains also provide newcomers and small companies a platform to develop smart contracts on their blockchain with low and forgiving transaction fees. If you're interested in the in-depth workings of specific layer 2 chains or solutions, you can DYOR (Do Your Own Research) up on each respective layer 2 chain's website.