Layer 2 Solutions

What layer 2 networks are, why blockchains need them, how optimistic and ZK rollups differ and what trade-offs they bring.

4 min · 708 wordsUpdated: #layer 2#scaling#ethereum

Layer 2 solutions, or L2s, are networks and protocols built on top of a main blockchain to take over part of its workload. In this setup the main blockchain is called layer 1, or L1. The idea is straightforward: handle most activity in a separate system and send only summarized data, along with guarantees that it is correct, back to the main chain.

Why layer 2 exists

Blockchains such as Bitcoin and Ethereum prioritize decentralization and security, with every transaction checked by many independent participants. The downside is limited throughput. When more people want to transact than blocks can hold, they compete for space and fees go up.

It is possible to raise the capacity of the L1 itself, but that often makes running a node harder and the network less accessible to independent participants. Layer 2 takes another route: the main chain stays the trusted referee, while high-volume activity happens elsewhere.

How it works at a high level

Most L2s follow a similar pattern:

  1. A user moves funds from the main chain into the L2 through a special smart contract called a bridge.
  2. Inside the L2, transactions are fast and cheaper because a separate system processes them.
  3. From time to time, the L2 bundles many transactions into a batch and posts data about it to the main chain.
  4. When the user wants to leave, they withdraw funds back through the bridge.

The cost of posting a batch to L1 is shared across every transaction inside it, so each individual operation pays far less.

Rollups

The most common type of L2 on Ethereum today is the rollup, which rolls hundreds of transactions into a single record on the main chain. There are two main designs.

Optimistic rollups

These systems assume every batch is valid by default, which is where the name comes from. After a batch is posted, however, there is a challenge period during which anyone can prove the data is wrong by submitting a fraud proof. Because of this window, a standard withdrawal back to the main chain can take several days. Third-party bridges offer faster exits, but they add another intermediary and another layer of risk.

ZK rollups

ZK rollups, named after zero-knowledge proofs, publish a cryptographic validity proof with each batch. A smart contract on the main chain verifies the proof, and if it checks out, the batch is accepted. There is no challenge period to wait out, but generating these proofs is computationally heavy and the engineering is complex.

Other approaches

  • Payment channels. Two parties open a channel, exchange many payments off-chain and record only the opening and closing on the main chain. Bitcoin's Lightning Network is built on this principle.
  • Sidechains. These are separate blockchains with their own validators, connected to the main chain by a bridge. Strictly speaking, they are often not counted as L2s, because their security does not come from the main chain.

Benefits and trade-offs

What L2s offer:

  • lower fees and faster confirmations;
  • compatibility with many applications from the main chain;
  • the ability to lean on L1 security rather than build it from scratch.

Weaknesses and risks:

  • Sequencers. In many L2s a single operator decides the order of transactions. If it goes down, the network may temporarily stop processing activity, and in theory the operator could delay specific transactions.
  • Upgrade keys. Teams can often change the code of L2 smart contracts. That helps with fixing bugs, but it means trusting whoever controls those keys.
  • Bridges. Bridges hold large amounts of value, which makes them attractive targets. A bug in a bridge can lead to lost funds.
  • Fragmentation. Funds and users are spread across many L2s, and moving assets between them is not always simple.
  • Wrong-network mistakes. Sending tokens to the wrong network is a common beginner error. An address can look the same on different networks, yet the funds end up somewhere the recipient does not expect.

In short

Layer 2 solutions help blockchains handle more activity without giving up the security of the main chain. Rollups, payment channels and related designs cut fees and speed things up, but they introduce new trust assumptions: sequencers, bridges and upgrade rights. It is useful to understand how a particular L2 works before moving funds onto it.