Rapture #162: Optimistic vs. ZK Rollups

Rapture #162: Optimistic vs. ZK Rollups

Yesterday, I covered some of the major scaling solutions from a high level. A significant portion of the research for these newsletters on scaling solutions comes from my old boss Preethi Kasireddy's posts, so check those out if you want a more in depth explanation of these concepts.

Today, I thought it would be interesting to delve into the differences between two of the major rollup solutions: optimistic rollups and zk rollups.

Optimistic Rollups

For optimistic roll ups, when there is a new batch of transactions submitted to the mainchain, the hash and state root of each bundle of transactions is presented. Yet there is no validation of that the transactions were executed appropriately at the time of submission.

Thus, the submitter is "optimistically" submitting the new transaction data and state root to the mainchain's rollup contract. The contract trusts the submitter's new state root at face value.

Post submission, users can discover that there was an invalid state transition and consequently they can generate a fraud proof.

The fraud proof contains a proof of transactions that were applied during a state transition, a proof of "post-state," or, how the state should have looked after the transaction was applied, and a proof of "pre-state," or, how things looked before a transactions was applied.

When a fraud proof is submitted, the rollup contract validates the proof, applying the transaction logic to the pre-state and post-state. If pre-state and post-state are incongruent, then there is clear proof that the poster of the batch didn't submit the transactions appropriately. Consequently, the smart contract will revert the batch and all batches following it.

Any entity that submits a batch to the mainchain needs to set aside a deposit to insure that if they act maliciously and the fraud proof comes back negative, then the deposit can be slashed.

In summary, optimistic rollups allows users to submit batches first and then have them proven wrong (and reverted) later.

ZK(SNARK) Rollups

While you must prove an optimistic rollup is incorrect post facto via a fraud proof, ZK rollups takes the opposite approach of verifying the batches previous to them hitting the main chain.

For ZK rollups, batches include a proof called ZK-SNARK, which proves the state root is the right result of the submitted batch of txs. The proof is merely a hash that signifies the change for the state of the blockchain post submitting the txs in the zk-rollup.

Consequently, ZK-SNARK rollups allow for batches to be validated even before they hit the mainchain.

Quick Comparison

In terms of the gas required to post new batches on-chain, Optimistic rollups cost less. For the gas costs per transaction posted on-chain, Optimistic rollups cost more. In terms of off-chain computation costs, Optimistic rollups cost less.

Users have to wait approximately 1 week to withdraw their assets from an Optimistic rollup compared to less than 10 minutes for a ZK rollup, which means ZK rollups has a better user experience in terms of speed.

Optimistic rollups are simpler because the fraud proof technology has been around for a long time and is more easily understood compared to zero knowledge tech.

That being said, Optimistic rollups are less scalable, since witnesses need to be posted for each transaction so that the transactions can be proven wrong if necessary in the future. Witnesses take up a lot of space.

Optimistic rollups are also less secure because they rely on on an incentive system to ensure entities can detect fraud rather than mathematically proving incongruence pre-main chain submission.

Disclaimer:

The Content on this email is for informational purposes only, you should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained on this site constitutes a solicitation, recommendation, endorsement, or offer by Rapture Associates or Mattison Asher or any third party service provider to buy or sell any securities or other financial instruments in this or in in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

All Content on this site is information of a general nature and does not address the circumstances of any particular individual or entity. Nothing in the Site constitutes professional and/or financial advice, nor does any information on the Site constitute a comprehensive or complete statement of the matters discussed or the law relating thereto. You alone assume the sole responsibility of evaluating the merits and risks associated with the use of any information or other Content on the Site before making any decisions based on such information or other Content. In exchange for using the Site, you agree not to hold Rapture Associates, Mattison Asher, and ย its affiliates or any third party service provider liable for any possible claim for damages arising from any decision you make based on information or other Content made available to you through the Site.