From Security to Performance: Comparing Optimistic Rollups and zkRollups in the DeFi Space

Aniket Prajapati
3 min readJan 27, 2023

--

Optimistic rollups and zkRollups are two different scaling solutions for the Ethereum blockchain. Both aim to increase the number of transactions that can be processed per second, but they do so in different ways.

Security:

  • Optimistic rollups rely on a security model where a small number of validators are responsible for processing transactions and maintaining the state of the rollup. This model is less secure than zkRollups, as a quorum of validators can freeze or confiscate funds. Additionally, they are more vulnerable to hot-wallet key exploits and crypto-economic attacks.
  • ZkRollups, on the other hand, use zero-knowledge proofs to ensure the security of transactions. This means that no single party has the power to freeze or confiscate funds, and the system is immune to hot-wallet key exploits and crypto-economic attacks.

Performance/economics:

  • In terms of performance and economics, both solutions have similar capabilities. Both can achieve a maximum throughput of 2k transactions per second on Ethereum 1.0 and 20k+ transactions per second on Ethereum 2.0. Both are capital-efficient and do not require separate onchain transactions to open new accounts. The cost of transactions is also low for both solutions.

Usability:

  • Optimistic rollups have a longer withdrawal time of 1 week, while zkRollups have withdrawal times ranging from 1 to 10 minutes. The time to subjective finality is also faster with zkRollups, taking 1 to 10 minutes compared to 1 confirmation with optimistic rollups. Additionally, zkRollups allow for client-side verification of subjective finality, while optimistic rollups do not.

Other aspects:

  • Both solutions are flexible when it comes to smart contracts and are EVM-bytecode portable. However, zkRollups have native privacy options, while optimistic rollups do not.

To understand better, lets look at an example:

An optimistic rollup would be a decentralized exchange (DEX) built on top of the Ethereum blockchain. The DEX allows users to trade ERC-20 tokens without having to pay the high gas fees associated with on-chain trades. Instead, the DEX uses a small number of validators to process trades and maintain the state of the exchange.

When a user wants to trade tokens, they would send their transaction to the validators, who would then process the trade and update the state of the exchange. The trade would be considered “optimistic” because it is not yet confirmed on the Ethereum blockchain, but the validators have processed it and updated the state of the exchange.

Once the trade has been confirmed on the Ethereum blockchain, the user can withdraw their tokens. This process can take up to 1 week, during which time the user’s funds are locked.

In contrast, a zkRollup would use zero-knowledge proofs to ensure the security of trades, meaning that no single party has the power to freeze or confiscate funds. Additionally, trades would be confirmed on the Ethereum blockchain almost instantly and the withdrawal process would be much faster, typically taking 1 to 10 minutes.

An example of a zkRollup is a decentralized lending platform, where user can lend and borrow assets in a trustless manner. The platform would use zero-knowledge proofs to ensure the privacy and security of user’s assets and trades, and would confirm trades on the Ethereum blockchain almost instantly, allowing for fast and efficient lending and borrowing.

In summary, zkRollups are more secure than optimistic rollups, have faster withdrawal and subjective finality times, and have native privacy options. On the other hand, both solutions have similar performance and economic characteristics, and are flexible when it comes to smart contracts.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response