Deep Dive: What are Layer 2s?

Dan Espinoza
Embr
Published in
9 min readSep 27, 2023

--

Blockchain technology has undoubtedly revolutionized the world of finance and decentralized applications. However, the remarkable success of blockchain has not come without its challenges, most notably in the realms of scalability, speed, and transaction costs.

Enter Layer 2 solutions, the innovative off-chain counterparts that promise to elevate blockchain technology to new heights. In this article, we will delve into the fascinating world of Layer 2s, exploring what they are, why they are crucial, and how they function.

The Foundation: Layer 1

Before we dive into the intricacies of Layer 2 solutions, let’s first establish a foundational understanding of what Layer 1 represents in the blockchain universe. Layer 1, often referred to as the main network or “mainnet,” serves as the bedrock upon which blockchain ecosystems are built. It embodies the core rules of the blockchain and possesses the capability to validate and finalize transactions. Notable examples of Layer 1 blockchains include Ethereum, Bitcoin, and Solana.

One of the defining features of Layer 1 blockchains is their unwavering commitment to decentralization and security. These principles are the cornerstones of any robust blockchain network and are upheld by a diverse global network of developers and participants, including validators. In essence, Layer 1 blockchains prioritize security and decentralization above all else, which, while commendable, has often resulted in a trade-off with scalability.

The Blockchain Trilemma

The challenge of achieving a harmonious balance between security, decentralization, and scalability has been a persistent conundrum in the blockchain world. This dilemma, often dubbed the “Blockchain Trilemma,” has left many developers pondering whether it is an insurmountable flaw of the technology.

Layer 2s: A Beacon of Hope

Fortunately, the blockchain community is not one to shy away from challenges. Layer 2 solutions have emerged as a compelling answer to the Blockchain Trilemma. These innovative off-chain solutions, which exist on top of Layer 1 blockchains, address scalability and data bottlenecks, unleashing the true potential of blockchain technology.

Deciphering Layer 2s

Layer 2, at its core, represents a collection of off-chain solutions or separate blockchains that are constructed atop Layer 1 blockchains. To grasp the significance of Layer 2, imagine a bustling restaurant kitchen. If a single person had to handle every aspect of meal preparation, from start to finish, the process would be excruciatingly slow, with only a few orders fulfilled per hour. Layer 2s, on the other hand, function like well-organized kitchen stations. Each station specializes in a particular task, such as food preparation, cooking, or assembly, allowing for much greater efficiency. When the time is right, a final person matches each completed dish with the respective order, confirming it before sending it to its destination — the customer.

This concept of layering and efficient division of labor is not exclusive to blockchain; it finds parallels in systems like Visa, a leading payment platform. Visa employs a similar approach by aggregating numerous daily microtransactions from vendors, such as Starbucks, into batches that are settled within the banking system at regular intervals. This settlement process occurs within the internal equivalent of a “settlement layer” maintained by banks. In this analogy, Visa serves as Layer 2, while the broader network of institutions and governments that oversee transactions and define financial industry rules constitutes Layer 1.

Ethereum’s Layer 2 Journey

Ethereum, one of the foremost players in the blockchain arena, has also adopted Layer 2 solutions to tackle scalability issues. Notable among these solutions are Optimistic rollups and zero-knowledge (ZK) rollups, which offload the transaction management burden from the mainnet. This approach facilitates greater transaction inclusion and boosts throughput, resulting in a more seamless and user-friendly experience.

Examples of Layer 2 solutions within the Ethereum ecosystem include Arbitrum, Optimism, Loopring, and zkSync. These solutions have gained prominence for their ability to enhance Ethereum’s scalability and transaction processing capacity.

The Significance of Layer 2s

While Layer 1 networks like Ethereum prioritize decentralization and security, their increasing popularity has led to a saturation point. Ethereum, for instance, can currently handle just over 1.5 million daily transactions, with a throughput of approximately 15 transactions per second. During periods of high network activity, data congestion ensues, causing gas fees to soar and application performance to suffer. This was notably observed during events like the Yuga Labs Otherside virtual land sale and the 2021 bull market.

Layer 2 solutions offer a lifeline in such situations by extending the capabilities of Layer 1 networks. They act as intermediaries that communicate with and alleviate the mainnet’s transaction processing load through smart contracts that leverage Ethereum’s robust decentralized security model. In essence, Layer 1 handles security, data availability, and decentralization, while Layer 2s focus on scaling-related aspects of transactions.

Layer 1 vs. Layer 2

To appreciate the significance of Layer 2, it’s essential to understand the key distinctions between Layer 1 and Layer 2 blockchains:

Layer 1 Blockchains:

1. Maintain a network of nodes to secure and validate transactions.
2. Employ a network of block producers.
3. Store the main blockchain and transaction data.
4. Rely on an associated consensus mechanism.

Layer 2 Blockchains:

1. Offer lower fees by bundling multiple off-chain transactions into a single Layer 1 transaction, reducing data load.
2. Provide greater utility through higher transactions per second and lower fees, enabling improved user experiences and expanding application scope.

The scalability challenges primarily arise from the decentralized nature of Layer 1 blockchains. Unlike traditional financial institutions, which employ closed and efficient payment regulation methods, blockchain networks must navigate complex processes, including acceptance, verification, and distribution across a vast network of participants while maintaining security and transparency. Layer 1s and Layer 2s are pivotal because they collaborate to enhance network speed and user-friendliness.

Demystifying Layer 2 Functionality

Now that we have a comprehensive understanding of Layer 1 and Layer 2, let’s delve deeper into how Layer 2 protocols operate.

Layer 2 Protocols

Layer 2 protocols introduce a secondary framework where transactions can occur independently of Layer 1. This separation allows a substantial portion of the work that would typically be performed on the main chain to migrate to the second layer. Layer 2 applications record transaction data on Layer 1, where it is securely stored in the blockchain ledger and history.

Varieties of Layer 2s

Layer 2 solutions exhibit diversity in their accessibility and functionality. While some cater to a wide range of applications, others focus on specific projects. Key components leveraged by Layer 2 solutions include rollups and sidechains.

Layer 2 Rollups

Rollups represent a specific category of Layer 2 solutions. They execute hundreds of transctions outside of Layer 1, consolidate them into a single compressed data unit, and then transmit this data back to the mainnet, where it can be reviewed and disputed if necessary. Rollups not only harness the security of Ethereum but also drastically reduce gas fees, often by factors ranging from 10 to 100 times.

Optimistic Rollups

Optimistic rollups operate in parallel with the main Ethereum chain. They process transactions independently before transmitting the

data back to Layer 1. Users are incentivized to use these Layer 2s due to their low fees. In the event of a suspected fraudulent transaction, it can be challenged and assessed using fraud proofs. While this approach may slightly extend the time required to exit the rollup and withdraw funds back to Layer 1 compared to ZK rollups, users enjoy swift transaction confirmations within the rollup.

Optimistic rollups are Ethereum Virtual Machine (EVM) and solidity compatible, enabling replication of anything achievable on Layer 1 of Ethereum. Prominent examples of Optimistic rollups include Arbitrum, Optimism, and Boba.

ZK Rollups

In contrast to Optimistic rollups, ZK rollups employ cryptographic proofs to verify transaction authenticity. These proofs, posted to Layer 1, come in the form of validity proofs, SNARK (succinct non-interactive argument of knowledge), or STARKs (scalable transparent argument of knowledge).

ZK rollups are highly efficient as they maintain the state of all transfers on Layer 2, which is updated exclusively through validity proofs. Since ZK rollups do not require the entire transaction data, validating blocks and transferring Ethereum (ETH), the primary token of the Ethereum blockchain, to Layer 1 becomes considerably more streamlined. However, ZK rollups do not offer full EVM support and are better suited for applications with minimal on-chain activity. Notable examples of ZK rollups include dYdX, Loopring, and zkSync.

Sidechains

While not technically considered Layer 2, sidechains like XDai and Polygon PoS operate as independent, EVM-compatible blockchains that run alongside the mainnet. These sidechains interact with Layer 1 through bridges, employing a distinct consensus mechanism and lacking security from Layer 1. Despite these differences, they function similarly to Ethereum, modeling the Ethereum Virtual Machine. However, it’s essential to note the higher trust and security risks associated with sidechain operators compared to the Ethereum protocol or proper Layer 2 solutions.

Validiums

Validiums, exemplified by StarkWare, utilize validity proofs similar to ZK rollups but do not store data on Layer 1. Multiple validity chains can operate concurrently, each processing approximately 10,000 transactions per second. However, due to their reliance on more specialized languages, support for general smart contracts remains limited. Both sidechains and validiums enhance scalability similarly to Layer 2s, offering reduced transaction fees and high throughput.

The Proliferation of Layer 2s

The presence of multiple Layer 2 solutions may raise the question: Why so many Layer 2s? The abundance of Layer 2 channels is a strategic move to prevent overreliance on a single facet of the network, mitigating the risk of potential network collapses. In this dynamic ecosystem, some applications thrive, while others fade into obscurity, exemplified by the rise and fall of projects like Plasma and State Channels.

Prominent Layer 2 Solutions

In the ever-evolving world of Layer 2 solutions, several options cater to the diverse needs of end users. Each Layer 2 project offers a unique set of advantages, contributing to a balanced and versatile range of choices. Let’s explore some of the most commonly used Layer 2 solutions:

General Layer 2s

General Layer 2 projects emulate the performance and functionality of Ethereum’s mainnet, offering cost-effective gas fees. Notable examples include:

1. Optimism: Optimism utilizes Optimistic rollups to provide fast, secure, and straightforward transactions.

- Risk & analysis: Link

2. Arbitrum One: Arbitrum, another Optimistic rollup, mirrors Ethereum mainnet dynamics while reducing transaction fees.

- Risk & analysis: Link

3. Boba Network: Forked from Optimism, Boba Network aims to lower fees, enhance transaction throughput, and strengthen smart contract capabilities.

- Risk & analysis: Link

Application-Specific Layer 2s

In contrast to general Layer 2s, application-specific Layer 2 networks concentrate on enhancing the performance of specific niche sectors. Examples include:

1. Loopring: A ZK rollup, Loopring maintains Ethereum mainnet’s security while boosting scalability, achieving throughput increases of up to 1000x and reducing transaction costs to a mere fraction of Layer 1 fees.

2. zkSync: Utilized by platforms like Binance, zkSync, a ZK rollup developed by Matter Labs, is live on the Ethereum mainnet, supporting payments, token swaps, and NFT minting.

Abandoned Layer 2s

Not every experiment in Layer 2 technology achieves success. Some projects aimed at addressing specific problems but failed to gain traction. Here are a couple of examples:

1. Plasma: In January 2020, the Ethereum research organization Plasma Group ceased its operations and redirected remaining funds to Gitcoin. Plasma chains, despite their potential to offload data bandwidth from parent chains like the Ethereum mainnet, faced limitations, including suitability only for transfers and challenges related to expensive costs and fund withdrawals. Consequently, they were largely abandoned in favor of Optimistic rollups.

2. State Channels: State channels, while offering high transaction throughput and reduced congestion and fees, were hindered by the need for users to lock up funds and limited support for general-purpose smart contracts and DeFi applications in 2021. However, some teams, such as CelerX Connext Network and Raiden Network, continue to work on state channel solutions.

Navigating the Layer 2 Landscape

Given the nascent nature of Layer 2 platforms, it is crucial to approach them with a degree of caution. Trust assumptions and risks can vary significantly compared to transacting on the mainnet. Furthermore, Layer 2s are genuinely secure only when equipped with fraud proofs, a feature that is not universally available at the time of this writing.

Blockchain bridges, which facilitate asset transfers to Layer 2, are still in early development stages and carry inherent risks. As such, conducting thorough due diligence is advisable before engaging with any Layer 2 solution. Platforms like L2BEAT, a comprehensive risk and analysis resource dedicated to educating users about projects that meet stringent Layer 2 criteria, serve as valuable tools for navigating this complex landscape.

Key Takeaways

Layer 2 solutions represent a transformative force within the blockchain space. These off-chain counterparts to Layer 1 blockchains offer scalability, reduced transaction costs, and improved user experiences. As the blockchain ecosystem continues to evolve, Layer 2s play an integral role in addressing the challenges of security, decentralization, and scalability. With a diverse array of Layer 2 solutions available, users have the opportunity to tailor their blockchain experiences to suit their specific needs and preferences. In this ever-evolving landscape, innovation knows no bounds, and the journey of blockchain technology is far from over.

--

--