Learn

A Comprehensive Guide to Optimistic Rollups, zkRollups & Mina’s Place in the Landscape

Learn about rollups, different types, and how Mina Protocol fits into the landscape.

By: James Strudwick (Head of Business Development, Mina Foundation ) & Dylan Kugler (Director of Global Ecosystem BD, Mina Foundation) 

Scalability refers to making a blockchain faster and has become an increasingly important issue over the past few years. The increase in demand for blockchains has led to network congestion and high end-user fees that create a significant barrier to mass adoption. 

Scaling solutions exist to meet this current and future demand with innovative approaches occurring at both the base layer via sharding and off-chain using sidechains, state channels, and rollups. Ethereum has realized the limitation of its base layer and in recent history has delivered on a rollup-centric roadmap, recognizing the scalability problem from both a data and computational perspective. 

What are rollups?

Rollups are designed to be faster and cheaper than transacting on the main chain and we believe they are the superior scaling solution, adding modularity to and maintaining the security of the base layer. 

Rollups are an off-chain scaling solution that executes transactions outside of the core Layer 1 (L1). They process transactions off-chain and then bundle all the transactions into a single block before sending that block back to the L1. By posting a single transaction consisting of potentially thousands of off-chain transactions to the main network, rollups are able to increase the scalability and throughput of the underlying L1. 

As compared to sidechains, most rollups do not have their own consensus model and leverage the security of the settlement layer making them the ideal solution to reduce fees and increase blockchain adoption.

Optimistic vs. zkRollups

There are two primary categories of rollups, optimistic and zero knowledge (ZK). Both execute transactions off-chain and subsequently bundle several transactions into batches. The main difference is how the state transition is verified on-chain. This is extremely important. Without verification of the post-state roots, a bad actor can submit a batch that transfers all tokens to him or herself.       

Optimistic rollups get around this by using fraud proofs. Fraud proofs are simply a claim by a verifier that a state transition is invalid and that a batch should be reverted. Optimistic rollups do not compute transactions. Instead they assume “optimistically” that all transactions are legitimate and work with a predetermined challenge period between submitting the rollup and executing on the base chain whereby any participant can submit a fraud proof to trigger a dispute process in case an invalid transaction or block has been submitted.

zkRollups, like those on Mina, choose to use a different method of verification, using validity proofs to verify the state transition. These cryptographic validity proofs are generated using zero knowledge proofs, which are a type of proof that allows one party to demonstrate the validity of a computation to another party without revealing any additional information. In the context of zkRollups, the zero knowledge proofs demonstrate the correctness of the off-chain transactions and the integrity of the zkRollup transaction.

Beyond the proof type, there are additional ways we can directly compare optimistic and zkRollups; transaction finality, EVM compatibility, security, and transaction cost. 

Beyond the proof type, there are additional ways we can directly compare optimistic and ZK Rollups; transaction finality, EVM compatibility, security, and transaction cost.

L1 Transaction Finality

Optimistic rollups: Fraud proofs are accompanied by a 1 to 2 week challenge window. No transaction can be finalized beforehand. From a user-experience perspective, users get near-instant transaction finality as long as they trust the sequencer to be honest.

zkRollups: While ZKPs are computationally intense, we’ve seen significant improvement in proof generation time. From an L1 perspective, the rollup executes as soon as the proof has been verified and the L1 consensus agrees. However, because rollups wait to accumulate a large batch of transactions before submitting a proof, they only post proofs to L1 once every few hours. Therefore, most zkRollups have their sequencers provide “soft confirmation”. For most users, this “soft confirmation” is fine and provides nearly instant finality, but it is true that L1 finality could be delayed.

Conclusion: Given the 1 to 2 week challenge window, optimistic rollups will have a slower transaction finality than zkRollups.

EVM Compatibility

Optimistic rollups: Optimistic rollups can publish complete transaction data to the Ethereum mainnet and have fewer data compression and programming hurdles.

zkRollup: True EVM compatibility is difficult to achieve given general limitations with opcode and bytecode of the EVM. This has led to a tradeoff of compatibility and performance, leading to several projects foregoing the native Ethereum tooling environment for more purpose built solutions. 

Conclusion: Optimistic rollups have a much easier time integrating with Ethereum. While there have been significant advancements within zkRollup projects, there remains a compatibility/ performance tradeoff. Even the most compatible zkRollup has to make some tradeoffs to the execution environment. 

Security

Optimistic rollups: Requires at least one honest node to submit fraud proofs that challenge invalid state transition. Dependent on economic incentives for users to ensure security.

zkRollup: Depends on trustless, cryptographic proofs using zero-knowledge.

Conclusion: Most people use the mere existence of a 1 week challenge window to reason that optimistic rollups are less safe than zkRollups. It is often stated that optimistic rollups have an inferior security model because of the risk of transaction reversals. The theory goes that attackers could potentially submit a large number of invalid transactions, causing the system to revert multiple blocks, which could result in significant disruption and potential loss of funds.

The reality is that there only has to be one honest entity running an optimistic rollup full node that is capable of flagging an invalid state root commitment and challenging its correctness before the expiration of the 1-week challenge window. The odds of this are overwhelmingly high when one considers how many players in the ecosystem would be financially incentivized to ensure the correctness of the optimistic rollup. In reality, the issue lies more with the extra process of fine-tuning challenge incentives with traffic which is a parameter that zkRollups don’t need to consider. So while zkRollups are an inherently more secure design, both optimistic and zkRollups are similarly vulnerable to censorship.

Transaction Cost

The cost of both optimistic and zkRollups are a significant improvement on current Layer 1 transaction fees. 

Conclusion: It is important to note that the cost comparison between zkRollups and optimistic rollups can be influenced by various factors, such as the complexity of the transactions being processed, the specific implementation details, and the level of congestion in the Ethereum network. This being said, zero knowledge proofs are space-efficient so the per-transaction costs of zkRollups are generally cheaper than for optimistic rollups. As technology continues to evolve, the transaction costs of both optimistic rollups and zkRollups will continue to drop.

Rollup Market Share Within Ethereum

While Mina is a Layer 1 separate from Ethereum, it’s interesting to see the traction that various zkRollups have received on Ethereum. 

Rollup Market Share Within Ethereum
Source: L2beat.com as of 4/10/22:

Note: In June 2022, dYdX announced that they would develop its own Cosmos-based blockchain, moving away from Ethereum for its latest iteration. dYdX plans to launch their mainnet in H2 2023.

Conclusion: zkRollups lag behind in terms of total value locked and market share given the complexity of the technology and the limited compatibility with Ethereum. As technology improves, we should see developers leverage other chains like Mina as a zero knowledge programmable layer. 

Rollup frameworks for applications

There are two main varieties of rollups that developers can plug into and use. The first is an application specific rollup that supports only a certain type of application or functionality. In contrast, a general purpose rollup allows projects to customize logic and smart contracts independent of a rollup operator, which is not possible with an application specific rollup.

Application-specific rollups are well suited for particular, predefined use cases such as trading, NFTs, and gaming and are a great scaling solution. General purpose rollups are used by projects that require custom code and native smart contracts that can be deployed by any user. For example, many DeFi projects use Uniswap as a price oracle and therefore require the composability from a general purpose rollup. Unfortunately, this level of composability often leads to worse performance and higher fees. 

As crypto moves towards a multichain model, application specific rollups can enable apps to distribute across different environments. This can create an opportunity for new inter- and intra- communication standards for blockchains. As more rollups deploy on an individual chain, a cross-rollup bridge or protocol might be necessary. For example, the Inter-Blockchain Communication Protocol (IBC) solves cross-chain communication in the Cosmos ecosystem and helps authenticate and transport data between two application specific chains. 

Cross-chain communication between application specific rollups and chains can increase scale, security, and efficiency. In May 2022, Immutable X, an application specific rollup focused on gaming, announced it would allow players to trade any asset across various Ethereum Layer 2 (L2) rollups. Doing so allowed them to improve developer L1 to L2 migration and composability.

As a rule of thumb, applications that can latch onto an app-specific rollup are likely to get better performance compared to general purpose rollups. Still, both application specific and general rollups are important for a functioning developer ecosystem

Mina’s Rollup Environment

zkRollups are on the Mina roadmap to increase throughput. While there are plans to decrease finality and provide low latency transactions, we do suspect that pushing a large amount of throughput through the L1 while maintaining high levels of decentralization will be challenging. Therefore, we think throughput will be pushed to an L2 rollup and we believe there will be many different rollup types that will leverage recursion containing batched proofs.

Mina as a Native L1 Rollup

First, Mina as an L1 itself is already a rollup, which lends itself to a throughput focused rollup model. Because of recursion, we can compress computation into a static sized proof without tradeoffs. If throughput is low, users can choose to have the lowest amount of latency and if throughput is increasing, users can process additional recursive proofs to get higher throughput while adding a small amount of latency.  Essentially, this means that the system can scale exponentially, and can be dynamically adjusted based on usage to optimize latency.  

L2 Rollups on Mina

The first version of the Mina zkRollup will be designed in such a way that it is isomorphic with the Mina L1. This gives many benefits. First, developers can easily port their applications to the L2 without any code changes. Second, just like on the L1, zkApps will be composable with each other. Furthermore, with the right rails, any rollup or app-chain on Mina will be able to provably read data from each other, thereby improving the composability of the entire Mina ecosystem. Third, all tooling and remote procedure call (RPC) services will be reusable. 

What this looks like is ‘Mina on Mina’ and it’s already in progress by community member, Trivo#0001. This zkRollup will also be designed to be modular and extensible. Modular in the sense that data availability, sequencing, proving, and execution can be thought about separately, allowing for easier maintenance and greater flexibility. Extensible, in the sense that other execution models can be added to the stack as the ZK compute ecosystem evolves e.g. zkEVM, zkLLVM, Risc.

Not only will Mina L2s and zkApp chains be interoperable with each other, but with state proof bridging it will also be possible to verify state between Mina L2s and other chains, specifically EVM chains but also Cosmos and IBC connected chains in the future.

Mina is an ideal environment for rollups

Mina Protocol’s rollup environment can be seen in contrast to the mostly centralized rollup landscape. Given Mina’s decentralized recursive/ rollup nature, we can actually take some of the building blocks from the Mina L1 to make a decentralized Mina L2. Most existing rollups are centralized and, as mentioned in the opening paragraph, do not have their own consensus model. This might not hold true as decentralized rollups are created. For example, the data availability layer in some planned Mina L2s has a small consensus layer attached to it, which can be optimized for speed and compatibility.

Further, because zkApps leverage Mina’s recursive properties, they can also be considered a rollup that is executed off-chain and verified on-chain. This is an important building block for Mina’s ecosystem. 

Finally, Mina is able to produce proofs in-browser, which has huge implications for scaling both applications and rollups while maintaining a high level of decentralization. Other projects have proofs that take up to 1 TB of memory and require hundreds of cores, making it impossible to run on regular consumer hardware let alone in-browser or on phone. Viable Systems, a Mina ecosystem contributor, has recently released OpenMina. OpenMina is a proof of concept in-browser web node that can send and validate transactions directly on a user’s device. This is a large step towards fully realizing a decentralized blockchain.

Comparison of key zero knowledge chains

Comparing some zero knowledge (ZK) projects, especially in the rollup landscape.

L1s: 

Mina is a L1 blockchain that uses recursive zk-SNARKs to keep the blockchain at a state of less than 22KB, using zero knowledge proofs to build a more secure, accessible, and decentralized blockchain architecture. Zero knowledge smart contracts, referred to as “zkApps” on Mina, are written using o1js (formerly SnarkyJS), which is a Typescript based library, reducing the barrier to entry for thousands of existing developers. Mina’s mainnet has been live since March of 2021. 

Like Mina, Aleo is building a programmable zkApp layer but with its proprietary programming language, Leo. While Mina allows for programmable privacy, Aleo is highly focused on building a completely private ledger. As of April 2023, Aleo has not launched on mainnet yet. 

ZCash is another privacy focused L1 that created the first production ready implementation of a zero knowledge proof to support shielded and private transactions. ZCash has been live on mainnet since 2016.  

zkEVMs:

There are several prominent zkEVMs, or zero knowledge Ethereum Virtual Machines, all with different approaches. All of the projects below have launched on mainnet as of April 2023 except for Scroll. 

Starknet uses a STARK proving system instead of a SNARK. Smart contracts are written in Cairo and while Starknet does not natively support EVM, they are working to develop a Solidity to Cairo transpiler. 

Aztec Network is a fully private zkRollup and uses their proprietary domain specific language, Noir, to create and verify zero knowledge proofs. Like Aleo, Aztec is focused on private ledgers and has developed tools to enable private DeFi on Ethereum.

zkSync supports a variety of developer tools used to write Ethereum smart contracts, including Solidity. Their latest iteration was recently rebranded as zkSync Era.

Scroll enables native compatibility for existing Ethereum applications and tools. Scroll is currently in testnet and striving for full EVM equivalence, focusing on building an EVM opcode for zkEVM.

Like Scroll, Polygon zkEVM is building a fully equivalent EVM solution.

Conclusion

Zero knowledge technology is one of, if not the most, innovative solutions in crypto. It’s primarily been used for scaling purposes. However, new solutions like Mina have emerged that extend zero knowledge’s capabilities, creating an incredible opportunity to bring real world data on-chain while leveraging scaling potential. 

Ultimately, all projects should be looking into zkRollups as a potential end-state scaling solution for their particular chain. Further development is needed for zkEVMs to overcome the inherent challenge of building a performant solution while remaining EVM compatible. Still, we’re excited to see what is built and developed when zero knowledge is fully available and relevant for all developers.

If you’d like an additional explanation of what zero knowledge rollups are — check out this video.

More from our Blog

SEE ALL POSTS
Announcement / 2023-12-22 / Mina Foundation
zkIgnite, Cohort 3 – What Will You Build?
zkIgnite is a cohort-based, community-governed innovation fund for experienced zero knowledge (ZK) builders and entrepreneurs in the Mina ecosystem.
Read more
Community / 2023-12-22 / Mina Foundation
Exploring Three Grant Programs for Mina Developers
Read more
Announcement / 2023-12-19 / Mina Foundation
Letter to the Community
Read more
Announcement / 2023-12-19 / Mina Foundation
Mina Foundation Appoints Kurt Hemecker as CEO to Spearhead Ecosystem Growth
Read more

关于技术

AboutTechCta

Mina uses advanced cryptography and recursive zk-SNARKs to deliver true decentralization at scale.

开始

GetStartedCta

Mina makes it simple to run a node, build and join the community.