DEV Community

Igor Lourenço
Igor Lourenço

Posted on

What are Rollups, Ethereum's big scalability insight?

Rollup is a way of scaling operations on Ethereum that consists of executing transactions outside of Layer 1 (Ethereum Mainnet) and then indexing everything on Layer 1, using the advantage of being outside of Mainnet (speed), but still with the same security protocols.

Taking these transactions off Mainnet allows more transactions to be made and this becomes cheaper, because in Rollups, only some transaction data is sent to the main network, after which it is executed in a separate network, compatible with Mainnet (EVM- based).

Once the transactions are rolled up, it's time to group them into batches of transactions and then send them for validation on the main network, the Ethereum Mainnet.

The process is summed up: executing transactions, taking the data, compressing it and "cumulating" it in the main chain in a single batch. Hence the name Rollup (a rollup).

But how do you know that this data is really trustworthy, not someone wanting to manipulate everything for their own benefit? Proving: each type of rollup is responsible for some smart contracts on Ethereum Mainnet, which will validate deposits and withdrawals, in addition to verifying authenticity.

Basically, we have two types of rollups, Optimistic Rollup (optimistic) and ZK Rollup (zero knowledge), which differ from each other in the way they validate and prove transactions.

Below, I'll explain the basics of each of the types, but over the next few days I'll create threads explaining each one separately and in more detail, for a clearer understanding. First, Optimistic Rollup:

As the name implies, Optimistic Rollup takes an optimistic stance in relation to the data it receives and posts it on Ethereum as true and consistent. If they are really consistent, nothing more needs to be done, but in case of fraud, the person who sent the transaction is punished.

To achieve this, Optimistic Rollups implement a dispute resolution system that is capable of verifying evidence of fraud, detecting fraudulent transactions and discouraging corrupt ones from submitting other invalid transactions or performing incorrect validations.

When a fraud is sent, the system enters dispute resolution mode. So, the suspicious transaction is executed again, this time on Ethereum Mainnet. If the execution proves that the transaction was actually fraudulent, the party that presented it is punished.

To prevent corrupt parties from spamming the network with incorrect evidence of fraud, parties who wish to send evidence of fraud often also need to provide a link that can be subject to court.

In order to be able to execute a rollup transaction on Ethereum Mainnet, Optimistic Rollups must implement a system that is capable of playing back a transaction with the same state that was present when the transaction was originally executed in the rollup.

This is one of the tricky parts of Optimistic Rollups and is usually achieved by creating a separate smart contract that replaces certain function calls with a rollup state.

In contrast, in ZK Rollups there is no dispute resolution. This is possible by leveraging a smart piece of cryptography called Zero-Knowledge evidence, hence the name ZK rollups. In this model, each batch posted to tier 1 includes a cryptographic proof called ZK-SNARK.

Evidence can be quickly verified by smart contract on Ethereum when the transaction batch is submitted and invalid batches can be rejected immediately.

At first, this is simple, but, in practice, for this to work, there is a complex layer of cryptography and mathematics, the result of hours of work by several researchers.

Besides this one, there are other differences between Optimistic and ZK Rollups. Briefly:

  • Time to withdraw funds: Optimistic Rollups can generally take days to allow withdrawals, as the implementation method expects a consensus on proof of fraud. ZK Rollups are much faster once the batch of transactions and a proof of validity are submitted.

  • Compatibility: Due to the complexity of the technology, it's much harder to create an EVM-compatible ZK Rollup, which makes it harder to scale apps without having to rewrite much of their logic. Optimistic Rollups use 99% of smart contracts with no need to change.


As should have been clear, Rullups is a pretty big subject. This thread was more to talk about the topic and leave it open for study. Over the next few days, I will be doing separate articles explaining Optimistic Rollups and ZK Rollups better and separately.

References:
https://finematics.com/rollups-explained/
https://vitalik.ca/general/2021/01/05/rollup.html

Top comments (0)