article cover image
View all Articles

What is a Blockchain Rollup? A Technical Introduction (2024)

Rollups are layer 2 blockchains that work by aggregating, or 'rolling up', multiple transactions into a single transaction on a parent blockchain (a layer 1).

Last Updated:
Tags:
Infrastructure
Optimism
Ethereum
Polygon zkEVM

In this guide, you’ll learn:


What are the differences between Layer 2s and Rollups?

Before diving deep into the technical aspects of rollups and their various forms, we should first establish a clear understanding of what constitutes a layer 2 and a rollup.

What are Layer 2s?

Layer 2 refers to a set of off-chain solutions designed to boost the scalability of a primary network (or layer 1) by processing transactions outside of it. Think of these solutions as detours on a highway, helping to alleviate congestion on the main route.

The term "layer 2" can encompass various off-chain methods, so depending on whom you ask, interpretations may differ. I belong to the group that views layer 2 solutions as those that either fully or partly utilize the decentralized security of a layer 1, all while functioning autonomously to expand the network's capacity.

The crucial aspect to consider is the source of security – is it supplied by a layer 1 or not? If a solution partially or fully leans on layer 1 for security, then in my view, it qualifies as a layer 2. But if it doesn't, even if it has similar features, it's not strictly a layer 2; it could be something like a sidechain.

💡 For example, Optimism qualifies as a layer 2 because it relies on Ethereum's consensus mechanism and security, without introducing its own. However, Polygon isn't a layer 2. It currently functions as a PoS sidechain, operating as an independent blockchain, with its own validators overseeing Polygon transactions.

Based on L2Beats, there are several primary types of layer 2 solutions available, mainly:

  • zkRollups - Validity Proofs with data on L1 Ethereum,
  • Optimistic Rollups - Fraud Proofs with data on L1 Ethereum,
  • Validium - Validity Proofs with data kept off-chain,
  • Plasma - Fraud Proofs with data kept off-chain.

⚠️ It should be noted that quite a few people don't consider Validium and Plasma as genuine Layer 2s since they don't use the Ethereum Mainnet for data availability.

What are Rollups?

Rollups are solutions that work by aggregating, or 'rolling up', multiple transactions into a single transaction on a layer 1. This spreads the cost of the L1 transaction fee among all the participants in the rollup, making it more cost-effective for each user.

So, wondering if rollups are the same as layers 2? Like many things in life, the response often depends on whom you ask.

If you believe Layer 2s include more than just rollups, such as Validium and Plasma which keep data off-chain but are secured by Ethereum, then no, rollups aren't the sole Layer 2s. Despite not sending transaction details back to the Ethereum Mainnet, some still count these as Layer 2s.

However, others strictly view only rollups as true Layer 2s, excluding Validium from the category because they do not use Ethereum Mainnet for data availability.


Different types of Rollups

Having clarified the definitions, let's delve into understanding rollups. Two main types exist: Optimistic and ZK Rollups. While both consolidate transactions, they differ in how they transmit this consolidated data to L1.

Optimistic rollups process user transactions off-chain and later send the data to Ethereum as "calldata". Among those developing optimistic rollups, notable names include Arbitrum, Optimism, Base, and Mantle. Arbitrum and Optimism together boast a total value locked (TVL) nearing $8 billion.

Conversely, zero-knowledge rollups submit transactions off-chain too, but they can confirm their accuracy without exposing the transaction details. Current players in the zkSync-focused rollups are Polygon zkEVM, Starknet, ZkSync, Scroll, and Linea.

Optimistic Rollups

Optimistic rollups offer a solution for Ethereum's scalability by executing transactions off-chain while maintaining on-chain data postings as calldata. These rollups batch several transactions off-chain before submitting them to Ethereum, leveraging compression techniques to reduce data and effectively lowering fees for users.

The "optimistic" nature of this method assumes the off-chain transactions are legitimate without requiring on-chain validity proofs, distinguishing it from zero-knowledge rollups which demand cryptographic evidence. However, a security mechanism is in place: a challenge period follows each rollup batch submission, allowing anyone to dispute a transaction by presenting a fraud proof.

If a fraud proof is validated, the implicated transaction is recalculated, the rollup state is amended, and the perpetrator incurs a penalty. Conversely, if no challenge arises within this period, the batch is accepted on Ethereum, but there's a risk; any subsequent transaction based on a prior flawed execution might be overturned.

Optimistic rollups are anchored by Ethereum-based smart contracts, creating an "optimistic rollup chain" This framework consists of:

  1. On-chain contracts: These Ethereum-run contracts handle rollup operations, record blocks, monitor state shifts, and manage deposits. Here, Ethereum acts as the foundational "layer 1".
  2. Off-chain virtual machine (VM): Operating separately from the Ethereum VM, this off-chain VM is where applications are housed and state modifications take place, constituting the "layer 2" for optimistic rollups.

ZK Rollups

Zero-knowledge rollups (ZK-rollups) offer a scaling solution by bundling transactions for off-chain computation. This reduces on-chain data postings. Instead of individual transaction submissions, ZK-rollups provide a condensed representation of batched transactions, along with a cryptographic proof (validity proof) to confirm their correctness.

The state of ZK-rollups is overseen by a smart contract on Ethereum. To update this state, nodes must submit a validity proof. This cryptographic proof ensures the proposed state-change is legitimate, stemming from batched transactions. Unlike optimistic rollups, which require full on-chain transaction data, ZK-rollups only demand these validity proofs to conclude transactions.

Withdrawing assets from ZK-rollups to Ethereum is immediate after the contract confirms the proof's validity, offering an advantage over optimistic rollups that impose a waiting period to account for potential challenges.

ZK-rollups archive transactions as calldata on Ethereum. Calldata stores data for external smart contract calls. To make data storage efficient, ZK-rollups employ compression, translating into cost savings for users. These rollups operate atop Ethereum and are governed by its smart contracts. They execute off-chain but periodically register batches on Ethereum, creating an immutable ZK-rollup chain.

The ZK-rollup structure comprises:

  1. On-chain contracts: These Ethereum-based contracts control the ZK-rollup process, storing blocks, monitoring state shifts, and verifying zero-knowledge proofs.
  2. Off-chain VM: Although anchored on Ethereum, ZK-rollups execute transactions on a separate virtual machine. This machine handles transactions and relies on Ethereum to validate state transitions with validity proofs.

What’s the relationship between a Layer 2 (L2) and its Layer 1 (L1)?

L2 chains utilize two primary methods when interfacing with Layer 1:

  1. Verification: Through Validity Proofs or Fraud Proofs, L1 confirms the authenticity of the L2 state. This step is crucial to prevent L2 validators from manipulating transactions, generating coins out of nowhere.
  2. Data Availability: L2 relies on L1 to keep transaction data accessible. This guarantees that, during conflicts, users can independently reconstruct the L2 state or securely transition back to L1.

zkRollups and Optimistic Rollups, while sharing some similarities, have distinct ways of engaging with Ethereum.

Optimistic Rollups:

  1. Data Availability: They move user transactions off-chain but then post the data back to Ethereum as "calldata." This is crucial as without this state data, challengers can't construct fraud proofs.
  2. Censorship Resistance: The rollup operators can potentially censor users, but Ethereum ensures that these operators can't get away with this. Users can submit transactions directly on L1 to prevent this censorship.
  3. Settlement: Ethereum plays the role of a settlement layer, ensuring that if any dispute arises on the Optimistic Rollup, it can be resolved on Ethereum. All rollup transactions are only considered final after they're accepted on Ethereum.

zkRollups:

  1. Data Availability: They publish almost all state data for every transaction processed off-chain to Ethereum. Since validity proofs already verify transaction accuracy, zkRollups don't need to store as much transaction data on-chain as Optimistic Rollups. But the data that is stored allows for permissionless, independent verification of the L2 chain's state.
  2. Transaction Finality: All transactions are finalized only when Ethereum's L1 contract accepts the validity proof. This security mechanism ensures every transaction must be approved on the main Ethereum chain.
  3. Censorship Resistance: Users can bypass potential censorship from the "supernode" operator by submitting transactions directly to the rollup contract on Ethereum's mainnet.

Wrapping things up

In conclusion, unless you're actively developing for platforms like Optimism, Arbitrum, or Starknet, there's no need to delve deeply into the intricate details of rollups. However, having a foundational understanding of the mechanisms behind rollups can be beneficial, offering insights into their capabilities and associated risks.

For those who prefer a visual explanation, I'd recommend this insightful video

Additionally, if you wish to broaden your knowledge on L2 solutions beyond just rollups, L2Beat offers comprehensive analyses on various L2 platforms. It's a valuable resource for anyone looking to stay informed in this space.

Maxime Servais

Article by

Maxime Servais

I'm a Software Developer and Tech Writer over at Ethereum Ecosystem. Basically, I make sure everything we cook up is top-notch and awesome!