Your Guide To Blockchain: Layer 2

Your Guide To Blockchain: Layer 2

Blockchain 101
September 12, 2022 by Diana Ambolis
1452
To begin with, we must define layer 1: The foundational layer, or underpinning structure, of a blockchain, is a layer 1 network. As shown in examples like Ethereum, Bitcoin, and Solana, the primary network, usually referred to as the “mainnet,” establishes not only the fundamental principles of the ecosystem but also can validate and complete
Your Guide To Blockchain: Layer2

To begin with, we must define layer 1: The foundational layer, or underpinning structure, of a blockchain, is a layer 1 network. As shown in examples like Ethereum, Bitcoin, and Solana, the primary network, usually referred to as the “mainnet,” establishes not only the fundamental principles of the ecosystem but also can validate and complete transactions.

Decentralization and security, two fundamental principles of any solid network, are frequently emphasized from the beginning of layer 1 blockchains. These principles are maintained, with certain exceptions, by a diversified, global network of creators and participants, such as validators.

These platforms need the technology to have an inherent level of security because there is no central authority or control protecting consumers against scams and threats. Additionally, they have frequently lacked scalability due to this design priority and the enormous resources required to sustain a fully operating ecosystem.

While some developers contend that the Blockchain Trilemma—the difficulty of balancing security, decentralization, and scalability—is an unavoidable weakness of the technology, layer 2 solutions, including rollups on Ethereum and the lightning network on Bitcoin, offer one way to address these problems.

How do layer 2s work?

On top of layer 1s, layer 2 refers to a collection of off-chain solutions (distributed blockchains) that alleviate scale and data bottlenecks. Consider a restaurant kitchen where just a few orders could be filled every hour if each order had to be completed by a single worker from start to finish before being confirmed and delivered. But layer 2s are more like prep stations, where each station can concentrate and do each operation much more quickly. For example, there is a station for washing and chopping food, a station for cooking, and a station for assembling the dishes. When appropriate, the last person can validate the order and match each completed dish to it before it is delivered to its destination (the customer).

Visa and other payment processors utilize the technology. Visa aggregates thousands of daily microtransactions from a retailer like Starbucks into batches settled in the banking system at regular intervals rather than managing them separately, which would bottleneck the network in minutes. The banks then use their internal version of a settlement layer to store and organize transactions. Visa would be a layer 2 in this scenario. In contrast, layer 1 would be the larger network of institutions and the government that determines the financial industry’s rules and maintains track of transactions.

Similar features of Ethereum include optimistic and zero-knowledge (ZK) rollups, which relieve the mainnet’s management of transactions and increase throughput and inclusion of transactions (higher transactions per second). The result is a more seamless and useful user experience. On Ethereum, solutions like Arbitrum, Optimism, Loopring, and zkSync are examples of layer 2s.

What makes layer 2s crucial?

While layer 1, or the mainnet, of Ethereum, operates with decentralization and security as a guiding principle, market growth over time has led to the network’s current capacity of little over 1.5 million daily transactions. Furthermore, because the mainnet can only handle 15 transactions per second, data congestion is a common result during moments of high network activity. As a result, gas (transaction fees) increase, and applications perform slowly, as was most recently observed during the bull market of 2021 and the Yuga Labs Otherside virtual land sale.

Layer 2 extends Ethereum as a distinct blockchain over the layer one network to address these problems. It communicates and assists in offloading the significant volume of transactions from the mainnet through smart contracts that incorporate and gain from Ethereum’s strong decentralized security mechanism, as was already mentioned. In essence, Layer 1 deals with decentralization, security, and data availability, while Layer 2s deals with scale for transactions.

Generally speaking, layer 1 blockchains have:

  • A node network to safeguard and verify the network.
  • A group of makers of blocks.
  • Data on transactions and the blockchain in general.
  • A related consensus process.

Layer 2 is unique in that it offers:

Lower fees: Layer 2s combine several off-chain transactions into a single layer 1 transaction, which reduces the amount of data required. By completing transactions on the mainnet, they maintain decentralization and security.

More utility: Layer 2 initiatives can concentrate on enhancing user experience and broadening the range of applications thanks to the advantages of larger transactions per second and reduced costs taken together.

As already stated, decentralization is the primary cause of scalability problems. Transactions and data management with blockchains must go through a sequence of orderly procedures that ensure security and transparency throughout, such as acceptance, verification, and dissemination on a network with thousands of members, in contrast to traditional banks, which have a closed and more effective method of regulating payments.

To compete with (and eventually replace) the more simplified but constrained channels of systems like Visa and Mastercard, networks like Ethereum must have a layered and scalable design. Layers 1 and 2 are significant because they cooperate to speed up and improve the usability of the network.

How is layer 2 implemented?

Layer 2 protocols offer a second framework where transactions can be carried out independently of layer 1 transactions. As a result, a sizable portion of the main chain’s work can be transferred to the second layer. The information from layer 2 applications is subsequently posted to layer 1 where it is safeguarded in the blockchain ledger and history.

The accessibility of layer 2s varies, just like that of other open or restricted platforms. Some apply to various applications, while others are only tailored to the requirements of a single project. Rollups and sidechains are two of the important elements that layer 2s use, though.

Rollups in layer 2

A rollup is a particular layer 2 solution that executes numerous transactions outside of layer 1, compiles those transactions into a single compressed piece of data, and then publishes the data back to the mainnet for anybody to evaluate and contest if it appears suspicious. Rollups can thus exploit Ethereum’s security while lowering gas costs by up to 10-100.

Rollups all assist with deposits, withdrawals, and proof verification. However, there are slight differences in how rollups, like Optimism and ZK rollups, transmit data back to layer 1.

Optimistic rollups

Optimistic rollups operate all transactions in parallel with the main Ethereum chain before posting the results to layer 1. Due to the aggressively low costs, users are encouraged to do transactions on these layer 2s. A suspected fraudulent transaction can be contested and evaluated using fraud proofs. In this case, the roll-up will execute the transaction’s computation using the readily available state information. This indicates that it will take a little bit longer to exit the rollup and withdraw money back to layer 1 than it would for ZK rollups (see below). However, users “within” the rollup will continue getting quick transaction confirmation.

The Ethereum Virtual Machine (EVM) and solidity are generally compatible with optimistic rollups, which means that anything feasible on layer 1 of Ethereum can be reproduced on layer 2. The rollups Arbitrum, Optimism, and Boba are a few illustrations of optimistic rollups.

ZK Rollups

ZK rollups produce cryptographic proofs to verify the integrity of transactions, in contrast to Optimistic rollups. These proofs are known as validity proofs, SNARKs (succinct non-interactive arguments of knowledge), or STARKs (posted to layer 1). (scalable transparent argument of knowledge).

Because ZK rollups keep track of all transfers on layer 2, which are only updated through validity proofs, they are more effective. It is simpler to validate blocks and move ether (ETH), the primary token of the Ethereum blockchain, to layer 1 because ZK rollups don’t require the whole transaction data. The ZK rollup contract’s validity evidence, which was accepted, has already confirmed the legitimacy of the transactions. They do not, however, fully support EVM. Therefore running computations for applications with limited on-chain activity is more time-consuming.

Also Read: Here are top DeFi and NFT Projects to Keep a Track in 2022

Sidechains

A sidechain is a separate, EVM-compatible blockchain that operates in parallel and communicates with the mainnet through bridges, as demonstrated by projects like XDai and Polygon PoS. They are not technically layered 2 because they employ a different consensus process and are not protected by layer 1. However, because it mimics the EVM, the chain functions like Ethereum. Due to users’ reliance on sidechain operators over the Ethereum protocol, higher hazards are associated with them (or a proper layer 2).

Validiums

Validiums, like StarkWare, don’t save the data on layer 1 but employ validity proofs (similar to ZK rollups). Each validity chain can handle about 10,000 transactions per second and operate in parallel with other chains. There is, however, little support for universal smart contracts due to the need for more specialized languages.

Both sidechains and validiums are blockchains that work with assets through bridges that connect to the mainnet, running concurrently with Ethereum. They are not regarded as legitimate layer 2 like Optimistic or ZK rollups because they do not benefit from the security or data provided by Ethereum. Given the possible security and trust issues, this is especially the case. Both, however, scale-like layer 2s by providing cheap transaction costs and high throughput.

Why are layer 2s so prevalent?

To avoid any overdependence or the potential collapse of a single component of the network, numerous layer 2 channels have been developed. The ecosystem is always changing, and some applications—such as Plasma and State Channels—end up being abandoned, as we’ve already explored the three primary layer 2s (optimistic rollups, ZK rollups, and sidechains).

Common layer 2 examples

Overall, the numerous choices, which anybody may construct, offer a broader, more balanced range of possibilities for end users as layer 2s harmonize and cooperate with the overall Ethereum ecosystem. What one layer 2 blockchain lacks, another layer 2 blockchain can make up for, and vice versa. The more popular layer 2s are listed below in brief:

Common layer 2s

A universal layer 2 project offers lower costs while mirroring the functionality and performance of Ethereum’s mainnet (gas). Several instances include:

Optimism

Optimism is an EVM-equivalent system that leverages Optimistic rollups to make transactions quick, easy, and secure even though a new fraud-proof mechanism is still being developed.

One Arbitrum

Another optimistic rollup that mimics the behavior of the Ethereum mainnet but with lower transaction costs is Arbitron.

Network Boba

Boba, an Optimistic rollup initially forked from Optimism, promises to lower fees, increase transaction throughput, and boost the functionality of smart contracts.

Plasma

The Ethereum research group Plasma Group declared it terminated operations in its current form and donated the leftover cash to Gitcoin in a blog post published in January 2020. Instead, it was decided to concentrate on Optimistic rollups.

As demonstrated by initiatives like Polygon, OMG Network, and Gluon, plasma chains are distinct blockchains connected to the Ethereum mainnet. They employ fraud-proof techniques, such as optimistic rollups, to control conflicts and oversee security. They are also called “child chains” because they are scaled-down versions of the Ethereum mainnet. Merkel trees allow for an infinite stack of these chains, which can be used to offload the mainnet and other parent chains’ heavy data traffic. Plasma is only helpful for transfers; it cannot be used for arbitrary contracts. Due to this, as well as problems with high expenses and the inability to withdraw money from a plasma chain, optimistic rollups were chosen instead.

Channel states

State channels are established paths between two users who want to interact with one another through transactions. Participants can freely transact off-chain and settle with the mainnet using multi-signature contracts, which need the signatures of several parties to be executed. High transaction throughput is made possible, and congestion and costs are reduced. State channels and payment channels are the two primary categories of channels. However, it was also largely abandoned because of the rigidity of the need for users to lock up cash and the lack of support for all-purpose smart contracts and DeFi apps in 2021. Teams still working on it include CelerX Connext Network, according to Ethhub. Raiden Network might also be close to or already in development.

Additional layer 2 materials and ideas

Compared to conducting business on the mainnet, there are still hazards and various degrees of false trust assumptions because these layer 2 platforms are still in their infancy. It’s also important to remember that, despite using layer 1 security, layer 2s are only fully secure if fraud proofs are enabled, which they are not (as of this writing).

Blockchain bridges, which allow users to move assets to layer 2, are still under development and come with significant risks. In light of this, it is advised to conduct rigorous research using tools like L2BEAT before interacting with any layer 2. The goal of L2BEAT, a thorough risk and analysis tool is to inform consumers about projects that adhere to their exacting standards and strict definitions of what it takes to be a layer 2.