DEV Community

Cover image for Your Comprehensive Guide to Blockchain Rollups: Scaling the Future
Gharsa Amin
Gharsa Amin

Posted on

Your Comprehensive Guide to Blockchain Rollups: Scaling the Future

Introduction

Blockchain technology has revolutionized how we approach trust and decentralization. However, as networks like Ethereum gained popularity, a significant challenge emerged: scalability. As more users join blockchain networks, transaction throughput limitations lead to congestion and high fees. These challenges prompted a critical question: How can networks increase transaction throughput without sacrificing decentralization and security?

Layer 2 (L2) scaling solutions have emerged to address these issues, with rollups becoming the leading approach to blockchain scaling.

Blockchain Infrastructure Basics

Before diving into rollups, it's important to understand the foundational elements they build upon:

Blockchain Clients

Blockchain clients are software applications that connect to and interact with blockchain networks. They perform several critical functions:

  • Network Connection: Establishing and maintaining connections to the peer-to-peer network
  • State Management: Tracking the current state of the blockchain
  • Transaction Processing: Processing transactions and propagating them across the network
  • Consensus Participation: Following the network's rules to agree on the state

Different client implementations like Geth, Erigon, or Nethermind for Ethereum follow the same protocol but may have different architectures and optimizations.

Node Management

A node in a blockchain is a computer that participates in the network by validating transactions, storing the blockchain's data, and helping maintain the decentralized network. Running a blockchain node involves:

  • Hardware Provisioning: Ensuring the node has enough CPU, memory, storage, and bandwidth to operate efficiently
  • Software Maintenance: Regularly updating and securing the blockchain client software to prevent vulnerabilities
  • Synchronization: Downloading and verifying the blockchain's history to stay up to date with the network
  • Monitoring: Constantly tracking the node's performance and the overall network status to ensure smooth operation

Blockchain nodes can be categorized as full nodes (storing the complete blockchain data) or light nodes (only storing essential data and relying on full nodes for additional information).

Validator Setups

Validators are special nodes that participate in block production and consensus:

  • Staking: Depositing tokens as an economic guarantee of good behavior
  • Block Production: Creating new blocks with valid transactions
  • Attestation: Verifying and voting on blocks created by others
  • Slashing Risk: Facing penalties for malicious behavior or downtime

Validator setups require additional security considerations and often more powerful hardware than regular nodes.

What Are Rollups?

Rollups are Layer 2 scaling solutions that process transactions off-chain before submitting compressed data to the main blockchain (Layer 1). By bundling multiple transactions together, rollups significantly reduce network congestion, enabling higher transaction throughput โšก, lowering transaction fees ๐Ÿ’ฐ, and maintaining security through the underlying Layer 1 blockchain ๐Ÿ”’. The key principle is to move computational tasks off-chain while preserving the security guarantees of the main chain.

How Rollups Work: The Basics

๐Ÿ”” The fundamental process of rollups works as follows:

๐Ÿ“ž 1: Users submit transactions to the rollup network

๐ŸŽถ 2: Transactions are batched together off-chain

๐Ÿ“Ÿ 3: The rollup processes these transactions and updates its state

๐Ÿ’ก 4: Data or proofs about these transactions are posted to Layer 1

๐Ÿ“’ 5: The Layer 1 ensures the integrity of the Layer 2 operations

Technical Components of a Rollup System

For a comprehensive Layer 2 Rollup system, several crucial components work together:

  • ๐Ÿ”ญ Blockchain Node: The basic infrastructure of the network
  • ๐Ÿชœ Sequencer: Collects transactions and produces new blocks
  • โš–๏ธ ZK-Prover (for ZK-Rollups): Proves and verifies transactions using zkEVM
  • ๐Ÿ” RPC: Provides interfaces to access the blockchain
  • ๐Ÿ–ฒ๏ธ Synchronizer: Helps nodes stay up-to-date with the latest state
  • ๐ŸŽผ ZK-SNARK/STARK: Cryptographic arguments of knowledge for proofs
  • ๐Ÿ“ StateDB: Database storing the current states of accounts and contracts
  • ๐Ÿ“‰ Ethereum Bridge: Mechanism to transfer assets between blockchain networks
  • ๐Ÿ“‚ Rollup smart contract: On-chain component verifying proofs and state transitions

Types of Rollups

There are two major types of rollups, each with distinct approaches to validation and security:

Zero-Knowledge Rollups (ZK-Rollups)

ZK-Rollups leverage cryptographic proofs to validate transaction batches. They "roll up" multiple transactions (potentially thousands) into a single batch, process them off-chain, and generate mathematical proofs of validity.
Image description

๐Ÿ”ฎ This technology allows the network to:

  • ๐Ÿ•ต๏ธ Verify transaction validity without revealing the underlying data
  • ๐Ÿ—œ๏ธ Compress transaction data before submitting it to Ethereum's main chain with cryptographic proofs
  • โšก Process transactions off-chain for greater efficiency

How ZK-Rollups Work

ZK-Rollups bundle multiple transactions into a single batch and submit cryptographic proofs to the main chain for validation. Here's how it works:

  1. ๐Ÿ” Transaction Submission: Users sign and submit transactions to the ZK-Rollup network
  2. ๐Ÿ”— Batch Processing: Multiple transactions are bundled together and processed off-chain
  3. ๐Ÿ› ๏ธ Proof Generation: A cryptographic validity proof (typically zk-SNARK or zk-STARK) is created
  4. ๐ŸŒ Main Chain Submission: The proof and minimal transaction data are submitted to the main chain
  5. โœ”๏ธ Verification: A smart contract on the main chain verifies the proof's validity
  6. ๐Ÿ”„ State Update: Upon successful verification, the main chain's state is updated to reflect the processed transactions

Real-World Example: Token Transfer on a ZK-Rollup

Let's illustrate how a simple token transfer works on a ZK-Rollup network like zkSync:

  1. ๐Ÿ’ธ Alice Sends Tokens: Alice wants to send 10 tokens to Bob on a ZK-Rollup network
  2. โœ๏ธ Transaction Signing: Alice signs a transaction with her private key
  3. ๐Ÿ“ค Transaction Submission: Alice submits the signed transaction to the ZK-Rollup network
  4. ๐Ÿงณ Batch Collection: The sequencer collects Alice's transaction with others into a batch
  5. ๐Ÿ”„ Transaction Processing: The operator processes all transactions in the batch, updating the state tree
  6. ๐Ÿ”’ Proof Generation: A ZK-Prover generates a cryptographic validity proof
  7. ๐Ÿ›๏ธ Proof Submission: The proof and state roots are submitted to Ethereum
  8. โœ… Proof Verification: The ZK-Rollup smart contract verifies the proof on Ethereum
  9. ๐Ÿ”‘ State Root Update: Upon successful verification, the contract updates the official state root
  10. โœ”๏ธ Finalization: Alice's payment to Bob is finalized and the transaction is complete

Notable ZK-Rollup Projects

Some of the most notable ZK-Rollup projects in the blockchain space include zkSync (zkSync Lite and zkSync Era), Immutable X, Loopring, StarkNet, and Polygon Hermez/zkEVM.

Case Studies

Case Study 1: Polygon Hermez

Polygon Hermez is a decentralized ZK-Rollup solution built on Ethereum, aimed at enhancing scalability and transaction throughput. Its architecture integrates a sequencer, an aggregator for zero-knowledge proofs, and a consensus algorithm for decentralization.

Initially developed as a ZK-Rollup for token transfers, Hermez was later acquired by Polygon and evolved into Polygon zkEVM. This expansion brings the goal of achieving full EVM compatibility and a high throughput of transactions.

Polygon Hermez aims to handle over 2,000 transactions per second while ensuring security and decentralization in Ethereum's ecosystem.

Key Features:

  • Sequencer: Orders and batches transactions
  • Aggregator: Generates zk-proofs for transaction batches
  • Proof of Efficiency (PoE): A consensus model that decentralizes the network and enhances security

Case Study 2: Erigon CDK

Erigon CDK is a modular framework designed for building blockchain clients and scaling Layer 2 solutions. It offers a range of tools for custom rollups and enhanced blockchain performance.

Originally created as an Ethereum execution client focusing on performance optimization, the Erigon CDK extends its capabilities by providing modular components for rollups, including networking stacks and high-performance databases.

Erigon CDK empowers developers to create custom Layer 2 solutions and efficient blockchain infrastructures, helping scale decentralized applications (dApps) and networks.

Key Features:

  • Modular Database: Optimized for blockchain data with high performance
  • EVM Implementation: Enables efficient execution of smart contracts
  • P2P Networking: Facilitates communication between nodes
  • RPC Interface: Provides interaction between applications and nodes

Advantages of ZK Rollups

  1. โœ… Immediate Finality: Once the proof is verified, finality is achieved in minutes, rather than days
  2. ๐Ÿ”’ Stronger Security: ZK Rollups provide stronger security guarantees through cryptographic proofs
  3. ๐Ÿ’พ Efficient Data Storage: ZK Rollups use compression to store data more efficiently on-chain
  4. ๐Ÿ” Privacy Potential: Zero-knowledge technology enables enhanced privacy features

Disadvantages of ZK Rollups

  1. ๐Ÿ–ฅ๏ธ Higher Computational Requirements: Proof generation for ZK Rollups requires higher computational power
  2. ๐Ÿ› ๏ธ Complex Development: The development environment for ZK Rollups is more complex compared to traditional systems
  3. โš™๏ธ Limited EVM Compatibility: While zkEVM projects are improving compatibility, ZK Rollups still have some limitations in EVM support
  4. ๐Ÿ’ธ Higher Initial Setup Costs: Setting up ZK Rollups may involve higher initial costs due to infrastructure and development requirements

Optimistic Rollups

Optimistic Rollups represent a layer-2 scaling solution for blockchain networks that processes transactions outside the main chain while maintaining security through a unique validation mechanism.

Image description

๐Ÿš€ This technology enables:

  • ๐Ÿ”„ 'Optimistic' validation โ€” transactions are assumed valid by default without immediate cryptographic proofs
  • โฑ๏ธ Shifted burden of proof โ€” transactions are accepted initially but remain subject to a challenge period
  • ๐Ÿ•ต๏ธ Fraud detection system โ€” observers can submit fraud proofs if they detect invalid state transitions
  • ๐Ÿ’ฐ Significant cost reduction โ€” gas fees are drastically reduced while maintaining security guarantees
  • โšก Enhanced throughput โ€” transaction processing capacity is substantially increased

This approach efficiently scales blockchain networks by moving computation off-chain while preserving the security foundations of the underlying blockchain.

How Optimistic Rollups Work

Optimistic Rollups assume that transactions are valid by default. Here's a simple breakdown of how they work:

  1. ๐Ÿš€ Transaction Submission: Users submit transactions to the network
  2. ๐Ÿ“ Processing Transactions: A system or operator organizes and processes these transactions
  3. ๐Ÿ”„ State Update: The system updates the network based on these transactions
  4. ๐Ÿ“Š Data Publication: The transaction details are published to the main Ethereum network
  5. โณ Challenge Period: There's a set time window where anyone can challenge the transactions
  6. โš–๏ธ Dispute Resolution: If a challenge occurs, fraud can be proven and invalid transactions can be reversed
  7. โœ”๏ธ State Finalization: If no challenges happen, the transactions are considered final

Notable Optimistic Rollup Projects

Some of the most notable Optimistic Rollup projects in the blockchain space include Optimism, Arbitrum, and Cartesi.

Advantages of Optimistic Rollups

  1. โœ… Better EVM Compatibility: Optimistic Rollups offer better compatibility with existing Ethereum smart contracts
  2. ๐Ÿ”’ Lower Computational Requirements: Optimistic Rollups require less computational power for processing compared to ZK Rollups
  3. ๐Ÿ’ป Easier Development Migration: Developers can more easily migrate their applications from Ethereum to Optimistic Rollups
  4. ๐Ÿ› ๏ธ Simpler Implementation: Optimistic Rollups are simpler to implement and work well with Ethereum's existing infrastructure

Disadvantages of Optimistic Rollups

  1. โณ Long Withdrawal/Finality Periods: Optimistic Rollups typically have a long withdrawal and finality period (around 7 days)
  2. โš ๏ธ Vulnerability to Economic Attacks: They are vulnerable to specific types of economic attacks, like the "long-range attack"
  3. ๐Ÿ‘€ Requires Active Fraud Watchers: Security relies on external watchers who must monitor and challenge fraudulent transactions
  4. ๐Ÿ“‰ Less Efficient Data Posting: Optimistic Rollups can be less efficient in terms of data posting compared to ZK Rollups

Comparison: ZK Rollups vs. Optimistic Rollups

Feature ZK Rollups Optimistic Rollups
Security Model Cryptographic proofs Fraud proofs
Finality Time Minutes Days (challenge period)
Computational Requirements Higher Lower
EVM Compatibility Improving but limited Good
Withdrawal Time Quick Delayed (challenge period)
Development Complexity Higher Lower
Data Efficiency More efficient Less efficient
Privacy Features Potential for privacy Limited privacy
Maturity Growing More established

ZK Rollup Workflow Diagram

User โ†’ Transaction โ†’ Sequencer โ†’ Batch Processing โ†’ ZK Proof Generation โ†’ 
Main Chain Verification โ†’ Immediate Finality
Enter fullscreen mode Exit fullscreen mode

Optimistic Rollup Workflow Diagram

User โ†’ Transaction โ†’ Sequencer โ†’ Batch Processing โ†’ State Update โ†’ 
Challenge Period (7 days) โ†’ Finality if No Challenges
Enter fullscreen mode Exit fullscreen mode

The key visual difference is that ZK Rollups require a computationally intensive proof generation step but achieve immediate finality, while Optimistic Rollups skip the proof generation but require a lengthy challenge period before achieving finality.

When to Choose Which Rollup?

Choose ZK Rollups When:

  • You need immediate transaction finality
  • Your application benefits from enhanced privacy
  • You prioritize cryptographic security over compatibility
  • Data efficiency is critical for your application

Choose Optimistic Rollups When:

  • Full EVM compatibility is essential for your application
  • You're migrating existing Ethereum applications
  • Your use case can tolerate delayed finality
  • You need a more mature ecosystem with established tooling

Conclusion

Rollups are a major step forward in blockchain technology, helping to solve the long-standing issue of scaling blockchains. By processing most of the work off-chain but still keeping the security of the main network, rollups make it possible to build better blockchain applications that offer a better experience for users. They are an important part of Ethereum's plan to grow without losing security.

ZK-Rollups and Optimistic Rollups each have their own strengths and challenges, but together, they offer a strong solution for the future of decentralized apps. As the technology continues to evolve, we can expect to see even more innovation in this space.

Rollup Glossary

  • Layer 1 (L1): The base blockchain protocol (like Ethereum) that provides the security and consensus mechanism for the network
  • Layer 2 (L2): Secondary framework or protocol built on top of an existing Layer 1 blockchain to improve scalability and efficiency
  • EVM (Ethereum Virtual Machine): The computational engine that processes smart contracts in the Ethereum network
  • zkEVM: A version of Ethereum's virtual machine that can generate zero-knowledge proofs to verify the correct execution of smart contracts
  • State: The current condition of all accounts, contracts, and data on the blockchain at a specific point in time
  • Sequencer: An entity responsible for collecting, ordering, and processing transactions in a rollup system
  • Fraud Proof: Evidence submitted to prove that a transaction or state transition is invalid (use

Top comments (0)