Layer 2 Fully Overview

Alexandr Kumancev
Coinmonks
6 min readMay 10, 2023

--

Elshan Jafarov, Blockchain Engineer from Fluence Lab, during The Scaling Meetup in Tbilisi talked about Layer 2 solutions for blockchain scalability. What changes in the industry have happened recently and what solutions are on the market right now. Enjoy reading!

Sharding

Sharding is an idea that should save Ethereum. Its essence is to split calculations into separate chains and aggregate them in the main chain. Currently, all computations are performed sequentially in the main blockchain, but sharding allows to split them into different chains and set up a switching protocol between them. However, sharding has several problems, such as the uncertainty of each shard’s data visibility and the need to change the Layer 1 protocol.

Ethereum Foundation abandoned the idea of implementing sharding, and at the end of the report we will find out what they changed their plan to.

sharding

Sidechains

When blockchain first encountered the problem of scaling, all hope was in Sidechains.

Sidechains are a separate, standalone chain with its own set of validators, consensus, and the ability to exchange stats, tokens, or other information with the main chain via a bridge. However, this solution has one problem: to create a sidechain, you must create a new secure network with its own validators from scratch.

sidechains

The principle behind sidechains is that to access them, tokens must first be locked to L1 and then mined on the sidechain. To get out of the sidechain, tokens must be mined on the sidechain, and then they return to L1 and the smart contract is unlocked.

sidechain work example

Plasma

When it became apparent that Sidechain was a good solution, but difficult to scale, it was suggested to use Plasma.

Plasma assumes a balance between chain autonomy and L1 checking. Plasma has operators who run the chain in Plasma itself, and it can be nested in another Plasma Chain. When a user wants to exit a Plasma Chain, they must provide proof to L1 in the form of a Merkle Root stack, and other network members have 7–14 days to provide proof of invalidity.

Plasma is an Optimistic approach, assuming the stack is valid, but there is a period when we can provide proof of invalidity. However, this solution has the problem of data availability. The operator can hide blocks that contain evidence that the state is invalid. Because of this, a virtual machine cannot be used in Plasma, although a Plasma implementation with tokens does exist.

plasma

State channels

In parallel to Plasma, State channels were developing in the blockchain. An example of a project with such a solution is Lighting Network.

The principle of State channels is to create a channel between n-number of participants. The channel is a multisig smart contract that requires confirmations from all participants to write information into it. After creating a channel, we can update its state by getting it signed by all parties, and the last signed state will be considered valid for that channel. After we have provided the channel to the chane, we close it. However, State channels have the problem that all participants must be online for the channel to work.

state chains

State channels are great for fast micropayments. Since a channel is created between two network participants — an interconnection appears, which allows multiple participants to be connected to each other through small channels. In this way, we will be able to transfer tokens through several “hops” of the channel going forward.

Let’s say Alice wants to pass tokens to Eve. She can send them to the channel she has with Bob. If Bob has a channel with Eve, then after receiving the tokens from Alice, he can pass them to Eve in his channel.

lightning network

Rollups

After a while, it was realized that all the above solutions were not suitable for perfect scalability, and Rollups were invented.

The idea of L2 is to rely not on the security of some parallel chane we create, but on the security of L1 itself. Rollups allow you to compress transaction packets by a certain mechanism and then put them in L1. At L1 these transactions are not validated, they are validated only if the user wants to exit Rollup, for which he needs to send an application to L1. Then there are two options:

  • If it is Optimistic Rollups, it takes 7–14 days to request that the stack is invalid.
  • If it is zkRollups, the user can instantly withdraw tokens from the Rollup to L1.

Although Rollups are somewhat similar to Plasma, they can have their own virtual machine. Rollups have no problem with data availability, i.e. it is not necessary to have a separate node for Rollup to recreate an abstract chane. It is enough to read L1 data, and based on transactions in it we can build Rollup from scratch, no validator will be needed, and there is no node that can hide this data.

rollups

Summarize

A more complete picture of scalability, you can see in this diagram, which combines all of the above solutions.

overview

Let us consider each of them in more detail:

  • Sidechains: this solution has different exit times, but is not protected by the L1 consensus, so you have to build it from scratch.
  • Plasma: this solution has problems with exit timeout, data availability, and is only partially protected by the L1 consensus.
  • State channels: this solution allows almost instantaneous output, but its lifetime is limited, the number of participants is also limited, and everyone has to be online.
  • Optimistic Rollups: this solution is relatively easy to implement, but it has an exit timeout, which does not allow for a network of rollups that will communicate via L1 with fast messages.
  • zkRollups: this solution is very difficult to implement, requires confidence in the proofs we provide, and will have a higher commission than Optimistic Rollups.
summary table

Danksharding

As you know, Ethereum Foundation abandoned the idea of implementing Sharding, because Rollups were able to prove their effectiveness and provide high scalability.

Instead, the following concept is proposed: there is L1 and many Rollups, which quickly synchronize and exchange information with each other. Since Sharding is not expected to be updated, the idea of Danksharding has been proposed to improve the availability and usability of rollups. Its essence is the sharding of the time date instead of computational operations. This data will be stored on certain nodes with a certain consensus and algorithms to check their availability. However, this data will not be indefinite, and Danksharding will be used as a cheaper solution where Rollup can write its data to function efficiently. Currently, Rollup writes its data to calldata, which is not an optimal solution because the recorded data in the Ethereum blockchain stays there forever.

danksharding

Rollups Market

At the time of this writing, we see that Arbitrum is an Optimistic Rollup and despite exiting the rollup at 7 days, is the leader in TVL among all L2 Solutions and is one of the most stable.

Optimism — also being Optimistic Rollup, is less stable, but takes a relatively large share of TVL and is in second place.

Also, more recently, the project zkSync Era appeared in Maynet — which is built on the technology zkRollups and allows you to exit the rollup instantly. It is hoped that zkRollups will be the perfect solution and allow Ethereum to scale thousands of rollups around it.

market

--

--

Alexandr Kumancev
Coinmonks

Software engineer (Full-stack, Web3). ✍️ Write about blockchain and other amazing stuff