Optimistic rollup: Optimistaclly scaling Ethereum

If you have read my previous post on “ZkEVMs: The Future of Ethereum Scalability,” you may have come across Zero Knowledge Rollups (ZK-rollups). ZK-rollups are layer 2 scaling solutions that enhance throughput on the Ethereum Mainnet by moving computation and state storage off-chain. They can process thousands of transactions in a batch and then only post some minimal summary data to the Mainnet. However, ZK-Rollups are not the only rollup solutions in Ethereum; we also have Optimistic Rollups, which we will discuss in this post.

In optimistic rollups, transactions are initially processed off-chain by validators. Once validated, a cryptographic proof is submitted to the mainnet, where it undergoes a challenge period. If no challenges are raised, transactions are confirmed on-chain. “The ‘optimistic’ label refers to a distinctive feature of optimistic rollups: they publish minimal information about transactions on-chain and automatically assume that all transactions are valid.

Optimistic rollups use smart contracts deployed on Ethereum to manage the interaction between the L2 chain and the L1 blockchain (Ethereum). Rollup users must deposit funds into one of these smart contracts before getting an equivalent amount unlocked on the rollup.

The Optimistic Rollup is composed of a few important pieces:

  1. Rollup Chain: The core component of an optimistic rollup is the rollup chain, which operates as a separate blockchain layer. This chain is responsible for processing and validating transactions off-chain.

  2. Bridge Contract (ETH chain): Receives transactions from users and manages the interaction between the Ethereum mainnet and the rollup chain.

  3. Sequence Queue Contract (ETH chain): Manages the sequencing of transactions. It holds the pending transactions submitted by users until they are processed by the sequencer.

  4. Validators (Sequencers): Validators, also known as sequencers, play a crucial role in the optimistic rollup architecture. They are responsible for processing transactions off-chain, bundling them into batches, and generating cryptographic proofs of their validity.

  5. Fraud Proofs: Once transactions are processed off-chain, a cryptographic proof, known as a fraud-proof, is generated to attest to the validity of the transactions. This proof is submitted to the Ethereum mainnet and serves as evidence of the correct execution of transactions.

  6. Mainnet Contracts: On the Ethereum mainnet, there are specific smart contracts that handle the verification and execution of fraud proofs. These contracts verify the validity of the submitted proofs and finalize the transactions if no disputes are raised.

The flow to create a transaction is represented in the image below:

Users initiate transactions by sending them to the bridge contract deployed on the Ethereum mainnet. This bridge contract handles the locking of assets from users on the Ethereum mainnet and facilitates their transfer to the rollup chain. Upon receiving transactions, the bridge contract adds them to the sequence queue contract, which manages the sequencing of transactions. The sequencer, responsible for processing transactions off-chain, retrieves transactions from the sequence queue contract, builds batches, and ensures they adhere to the rules of the rollup chain. After processing a batch of transactions off-chain, the sequencer generates a fraud proof attesting to the batch’s correctness. These fraud proofs are then submitted to specific contracts on the Ethereum mainnet for verification.

Once verified, the transactions are finalized, and the state of the rollup chain is updated accordingly. Throughout this process, the bridge contract on the Ethereum mainnet primarily serves as a conduit for asset movement between the Ethereum mainnet and the rollup chain, while the sequencer manages the processing and verification of transactions within the rollup chain. This description effectively illustrates the interaction between different components within an Optimistic Rollup solution and highlights the decentralized and secure nature of the transaction process.

Let’s dive a bit into fraud proofs now.

A fraud proof is a cryptographic mechanism used in Layer 2 scaling solutions, such as optimistic rollups, to ensure the integrity and validity of transactions processed off-chain. It provides evidence that transactions were executed correctly according to the rules of the system, guarding against potential fraud or misbehavior by validators. Essentially, a fraud proof demonstrates the consistency between the expected state transition resulting from the execution of transactions and the actual state transition observed during off-chain processing. This cryptographic proof serves as a guarantee that transactions conducted within the Layer 2 environment adhere to the consensus rules and are accurately reflected on the Ethereum mainnet.

If a fraud proof is submitted to the Ethereum mainnet, it undergoes a challenge period during which anyone can dispute its validity by submitting a valid challenge. This challenge mechanism provides an additional layer of security and ensures that fraudulent behavior is detected and penalized. If a valid challenge is raised and proven, the fraudulent transactions are reverted, and the challenger may receive a reward. By allowing participants to scrutinize and challenge the validity of transactions, the challenge process helps maintain the integrity and trustworthiness of the Layer 2 environment, reinforcing the security guarantees provided by fraud proofs.

To create a fraud proof, validators first process transactions off-chain within the rollup chain, resulting in a state transition from the current state to the new state after executing the transactions. Validators meticulously verify the correctness of this state transition by comparing it to the expected state transition based on the executed transactions. Following this, validators calculate the state root of the new state, which serves as a compact representation of the entire state of the rollup chain after processing the transactions.

After calculating the state root, validators construct a Merkle tree of the transaction data and the resulting state transition. The Merkle tree organizes the transaction data and state transition into a hierarchical structure, with the state root as the root of the tree. This enables efficient verification of individual transactions and the state transition. Utilizing the calculated state root and Merkle tree, validators then generate a fraud proof. This proof includes cryptographic data, such as Merkle proofs, that link the executed transactions to the resulting state transition and the state root. This cryptographic data serves as evidence that the transactions were executed correctly and that the resulting state is valid. Finally, the fraud proof is submitted to specific contracts on the Ethereum mainnet for verification. These contracts validate the integrity of the fraud proof by checking the consistency between the expected state transition and the actual state transition recorded on the rollup chain. If the fraud proof is deemed valid, the transactions are considered finalized, and the state of the rollup chain is updated accordingly. This intricate process ensures the integrity and trustworthiness of transactions processed off-chain in optimistic rollup solutions, providing scalability and security for transaction processing on the Ethereum mainnet.

In summary, Optimistic Rollup emerges as a promising Layer 2 scaling solution for Ethereum, offering notable enhancements in transaction throughput and cost efficiency. By adopting an optimistic approach to transaction verification and leveraging off-chain processing with subsequent cryptographic proofs on the Ethereum mainnet, Optimistic Rollup achieves scalability while upholding security and decentralization.

With its innovative methodology for scalability and transaction validation, Optimistic Rollup is positioned to address Ethereum’s scalability hurdles and unlock fresh opportunities for decentralized applications and DeFi protocols. As Ethereum’s ecosystem evolves, Optimistic Rollup is anticipated to drive wider adoption and usability, heralding a new chapter in decentralized finance and blockchain innovation.

  1. https://ethereum.org/developers/docs/scaling/optimistic-rollups