TLDR;
Optimistic Rollups are a scaling solution for Ethereum. They scale Ethereum roughly by 100x by pushing computation off-chain and submitting minimum transaction data along with Merkle state root on Ethereum. They offer secure, fast, and cheap transactions, the way it was meant to be.
Need -
Ethereum is envisioned to be a World Computer. A world computer that could, one day, potentially hosts a substantial percentage of all digital transactions. This could range in million transactions per second if not billion. However, Ethereum currently offers a limited blockspace supporting 15-45 transactions per second. With increased user adoption and an increasing number of applications, the network is already becoming clogged with high transaction fees making it inaccessible for retail users. Therefore, scaling solutions are absolutely crucial to realizing this dream. Roll-ups are currently the most important type of scaling solution for L1s. Understanding Roll-Ups is important to understand the entire ecosystem. There are two types of Roll-Ups - Optimistic Roll-Ups and zk Roll-Ups. Let’s explore Optimistic Roll Up in the current article.
Idea -
Roll-Ups in principle are a mechanism for optimizing blockspace usage of Ethereum Mainnet. A not-so-perfect analogy would be to zip a file to reduce its size and therefore reduce the space it takes on the hard disk. Ethereum block size is around 80-100 Kb in general (It varies, the limiting factor is the Gas. Each block has a target size of 15 Million Gas. More on Gas later!). Hence, of course, we need to use this space very optimally. It typically takes around ~110 bytes to transfer ETH on a mainnet. Using roll-ups, the same transfer can be done in ~12 bytes[Source]. However, rollups not only save on data stored on-chain, but they also take the computation off-chain further saving on gas. This roughly creates an improvement of 150x allowing 2000-4500 transactions per second. Of course, the exact improvement depends on the implementation and the transaction type.
Implementation -
Now, let’s deep dive into how this happens for Optimistic Roll-Ups and if there are any associated security risks. The primary component of Optimistic Roll-Ups are -
The sequence of events when a transaction is initiated is as follows -
Step 4 is critical to solving the data availability problem. This limits scalability but this is how L2 layer protocol inherits the security of Layer 1 protocol. Let’s see how.
The idea behind Optimistic rollups is that it is optimistic and assumes that the sequencer behaves in good faith. It does not censor any transaction, validates all transactions appropriately, and then submits the updated Merkle state of the child chain. After submitting, everyone gets a chance to report an invalid transaction for a pre-decided period of time (challenge/dispute period). The assumption is that at least one actor will be monitoring the chain and reporting fraudulent transactions if any. This is a good assumption given the incentive mechanism in place. The sequencer submitting transactions is required to deposit a certain amount of money (Ex - ETH). The money is locked until the end of the challenge period. If a challenger reports a fraudulent transaction, the entire block is executed via Fraud Proof contract on the Ethereum mainnet. It is possible because the old state Merkle root and transaction data is already available. If the challenge is successful, the challenger is rewarded an amount from the locked sequencer amount. The fraudulent transactions are reversed and the correct state is stored. Since any transaction can be validated on Ethereum, optimistic roll-ups inherit the security of Ethereum and at the same time offers fast and cheap transactions. Therefore, the only risks associated are smart contract risks and Ethereum security risks.
Optimistic roll-ups provide a secure, fast, and cheap alternative to Ethereum. Optimism and Arbitrum are two major projects. Since they are EVM compatible, any smart contract can be easily migrated from the Ethereum mainnet to L2. They will surely form a critical infrastructure layer in the Web3 ecosystem. But are they enough? Even though they typically scale up the Ethereum by 100x which could serve for a few years, it seems to me that we may still need further scaling solutions as the ecosystem and the users on Web 3 evolve!