Layer 2 Explained – What are Layer-2 Solutions?

Written by Ivan on Tech

July 8, 2021

Following a sharp rise in demand for decentralized applications (dApps), recent months have seen an unprecedented number of scaling solutions developed on the Ethereum blockchain. This includes protocols such as rollups, Plasma, state channels, and sharding. Ethereum scaling solutions created on top of the blockchain are referred to as ‘layer-2’ or ‘layer 2’ solutions. As there is no distinction between the two, we will be referring to both layer-2 and layer 2 scaling solutions throughout this article. There are various types of Ethereum layer 2 protocols, but how do they work? Also, how do layer-2 scaling solutions benefit the main Ethereum blockchain? Plus, what’s the difference between layer 1 and layer 2 scaling solutions?

In this article, we’re going to dive deep into different types of Ethereum layer 2 protocols created as scaling solutions. Also, we’ll explore why Ethereum needs layer 2 solutions, and how these scaling solutions work. Plus, we’ll discuss the differences between layer 1 and layer 2 protocols. 

To discover how blockchain technology operates on a fundamental level, check out our Blockchain & Bitcoin 101 course! Ivan on Tech Academy is the perfect place to learn the basics of this cutting-edge technology! See our Ethereum 101 course to learn about the Ethereum Virtual Machine (EVM), the account-based model, smart contracts, and more! Join a community of over 30,000 like-minded students today, at Ivan on Tech Academy! 

What are Ethereum Layer-2 Scaling Solutions?

‘Layer-2 scaling’ has become a hot topic within the crypto community recently. But, what are Ethereum layer-2 scaling solutions? 

Blog Ethereum L2 Scaling Solutions ETH Logo

The phrase is an umbrella term that refers to a collection of solutions that ultimately improve the user experience when interacting with the Ethereum blockchain. The Ethereum blockchain is the second-largest in the industry, hosting the majority of decentralized finance (DeFi) platforms in existence. Decentralized applications (dApps) built on the Ethereum main chain are known as “layer 1” or “L1” applications as the smart contracts interact directly with the native chain. 

Layer 2 refers to a series of different protocols that facilitate the creation of smart contracts and decentralized applications (dApps) on top of the core Ethereum blockchain. Through various means, smart contracts and transactions are largely executed outside of the Ethereum main chain. However, this is achieved whilst maintaining the full network security of the core layer 1 chain.

Layer 2 scaling solutions are protocols that allow developers to build applications with faster transaction finality and cheaper gas costs than if they were to build on the layer 1 chain. There are various types of scaling solutions for Ethereum that will assist in the rollout of Ethereum 2.0. This includes both layer 1 solutions (implementing scaling protocol updates on the main Ethereum chain such as sharding) and layer 2 solutions (such as state channels and rollups largely executing transactions off-chain, explained further on). For Ethereum to be suitable for global enterprise and mass adoption, there first needs to be improvements that facilitate scaling. In short, Ethereum needs to keep up with user demand, whilst accommodating the various types of users and transaction requests.

Why Do We Need Layer 2 Solutions?

It is widely accepted that for the mass adoption of DeFi to become a reality, blockchains need to be scalable, secure, and decentralized. Ethereum, the world’s largest smart contract-enabled blockchain, saw record usage throughout 2020. The “Summer of DeFi” that brought about a wave of decentralized finance (DeFi) protocols resulted in extreme network congestion. This was a positive indicator for the industry as a whole. However, it did outline some of the major hurdles that need to be overcome for these protocols to become mainstream.

Blog Ethereum L2 Scaling Solutions Graphic

Firstly, the network congestion experienced by users of Ethereum-based platforms resulted in extremely high gas fees. Secondly, this meant that transactions took much longer than normal to be processed and finalized.

Though there are many ways to achieve faster transaction throughput and confirmations, this often comes at a cost. Until recently, more transactions per second (TPS) generally meant a reduction in security and decentralization. This trade-off has been debated for several years and has informed Ethereum’s transition from a Proof-of-Work (PoW) consensus algorithm to Proof-of-Stake (PoS).

However, this is likely to take several months, if not years to complete. Ethereum 2.0 is expected to be completed in stages, rather than a single grand launch. Resultantly, many projects are harnessing the security of the Ethereum blockchain by building what are known as “layer 2 solutions”, or “layer-2 solutions”, depending on who you ask. 

This term refers to a smart contract, or series of smart contracts, running on top of the main Ethereum chain, or “layer 1” (L1). Layer 2 (L2) solutions can interact with the Ethereum blockchain without making changes to the base level protocol. Resultantly, L2 solutions can make interacting with Ethereum much faster, and more cost-effective.

Ethereum Layer 1 vs Layer 2 Solutions

As previously mentioned, there are two types of Ethereum scaling solutions; layer 1 and layer 2. The difference is whether or not the solution is implemented on-chain from within the core Ethereum blockchain or as a protocol on top of the chain. The latter are sometimes referred to as “off-chain” solutions. The majority of scaling solutions for Ethereum are implemented on top of the blockchain, removing the need for as much computational power and demand as the layer 1 chain. 

Blog Ethereum L2 Scaling Solutions Layer1 vs Layer2

However, there are three main layer 1 solutions for Ethereum. These are sharding, the new Casper consensus model, and eWASM (Ethereum flavored Web Assembly). eWASM is designed to replace the current Ethereum Virtual Machine (EVM1), improving the smart contract development experience for developers. This includes faster run times, the inclusion of popular programming languages (such as Rust, Go, C++), and the availability of a wide range of WebAssembly tools. 

Casper is Ethereum’s new Proof-of-Stake (PoS) consensus mechanism. Introducing a PoS consensus model not only drastically reduces wasted resources, but also creates opportunities for further scaling of the network. Largely, sharding. 

Sharding

Sharding is a process whereby the entire Ethereum network is segmented into various ‘shards’, which operate as if they were their own individual blockchains. Each shard will have multiple transactions bundled together and validated simultaneously through the secure Proof-of-Stake (PoS) consensus mechanism. Then, once verified, the reference of the state of the shard is stored on the main layer 1 chain. Shards are validated by random nodes, with each node assigned one individual shard. Resultantly, sharding drastically reduces the time for transaction finality, storage being used by the miners, and thus gas costs to the end-users. 

Blog Ethereum Layer 2 Scaling Solutions Sharding

Upon the complete launch of Ethereum 2.0 and sharding, we can expect to see 64 shards of the Ethereum blockchain. In late 2020, according to Consensys, the Ethereum Foundation hoped to achieve sharding “sometime in 2021”. However, the unexpected delays around the launch of the Beacon Chain have pushed back the introduction of shards. The latest from Ethereum.org suggests we could begin seeing the implementation of sharding from the beginning of 2022. If you’d like to learn more about how sharding is helping scale Ethereum, save our ‘Sharding Explained’ article for later.

Different Ethereum Layer-2 Scaling Solutions

Now you understand how Ethereum is scaling from the core, we are going to explore above and beyond the layer 1 chain within the Ethereum Network. Below we’ve discussed the novel layer-2 scaling solutions being implemented by Ethereum.

State Channel 

A state channel allows users to transact off-chain multiple times, while only submitting two on-chain transactions to the Ethereum network. This means that a state channel can facilitate extremely high throughput. 

To use a state channel, participants are required to lock up a portion of Ethereum’s state. This can be achieved by depositing Ether (ETH) into a multisig contract that requires multiple signatures from multiple private keys to execute. This allows the initial transaction of the contract to open up a “channel”. Resultantly, participants can transact off-chain very quickly and with relatively little cost. Then, when the transaction is finalized, a single on-chain transaction can be submitted to the Ethereum blockchain to unlock the state. 

This is particularly useful when the number of participants is known in advance, when many state updates are required, and when participants are available at all times. Any applications that utilize state channels can process a great deal of computation off-chain, making complex transactions faster, and cheaper. This is because computations that occur off-chain do not incur the same gas fees as on-chain computations. Rather, a single transaction fee is paid when the final state is submitted as a list of transactions, closing the channel. 

Blog Ethereum Layer-2 Scaling Solutions State Channels

Also, payment channels offer a simplified version of state channels that deal only with payments. Payment channels enable off-chain asset transfers between two users, providing the net sum of transfers doesn’t exceed that of the tokens deposited.

State channels can be a great way to instantly withdraw assets or settle transactions on the mainnet as they facilitate high throughput with minimal costs. Plus, state channels are ideal for high-frequency micropayments. However, state channels may not be suitable for occasional transactions. Furthermore, state channels require the network to be monitored to ensure the security of funds and don’t support open participation. 

Rollups

Rollups are a type of layer 2 solution that post transaction data on the main Ethereum chain, but execute transactions outside of it. They are given this name because they effectively “roll-up” several transactions into one single transaction. 

Furthermore, rollups require a bond to be staked in a rollup contract by “operators”. This is to incentivize the correct execution and verification of transactions. There are two different types of rollups, each with different security models and features.

Zero Knowledge Rollups (ZK-Rollups)

Zero knowledge rollups, (ZK-rollups) are smart contracts that bundle, or “roll-up” multiple transactions outside of the layer 1 chain before generating a cryptographic proof called a SNARK (succinct non-interactive argument of knowledge). This is what is known as a “validity proof”, which is posted on layer 1. ZK-rollups keep the state of all transactions on layer 2. The only way this state can be updated is with a validity proof. 

Blog Ethereum Layer 2 Scaling Solutions ETH Graphic

This means that ZK-rollups don’t require all transaction data to validate blocks, thus, making the process faster and cheaper. ZK-rollups run computations off-chain before submitting a validity proof to the Ethereum blockchain. Because transactions are posted on layer 1, ZK-rollups inherit the security of the main Ethereum chain. Furthermore, ZK-rollups allow for near-instant asset transfers from layer 2 to layer 1 as funds are verified by a validity proof.

Also, because ZK-rollups reside on layer 2, they can drastically reduce the size of a transaction by representing an address as an index. Plus, ZK-rollups write transactions onto the main Ethereum chain as calldata, which reduces gas fees. However, not all ZK-rollups have Ethereum Virtual Machine (EVM) support. Moreover, validity proofs are computationally intensive, meaning that they may not be the best choice for applications that create little on-chain activity.

Currently, there are several implementations of ZK-rollups that can be integrated into decentralized applications (dApps) and Ethereum layer 2 protocols. These include Aztec 2.0, Hermez network, Loopring, Matter Labs, zkSync, Starkware, and zkTube.

Optimistic Rollups

Running in parallel to the main Ethereum chain, Optimistic rollups reside on layer 2. Optimistic rollups allow for improved scalability as they do not execute computations by default. Rather, they “notarize” transactions as a new state is proposed to the mainnet. Also, transactions executed using Optimistic rollups are written onto the Ethereum blockchain as calldata, which lowers gas fees.

Blog Ethereum L2 Scaling Solutions Optimistic Rollups

When using Ethereum natively, computations can be slow and expensive. However, using Optimistic rollups can massively improve scalability. Furthermore, the introduction of shard chains is likely to make scaling with Optimistic rollups even more effective, as more data will be available in the event of a transaction dispute.

Optimistic rollups assume the validity of transactions by default and use “fraud proofs” for disputing transactions. Because Optimistic rollups don’t execute transactional computations, the fraud proof mechanism is required to prevent fraudulent transactions. If an operator suspects a fraudulent transaction, an Optimistic rollup will execute a fraud proof. This is usually the only event in which Optimistic rollups run computations. Resultantly, transactions using Optimistic rollups can take longer to finalize than they would when using ZK-rollups. Plus, Optimistic rollups can be more vulnerable to attacks than ZK-rollups. However, both types of rollup are used in various Ethereum layer 2 protocols.

Plasma 

Plasma chains are separate blockchains that are anchored to the main Ethereum chain. As with Optimistic rollups, plasma chains also use fraud proofs for dispute arbitration. Plasma chains are sometimes referred to as “child chains”. This is because they are effectively small copies of the Ethereum mainnet

Also, stacking up several plasma chains creates a “Merkel tree”. Merkel trees allow for any number of plasma chains to work together to offload bandwidth from parent chains, including the Ethereum mainnet. Moreover, each child chain has its own block validation mechanism, and each Merkel tree is secured using fraud proofs.

Blog Ethereum Layer 2 Scaling Solutions Plasma Chains

Plasma is sometimes preferable to state channels as Plasma has lower capital requirements. Also, Plasma allows participants to transfer assets to addresses outside of the system, whereas state channels do not. However, Plasma doesn’t support general computations. Rather, Plasma only supports basic token transfers and swaps, plus a handful of other transaction types that are supported by predicate logic.

If you’re interested in learning how to build on Ethereum, Ivan on Tech Academy can help you achieve this goal! See our Ethereum Smart Contract Programming 101 course to get started with the basics of the Solidity programming language. For readers with no programming experience, we’ve got you covered! Start with our JavaScript Programming for Blockchain Developers, designed for beginners. Then, you’ll be able to move on to more advanced blockchain programming languages. Discover the infinite development opportunities at Ivan on Tech Academy today!

Sidechains

Sidechains act as a sort of hybrid scaling solution, combining elements of both layer 1 and layer-2. As opposed to other layer 2 solutions that harness the security of the main Ethereum chain, Sidechains have their own security properties. This means that Sidechains don’t need to interact with the layer 1 chain. Also, Sidechains use their own consensus mechanisms to validate transactions. A great example of this is Polygon/Matic Network, which has seen a surge in adoption in recent months. Polygon/Matic uses the public Plasma checkpoint nodes as a deposit bridge from the Ethereum mainnet to the Matic sidechain. Other hybrid solutions include Celer and Arbitrum.

Blog Ethereum Layer 2 Scaling Solutions Sidechains

Ethereum Layer 2 Scaling Solutions Summary

The crypto industry as a whole has seen a tremendous increase in users and engagement with decentralized finance (DeFi) platforms. Equally, the network activity on the world’s largest smart contract-enabled blockchain has seen a huge uptick. To ensure that Ethereum can keep up with the ever-increasing user demand, the Ethereum Foundation is implementing various novel scaling solutions. Mostly, Ethereum scaling solutions complete transaction validation and computations off-chain, referred to as ‘layer 2’ or ‘layer-2’ protocols. 

Blog Ethereum Layer 2 Scaling Solutions Project List

These layer-2 scaling solutions offer developers a fresh experience with decentralized application (dApp) development by providing increased scalability and lower-cost usage. Moreover, end-users benefit from a speedy user experience, with transaction finality occurring within seconds, not minutes. The different Ethereum scaling solutions such as rollups, Plasma, state channels, and sharding, also help miners to save storage, increasing efficiency, overall productivity, and rewards. 

As the second-largest blockchain in the industry, Ethereum is host to many enterprise-based applications. If you’re interested in learning more about the enterprise adoption of blockchain, and how you can get involved, see our Blockchain Business Masterclass! Also, our Blockchain for Enterprise course shows students how global corporations are benefiting from Baseline Protocol. Learn how to go full-time crypto and work in the blockchain industry, at Ivan on Tech Academy. Also, don’t forget to follow us on Twitter @Academy_IOT! We’d love to hear about your favorite layer-2 scaling solution for Ethereum! 

Search
Generic filters
Filter by Categories

Share this article

Share on facebook
Share on twitter
Share on linkedin
Share on reddit

Become Blockchain Certified Today

CLAIM YOUR

20% OFF

DISCOUNT

Log In

Sign in to your account and start learning!

IOT icon header