Ethereum Layer 2 Scaling Explained

Finematics
6 min readOct 27, 2020

--

So what is Ethereum Layer 2 scaling all about? And what is the difference between projects such as Optimism, xDai, OMG and Loopring? We’ll answer all of these questions in this article.

Need For Scaling

Ethereum scaling has been one of the most discussed topics pretty much since the time when the network launched. The scaling debate always heats up after a period of major network congestion.

One of the first periods like this was the 2017 crypto bull market where infamous CryptoKitties, together with ICOs, were able to clog up the entire Ethereum network causing a major spike in the gas fees.

This year the network congestion came back even stronger, this time caused by the popularity of DeFi and yield farming. There were periods of time when even gas fees as high as 500+ gwei would not get your transaction verified for a while.

When it comes to scaling Ethereum or blockchains in general, there are 2 major ways of doing it: scaling the base layer itself (Layer 1) or scaling the network by offloading some of the work to another layer — Layer 2.

Layers 1 vs Layer 2 Scaling

Layer 1 is our standard base consensus layer where pretty much all transactions are currently settled. The concept of layers is not an Ethereum-specific concept. Other blockchains such as Bitcoin or Zcash also use it extensively.

Layer 2 is another layer built on top of Layer 1. There are a few important points here. Layer 2 doesn’t require any changes in Layer 1, it can be just built on top of Layer 1 using its existing elements such as smart contracts. Layer 2 also leverages the security of Layer 1 by anchoring its state into Layer 1.

Ethereum can currently process around 15 transactions per second on its base layer (Layer 1).

Layer 2 scaling can dramatically increase the number of transactions. Depending on the solution, we’re talking about processing between 2000–4000 tx/second.

How about Ethereum 2.0? Wasn’t that supposed to scale Ethereum?

Yes. Ethereum 2.0 introduces Proof of Stake and sharding that will dramatically increase the transaction throughput on the base layer.

Does it mean we don’t need Layer 2 scaling when Ethereum 2.0 ships?

Not really, even with sharding Ethereum will still need Layer 2 scaling to be able to handle hundreds of thousands or even millions of tx per second in the future.

This is also where the famous Scalability Trilemma comes into play. In theory, we could just skip Layer 2 entirely and focus on scaling the base layer instead. This would require highly specialized nodes to handle the increased workload which would lead to higher centralization and, therefore, lowering security and censorship-resistant properties of the network.

Sticking to the fact that scalability should never come at the expense of security and decentralization, we are left with a combination of Layer 1 and Layer 2 scaling going forward into the future.

Layer 2 Scaling Solutions

Layer 2 scaling is a collective term for solutions that help with increasing the capabilities of Layer 1 by handling transactions off-chain (off Layer 1). The 2 main capabilities that can be improved are transaction speed and transaction throughput. On top of that, Layer 2 solutions can greatly reduce the gas fees.

When it comes to actual scaling solutions there are multiple options available. Whilst some of the options are available right now and can increase Ethereum network throughput in the near to medium-term, others are aiming for a medium to long-term time horizon.

Some of the scaling solutions are application-specific, for example, payment channels. Others, such as optimistic rollups, can be used for any arbitrary contract executions.

To understand these differences better let’s explore the most popular Layer 2 scaling solutions.

Channels

Channels are one of the first widely discussed scaling solutions. They allow participants to exchange their transactions off-chain a number of times while only submitting two transactions to the base layer.

The most popular types of channels are state channels and their subtype — payment channels.

Although channels have the potential to easily process thousands of transactions per second, they come with a few downsides. They don’t offer open participation — participants have to be known upfront and users have to lock up their funds in a multisig contract. On top of that, this scaling solution is application-specific and cannot be used to scale general-purpose smart contracts.

The main project that leverages the power of state channels on Ethereum is Raiden. The concept of payment channels is also extensively used by Bitcoin’s Lightning Network.

Plasma

Plasma is a Layer 2 scaling solution that was originally proposed by Joseph Poon and Vitalik Buterin. It’s a framework for building scalable applications on Ethereum.

Plasma leverages the use of smart contracts and Merkle trees to enable the creation of an unlimited number of child chains — copies of the parent Ethereum blockchain.

Offloading transactions from the main chain into child chains allows for fast and cheap transactions. One of the drawbacks of Plasma is a long waiting period for users who want to withdraw their funds from Layer 2. Plasma, similarly to channels, cannot be used to scale general-purpose smart contracts.

The OMG Network is built on their own implementation of Plasma, called MoreViable Plasma. Matic Network is another example of a platform using an adapted version of the Plasma framework.

Sidechains

Sidechains are Ethereum-compatible, independent blockchains with their own consensus models and block parameters.

Interoperability with Ethereum is made possible by using the same Ethereum Virtual Machine, so contracts deployed to the Ethereum base layer can be directly deployed to the sidechain. xDai is an example of such a sidechain.

Rollups

Rollups provide scaling by bundling or “rolling up” sidechain transactions into a single transaction and generating a cryptographic proof, also known as a SNARK (succinct non-interactive argument of knowledge). Only this proof is submitted to the base layer.

With rollups, all transaction state and execution are handled in sidechains. The main Ethereum chain only stores transaction data.

There are 2 types of rollups: Zk rollups and optimistic rollups.

Zk rollups, although faster and more efficient than optimistic rollups, do not provide an easy way for the existing smart contracts to migrate to Layer 2.

Optimistic rollups run an EVM compatible Virtual Machine called OVM (Optimistic Virtual Machine) which allows for executing the same smart contracts as can be executed on Ethereum. This is really important as it makes it easier for the existing smart contracts to maintain their composability, which is extremely relevant in DeFi where all major smart contracts were already battle-tested.

One of the main projects working on optimistic rollups is Optimism, which is getting closer and closer to their mainnet launch.

When it comes to Zk rollups, Loopring and Deversifi are good examples of decentralized exchanges built on Layer 2. On top of that we have ZkSync enabling scalable crypto payments.

Rollups’s scalability can also be magnified by Ethereum 2.0. In fact, because rollups only need the data layer to be scaled, they can get a tremendous boost already in Ethereum 2.0 Phase 1 which is about the sharding of data.

Summary

Despite a spectrum of Layer 2 scaling solutions available, it looks like the Ethereum community is converging on the approach of mainly scaling through rollups and Ethereum 2.0 Phase 1 data sharding.

This approach was also confirmed in a recent post by Vitalik Buterin called “A rollup centric Ethereum roadmap” that I will link in the description box below.

In our future articles, we’ll explore the base layer scaling with Ethereum 2.0 and how both layer 1 and layer 2 scaling can help with making decentralized finance more accessible to everyone. Stay tuned by subscribing to the channel.

So what do you think about Ethereum’s approach to scaling? And which scaling solution would you like to learn more about?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

Originally published at https://finematics.com on October 27, 2020.

--

--