EngEd Community

Section’s Engineering Education (EngEd) Program fosters a community of university students in Computer Science related fields of study to research and share topics that are relevant to engineers in the modern technology landscape. You can find more information and program guidelines in the GitHub repository. If you're currently enrolled in a Computer Science related field of study and are interested in participating in the program, please complete this form .

Understanding Layer-2 Blockchain

March 23, 2022

Since the release of Bitcoin, blockchains have gained more popularity. Excluding payments, blockchain has broader application areas since it is highly decentralized and secure.

No single blockchain can provide decentralization, security, and scalability in achieving optimal functionality. Most tend to sacrifice some of these elements.

Bitcoin and Ethereum platforms are good examples. These platforms are competing to offer a secure, scalable and decentralized system. This has led to the discovery of solutions such as layer-2 protocols.

In this article, we will cover layer-2 blockchain solutions and explain how the layer-2 protocols work and why they are used in the blockchain network.

The concept of layer-2 blockchain

Layer-2 blockchain network operates on top of another network forming a secondary protocol. The layer-2 blockchain is different from the layer-1 blockchain since it does not depend on the layer-1 protocols (base layer).

The purpose of layer-2 protocols is to assist in validating transactions thus minimizing the tasks handled by the base layer. These protocols allow the blockchain network to process transactions faster. This gives the network ability to accommodate and manage many users.

Blockchain transactions are generally slow compared to the usual payment methods. The performance usually depends on the blockchain structure. Generally, blockchain transactions go through various phases before they are approved and completed. Some of these phases include acceptance, mining distribution, and validation.

The layer-1 blockchain handles the activities that deal with transactions validation. However, this impacts the processing speed, which affects the blockchain’s scalability and experience. Layer-2 blockchain supports the layer-1 blockchain by relieving it from specific tasks. This enables layer-1 blockchain to deal with specific functions such as security and control.

The layer-2 blockchain reports to the layer-1 blockchain because layer-1 confirms every transaction to ensure the security of a network.

Most used layer-2 blockchain protocols

Below are some of the most used layer-2 blockchain protocols:

Nested blockchains

Nested blockchains consist of the main chain and secondary chains designed such that a chain can operate on top of the other. The purpose of the main chain is to assign tasks and take control of all the parameters. The secondary chains then perform the transactions.

To better understand the analogy, let’s use a company as an example. The supervisor can assign a huge task to several team members instead of a single individual. Upon completing the task, the team members can report to the manager to approve and mark the work as complete.

The nested blockchain ensures that a primary chain can assign several secondary chains with tasks. Upon completing the assigned task, the chains can report back for approvals.

State channels

In the state channels, parties interact directly in the blockchain network. Blockchain users can perform transactions without involving the primary chains. The miners spend minimal time, leading to fast processing rates.

State channels do not need the transactions to be validated by the layer-1 blockchain. This is because validations of the resource are done through the smart-contract mechanism. Upon successful completion of the transaction, the resulting state is stored on the primary layer.

State channels protect the transaction details that are exchanged between different parties. However, the final transaction details are stored in the ledger to be accessed publicly to maintain records.

Sidechains

A sidechain is a side blockchain linked to the primary chain using a two-way peg. We look at it like a forest where the trees can act as sidechains, and the forest itself is the primary chain. They are designed to handle a large batch of transactions.

A sidechain assists the primary chain with validating various transactions in the blockchain. The primary chain then has ample time to deal with security and resolve disputes.

Sidechains are not the same as state channels. The reason is that they store the transactions records on a ledger that can be publicly accessed.

This means that if the sidechain is attacked, it cannot affect the primary chain’s operations. However, sidechains involve much time and a significant amount of effort to design and build.

Rollups

These are layer-2 protocols that perform computations off the primary chain. In this blockchain, transaction details transfer occurs after a given time interval. This assists in maintaining records.

Also, rollups handle transactions without interfering with the primary layer. This leads to higher throughput at minimal transaction costs. Since transaction details of the rollups are stored on the primary layer, the rollup’s security can be guaranteed.

Optimistic rollups

Optimistic rollups ensure that every transaction performed on the blockchain is valid.

However, in most cases, optimistic rollups take a considerate amount of time to confirm the transactions. This waiting period gives rollups ample time to resolve a dispute if a challenge arises.

Zero-knowledge rollups

They perform computations off the chain before submitting the primary chain’s validity proof. They at times use a smart contract to hold the funds on the base layer.

Funds are then released once the proof of validity has been submitted and the primary chain has validated and confirmed the transaction.

Importance of layer-2 blockchains

Below are some benefits of layer-2 protocols in the blockchain ecosystem:

Improved security

The layer-1 blockchain solutions rewrite the base layer protocol for more scalability. This is by adding blocks into the chain network or increasing the speed of validating new blocks.

However, it is never a good practice to interfere with the architecture of a blockchain. It can lead to serious security concerns of the chain network.

The layer-2 blockchain solutions solve the security challenge. Since the layer-2 solution has been made to compliment the base layer, no change is made to the base layer. Therefore, no change is made to the underlying protocol.

Increased transaction speed

In layer-2 protocols, a transaction is handled off-chain. This minimizes the chain’s workload, increasing the blockchain speed and scalability.

As mentioned earlier layer-2 solutions also relieve the main chain from performing tasks. So, the main chain can focus on the blockchain’s security and decentralization.

Furthermore, the layer-2 protocols can be enhanced to handle computations faster. This leads to increased throughput.

Increased scalability

The layer-2 blockchain was designed to provide scalability to the blockchain’s applications. The off-chain protocols ensure a higher throughput of the blockchain network.

This ensures that the blockchain’s applications can be scaled with ease so the users can enjoy a great experience regardless of the blockchain’s network load.

Reduced transaction fees

In a blockchain network, miners are responsible for transactions validation. It means that the miners utilize the blockchain’s cryptographic algorithms to perform validations.

This process involves huge computing power as the users join the blockchain network. As a result, the transactions performed tend to grow in size hence jamming the whole system.

However, the miners may not have the required processing resources required. Thus, they are left with the option of using the transactions that have costly fees.

The layer-2 blockchain minimizes the processing resources needed to handle the validations. This reduces the transaction costs since the miners can process more transactions.

Conclusion

The layer-2 solution is the main gateway towards decentralizing the blockchain network. The protocols provide miners with adequate computing resources and reduced transaction fees.

With layer-2 protocols, blockchain can also be integrated into global commerce. This can assist in building networks useful in different industries.

Further reading


Peer Review Contributions by: Collins Ayuya