Understanding ZK-Rollup and Optimistic Rollup

Favour Kelvin
4 min readFeb 12, 2021

This might be a pretty new concept to some people, to some, they have probably heard about it. In this blog post, we will take a deep dive into understanding ZK-Rollup and its concept.

Layers

In the context of distributed ledger technologies, layers refer to frameworks built on top of existing ledgers to increase their throughput and address. There are two types of layers: layer 1 and layer 2 known as the main chain and off-chain respectively.

Layer 1

Layer 1 also known as main chain refers to the blockchain or distributed ledger itself.

Layer 2

Layer 2 also known as off-chain refers to frameworks for increasing the throughput of layer1 and is built on top of the main chain. Layer 2 solutions is designed to help scale your application by handling transactions off the main chain (layer 1)

Why is Layer 2 important?

  • Layer 2 is used in some use-cases, like blockchain games.
  • Layer 2 is not expensive to use.
  • Any updates to scalability would not be at the expense of decentralization of security — layer 2 builds on top of Ethereum.

What distinguishes layer2 scaling solutions

The development of layer2 scaling solutions has led to two primary courses of development which is: state channels and sidechains

State channels provide an off-chain communication layer where peers can exchange value and also let the blockchain know when they are done with transactions

Sidechains are separate ledgers used to record multiple transactions.

Types of layer 2 solution

  • Rollups: ZK rollups and Optimistic rollups
  • State channels
  • Plasma
  • Validium

But for this post, we would be looking at Rollups(optimistic and ZK-rollups)

Rollup

In an Ethereum smart contract, A Rollup is an off-chain aggregate of transactions that eliminates fees and latency by increasing the blockchain’s throughput from its existing 15 tps to over 1,000 tps.

Note: tps - Transaction processing system.

A Rollup is a Plasma-like Layer-2 scaling solution where all funds and a concise cryptographic pledge to a bigger sidechain state owned by a single mainchain contract. The distinction between Rollup and Plasma is that by publishing such data for each transaction through the L1 network, Plasma solves the issue of data accessibility.

There are two Rollup types, based on how the accuracy of the state transition is ensured: ZK Rollup and Optimistic Rollup.

Optimistic Rollup

The new state root is issued by the operator(s) in an Optimistic Rollup without being tested by the Rollup smart contract each time. Instead, everybody hopes the transition of the state is right. In an event where an incorrect state change is released, other operators or users(who have been observing the L1 Rollup contract) will be able to point to the invalid transaction and undo the incorrect block.

Optimistic rollups transactions are written to the main Ethereum chain as calldata, optimising them further by reducing cost.

Use Optimistic rollups

Pros of Optimistic Rollup

  • Anything you can do on Ethereum layer 1, you can do with Optimistic rollups
  • On the layer 1 chain, all transaction data is stored, ensuring it is protected and decentralized.

Cons of using Optimistic Rollup

  • There could be potential fraud challenges.
  • It is vulnerable to attacks if it gets higher than the amount in the operator’s bond

ZK-Rollup

ZK-Rollups is one of the options that was being built by Layer 2 construction that improves scalability via mass transfer processing rolled into a single transaction. In ZK-rollup data is placed on the mainchain and hundreds of transactions are bundled through ZK-Rollups into one single transaction.

As with the underlying L1 (i.e. Ethereum), ZK-Rollups have the same protection assurances, the ability to deliver blocks in less than a minute and to improve throughput. ZK-Rollups replaces zero-knowledge facts for fraud problems. Separate Merkle Trees represent accounts and balances. These Merkle Tree roots mean that the data will not be faked by anybody.

The two types of users that are part of the ZK-Rollup scheme: transactors and relayers. Transactors establish their transfer to the network and broadcast the transfer while relayers collect large amounts of transfer to create a rollup.

Use ZK rollups

Pros of ZK-Rollup

  • Faster than Optimistic rollup
  • Reduced fees per user transfer

Cons of using ZK-Rollup

  • There is a level of unverifiable trust in the security scheme.
  • Quantum computing poses a threat to hacking the blockchain

Conclusion

Both ZK-Rollup and Optimistic Rollup have different security models, ZK Rollup will fix several fundamental issues with Optimistic Rollup:

  • Reduce withdrawal times from 1–2 weeks to a few minutes;
  • Enable fast transactions confirmations and exits in practically unlimited volumes;
  • Introduce privacy by default.

--

--

Favour Kelvin

Software engineer, Technical writer. I enjoy the synergy of writing and technology