Sep 22, 2022

Layer 2 Scaling

Throughout this article, we’ll be looking at scaling solutions through the lens of Ethereum. We won’t be looking at Layer 1 scaling solutions such as increasing block size. Instead, we will look at various Layer 2 solutions that are built ‘on top’ of the Layer 1 and therefore do not make any changes to the core protocol.

Scaling Solutions

The ‘Scalability Trilemma’ states that of the three main features a blockchains aims to have (scalability, decentralization, and security), any one chain can only achieve two of them.

Screenshot 2022-09-22 144237.png

Source: Vitalik Buterin

Ethereum sits firmly at the bottom of the triangle, focusing heavily on decentralization and security. This is why Ethereum has a seriously low TPS (transactions per second) and can be expensive to use at times of high activity.

To alleviate speed/bandwidth issues, a number of different scaling solutions have been created over the years. Rather than making changes to the core chain, layer 2 scaling solutions aim to solve the problem by taking transactions off-chain.

Many popular scaling solutions are Layer 2 scaling solutions. Layer 2 means the solution is built ‘on top’ of the Layer 1 and therefore does not make any changes to the core protocol. Using L2s, Ethereum (the L1) can continue to focus on decentralization and security without any concessions and the L2 can handle scaling. L2s batch together transactions and communicate with the L1 at set intervals to validate those batches of transactions rather than having the L1 validate every single transaction that occurs on the L2.

Types of layer 2 scaling solutions:

State Channels

A state channel allows for two parties to make a series of interactions with each other off chain and then only post the final result to the L1. This allows for instant finality and savings on L1 computation, but requires some trust between the two parties. Additionally, this scaling solution scales the transactions between two parties but the channel itself does not scale well past two parties.

This is great for trusted interactions, but lacks in trustless environments.

Sidechains

A sidechain is more independent than a state channel by the fact that it has its own validator node and consensus mechanism. Sidechains keep track of all transactions and the state via decentralized consensus so there is no question of whether a request to exit the sidechain has the most up to date state, unlike in state channels.

Sidechains are much more flexible because they provide their own scalability, security, and decentralization solutions. More scalability is possible due to centralization of nodes, which may be seen as a deal-breaker for a party that is on Ethereum for decentralization and security in the first place.

Rollups

Rollups do not have their own nodes or their own consensus mechanism, they use the robust decentralization and consensus of Ethereum mainnet to confirm state. Rollups allow Ethereum to confirm the state on the execution layers without actually validating every transaction. The two ways to do this are with Optimistic rollups and with ZK rollups.

Optimistic Rollups

Optimistic rollups use fraud proofs to check validity of results. 

Transactions are batched and submitted to the mainnet to be certified by a party with a deposit staked. There is the optimistic assumption that the certification is true. A window of time exists where any other party can challenge the state that was certified. 

Between the certifier and the challenger, the party that was incorrect will have their deposit slashed. This gives a strong financial incentive to be a good actor so nodes would rarely need to go through transactions for a dispute. 

The downside is that finality cannot be reached until that waiting period for disputes ends.

Popular Optimistic rollups include Arbitrum and Optimism

ZK Rollups

ZK rollups use zero-knowledge proofs to check validity of results. 

The logic behind a zk rollup is much more complex. A cryptographic proof, such as a SNARK or STARK, is used to create a proof that is smaller and faster to verify than the original equation, but impossible to prove as true if the initial conditions to create the proof were not true.

You can reduce computation and memory by a large amount by only sending and verifying a proof of the original data.

Popular zero knowledge rollups include ZkSync and StarkNet

References:

https://www.horizen.io/blockchain-academy/technology/advanced/layer-2/

Leave a Reply

Related Posts