Glossary

Optimistic Rollup

Hard

An optimistic rollup is a type of layer-2 scaling solution that relies on off-chain computation to record transactions in layer 2 trustlessly.

What Is an Optimistic Rollup?

An optimistic rollup is a type layer 2 scaling solution that relies on off-chain computation to trustlessly record transactions that happen in layer 2. Periodically the system publishes a Merkle root of the transactions that happen within the rollup in order to update the "state" of the rollup on the main underlying blockchain. A network of external validators checks the Merkle roots to make sure that they are correct before the state is updated some time later. If an inconsistency arises, then the validator can publish a fraud proof during the dispute period, which can cause the state of the system to be rolled back to the previous valid state. 

Difference Between ZK Rollup and Optimistic Rollup

The main downside to optimistic rollups compared to zero knowledge rollups is the time that it takes for layer 2 users to be able to withdraw their funds back to the underlying blockchain. As an optimistic rollup has to rely on external validators to check the merkle roots for ‘cheating’ before the state can be updated, there needs to be a sufficient amount of time for validators to check and challenge the activity that has happened on layer 2. 

The main advantage to optimistic rollups compared to their zero knowledge equivalents is that they are more generalist and can support smart contracts in a similar way to the underlying smart contract-enabled blockchain. Native support for smart contracts within the rollup means that apps can be launched much easier, without the need for additional development.

You may learn more about Optimistic Rollup vs ZK Rollup!

Optimistic Rollups Explained 

An optimistic rollup is a layer-2 scaling solution designed to enhance Ethereum's throughput and latency by moving computation and data storage off-chain. These rollups reduce the load on the Ethereum mainnet and increase its scalability by processing transactions outside of it.

The three main components of an optimistic rollup are:

  1. A smart contract on Ethereum
  2. A sequencer

  3. A set of validators
The smart contract governs the interaction between the layer-2 chain and Ethereum. The sequencer (a third party) collects, orders, and executes transactions on the layer-2 chain. Validators, comprising a group of nodes, monitor the layer-2 chain and submit fraud proofs to the smart contract if they identify any invalid transactions.

Using an optimistic rollup requires users to deposit funds into the Ethereum smart contract. The smart contract then locks the funds and emits an event signaling the deposit. The sequencer receives the event and credits the user with equivalent tokens on the layer-2 chain.

Users can transact freely on the layer-2 chain with other users who have also deposited funds into the smart contract. They sign transactions and submit them to the sequencer, who verifies and adds them to a queue.

Periodically, the sequencer batches thousands of queued transactions into a block and submits it to Ethereum as a single transaction. The block contains minimal data, such as the state root (a Merkle root of the layer-2 chain's state) and the transaction root (a Merkle root of the transactions in the block). The smart contract stores these roots and updates its state accordingly.

The sequencer publishes the full block data off-chain, either on a decentralized storage network (e.g., IPFS) or a centralized server. Validators can access this data and verify that it matches the roots submitted on-chain. If they find any discrepancies, they can submit a fraud proof to the smart contract, which reverts the invalid block and slashes the sequencer's bond.

When a user wants to withdraw funds from the layer-2 chain to Ethereum, they must initiate an exit request on the layer-2 chain. The sequencer includes this request in a block and submits it to Ethereum. The smart contract then unlocks the funds and transfers them to the user's address. However, there is a waiting period (typically one week) before the withdrawal is finalized, during which anyone can challenge the exit with a fraud proof if it is invalid.

Optimistic rollups' key feature is their assumption that all transactions are valid by default, and it only verifies them if a fraud proof is submitted. This enables high scalability without sacrificing security or decentralization.

Types of Optimistic Rollups

Optimistic rollups are not a single protocol but a class of protocols sharing common features and design choices, including:

Execution Model 

EVM-compatible rollups use the Ethereum Virtual Machine (EVM) as the base layer, allowing them to run any smart contract that runs on Ethereum without modification. EVM-equivalent rollups use a functionally equivalent virtual machine, enabling them to run most Ethereum smart contracts with minor changes. 
EVM-compatible rollups include Optimism and Arbitrum, while EVM-equivalent rollups include Boba Network and zkSync 2.0.

Data Availability Solution

Decentralized data availability solutions use a peer-to-peer network or a decentralized storage network (e.g., IPFS) to store and distribute full-block data. Centralized data availability solutions use a single server or a trusted third party to store and provide full-block data. 

Decentralized solutions are more secure and censorship-resistant but more expensive and complex. Centralized solutions are cheaper and simpler but more vulnerable and trust-dependent. 

Examples of rollups with decentralized data availability include Optimism and Arbitrum, while those with centralized data availability include Boba Network and zkSync 2.0.

Fraud Proof Mechanism

Interactive fraud-proof mechanisms require a challenge-response game between the sequencer and validators to verify a block's validity. Non-interactive fraud proof mechanisms utilize cryptographic proofs or witnesses to verify a block's validity without any interaction. Where interactive fraud-proof mechanisms are more flexible and general but more costly and time-consuming, non-interactive mechanisms are more efficient and fast but more restrictive and specialized. 

Examples of rollups with interactive fraud-proof mechanisms are Optimism and Arbitrum, while non-interactive fraud-proof mechanisms can be found in Boba Network and zkSync 2.0.

Why Is It Called an "Optimistic" Rollup?

In optimistic rollups, the term "optimistic" refers to the assumption that all transactions are valid by default. This means the layer-2 chain does not verify or validate transactions before submitting them to Ethereum unless challenged. Instead, it relies on economic incentives and fraud proofs to ensure the system's correctness and security.

Benefits of Optimistic Rollups

Lower Gas Fees

By moving most of the computation and data storage off-chain, optimistic rollups reduce gas fees for transactions. They save on gas costs and increase efficiency by batching thousands of transactions into a single block and submitting minimal data on-chain.

Higher Throughput

Optimistic rollups boost transaction throughput by processing them more quickly and frequently on the layer-2 chain. They can achieve higher transaction speeds and lower confirmation times by avoiding the base layer's congestion and limitations.

Faster Confirmation Times

Instant confirmations on the layer-2 chain improve transaction latency in optimistic rollups. 

Compatibility With Existing Smart Contracts and Tools

Optimistic rollups are compatible with Ethereum's existing smart contracts and tools. Developers can use familiar languages, frameworks, libraries, and standards, such as Solidity, EVM, ERC-20, etc. Users can also use the same wallets, browsers, and interfaces, such as MetaMask.

Security and Decentralization

Optimistic rollups derive their security and decentralization from the base layer by publishing transaction results on-chain and relying on fraud proofs for correctness. 

Challenges or Limitations of Optimistic Rollups

Fraud Proof Delay

This is the period between a fraudulent transaction's on-chain submission and its reversion by a fraud proof. During this time, the layer-2 chain may be inconsistent with the layer-1 chain, potentially affecting user experience and application security. The fraud proof delay typically lasts one week but could be shorter or longer depending on the implementation and network conditions.

Data Availability Problem

Ensuring the full block data is accessible off-chain for anyone wishing to verify or challenge a transaction poses a challenge. If data is unavailable or corrupted, fraud proofs cannot be generated or submitted, potentially compromising the system's security and integrity. Decentralized and centralized data availability solutions can mitigate the data availability problem but have their own pros and cons.

Sequencer Centralization Risk

Relying on a single entity or a small group of entities to collect, order and execute layer-2 chain transactions carries the risk of centralization. A malicious or compromised sequencer could censor, reorder or manipulate transactions, harming users and applications on the rollup. The sequencer centralization risk can be mitigated by using multiple sequencers, randomizing sequencer selection, or allowing users to bypass the sequencer.

Compatibility Trade-Off

While optimistic rollups are compatible with existing smart contracts and tools on Ethereum, this compatibility comes with a trade-off. By using the same execution model as Ethereum, optimistic rollups inherit some of its limitations and inefficiencies, such as high gas costs for complex computations or storage operations. Alternative scaling solutions, such as zk-rollups use a different execution model that can optimize for specific use cases or domains.


Contributor: Ross Middleton, co-founder and CFO at DeversiFi  
Ross is the co-founder of DeversiFi, a layer 2 decentralized finance (DeFi) trading platform powered by StarkWare’s scalable technology. He is responsible for finances as well as looking after DeversiFi’s project partners and biggest customers. 

Previous to DeversiFi, Ross worked at the Ethfinex and Bitfinex exchanges. Before joining crypto, Ross was a professional energy trader and analyst in London for ten years. He worked on global energy trading desks at companies such as Centrica, Gazprom and RWE to deploy funds into advanced proprietary fundamental-backed trading strategies. Outside of the trading world, he is a committed angel investor and Ironman triathlete. Ross brings a wealth of both non-traditional and traditional asset trading and commercial experience as well as connections to the alternative finance space. Ross holds a BSc in economics.