Security
Hacker makes replay attack

Understanding rollups in Ethereum

2024-02-02
Explore the world of Ethereum rollups with 0xGuard Blog. Dive deep into how rollups work, their types, and their significance in scaling Ethereum's network.
Learn about the technology that's paving the way for faster, cheaper transactions without compromising on security. Whether you're a developer, investor, or Ethereum enthusiast, our comprehensive guide demystifies rollups and explains their role in Ethereum's future. Stay ahead in the blockchain space with insights from 0xGuard.
Ethereum scaling problem. Gas costs

The scaling problem on Ethereum, along with the cost of gas have been critical issues for many years. At the time of writing this article, a swap on a Dex or a borrowing operation costs around $30+, with the average gas price over the last week being 50 Gwei. During periods of network congestion, the fees can increase significantly. Not surprising that this poses a major barrier to Ethereum's adoption: a newcomer has to have substantial funds to even out the network.

Where some see a problem, others see an opportunity. Ethereum shortcomings have led to the emergence of Ethereum forks, each with its own specific features. All of them, however, primarily address the transaction cost. Ethereum developers are continuously working on this problem and numerous approaches to solving it have already been developed.
Rollup solution for scaling Ethereum
For a long time, the primary approach to scaling Ethereum was sharding. Sharding essentially means breaking the blockchain into smaller, separate parts, which have to be verified by a subset of validators. However, the rapid development of rollup technology has shifted the Ethereum community's focus to rollups as the main method of scaling.

The principle behind rollups involves aggregating transactions into batches, processing them off-chain, and then recording the results on the Ethereum network.

In this article, we will explore two rollup scaling methods, delve into their unique features, and understand how they work.

How do rollups work

Rollups are a specific case of Layer 2 solutions. The general principle of such solutions is as follows: transactions are processed outside Layer 1, while Layer 1 (Ethereum) is used as a foundation to ensure security. For many solutions, transactions sent to Layer 2 are organized into batches, compressed, and then recorded on Layer 1 as data. Combined transactions are recorded on Layer 1 as a single transaction, which significantly reduces gas fees and allows for greater network throughput.

There are two types of rollups: optimistic rollups and zk-rollups. Let's examine how each of them works.
Optomistic rollups

Optimistic rollups take computations and storage out of the Ethereum network, recording only the transaction data on the main network in a compressed form. This approach enables a 10-100x increase in network performance.

The name 'Optimistic' stems from their operational principle: Layer-2 transactions are assumed valid a priori, and are recorded on the main Ethereum network. There is then a specific period during which these recorded transactions can be challenged. Generally, anyone can challenge a transaction, but sometimes, at the start of Optimistic solutions, there's a whitelist of entities that are allowed to dispute.

Typically, validators who publish batches to the main network provide a bond, usually in the form of ETH, which they risk losing if they publish fraudulent transactions. If someone notices a fraudulent transaction in a published batch, they can initiate a challenge. During the challenge, a system of smart contracts verifies the fraudulent transaction. A challenge involves executing transactions on the Ethereum network for verification.
If a challenge is successfully disputed, the validator who posted the invalid data is penalized. If no one starts a challenge during the dispute period, the transactions are deemed valid.

Thus, the absence of fraudulent transactions in Optimistic rollups is ensured by the existence of at least one network participant who checks transactions and opens a challenge if necessary.
Currently, the most popular Optimistic solutions are Optimism and Arbitrum. A distinctive feature of Arbitrum is the implementation of a multi-stage challenge process. This allows only a few instructions on Layer 1 to prove invalidity, meaning the block size on Arbitrum can be larger than a block on Ethereum: it does not need to be fully executed when proving fraud.
ZK-rollups

Just like Optimistic rollups, Zero-Knowledge (ZK) rollups aggregate transactions into batches that are processed off-chain but instead of using a challenge period where a posted batch can be disputed, a cryptographic proof of the batch’s validity is posted to the main network along with the batch itself. This proof is created using zero-knowledge protocols.
A zero-knowledge protocol is a method where one party (the prover) can prove to another party (the verifier) that a statement is true, without revealing any additional information.

To illustrate, consider the classic example: Alice needs to prove to Bob that she has the key to a door separating two paths. Alice tells Bob she knows the door's code but does not want to reveal the code itself. To prove her knowledge, Alice enters through path A and exits through path B, thereby showing she knows the pin code to open the door without disclosing it to Bob.
Using the mathematical framework of ZKP, ZK rollups record on the Ethereum main network both the transaction data and the proof. This eliminates the need for a challenge period, as in Optimistic rollups.
The main drawback of ZK rollups is that due to the complexity of the mathematical apparatus, it's challenging to make them EVM-compatible. However, active development of such systems is ongoing, and they are likely to appear soon. Another limitation of ZK rollup systems is that they require specialized hardware for their operation.

Conclusion

As of now, rollups are the primary method for scaling the Ethereum network. In this article, we have explored the main ways of constructing rollups, along with their advantages and disadvantages. Currently, the development of rollups is one of the most active areas of research within the Ethereum community, and we can expect many new developments in the near future.