- Blockchain Council
- November 02, 2023
Summary
- zkEVMs (Zero-Knowledge Ethereum Virtual Machines) aim to address the Blockchain trilemma of scalability, security, and decentralization to improve the functionality of Blockchain networks.
- They work by offloading transactions from the Ethereum mainnet, using cryptographic proofs (zk-SNARKs) to validate transactions, and batch transactions for efficient processing while maintaining compatibility with Ethereum applications.
- There are five main types of zkEVMs: Type 1, Type 2, Type 2.5, Type 3, and Type 4, each with its unique characteristics and trade-offs.
- Type 1 zkEVMs prioritize compatibility with Ethereum but can have lengthy prover times.
- Type 2 zkEVMs balance compatibility and introduce slight changes to improve prover times.
- Type 2.5 zkEVMs focus on reducing worst-case prover times by increasing gas costs for specific operations.
- Type 3 zkEVMs make some compromises to improve prover times and are easier to develop.
- Type 4 zkEVMs compile smart contract source code directly to ZK-SNARKs, resulting in very fast prover times.
- Several examples of zkEVMs are discussed, including Polygon zkEVM, zkSync Era, Linea, Scroll zkEVM, Taiko, Hermez zkEVM, Optimism, ZkPorter, and StarkWare Cairo, each with its unique approach and goals.
- These zkEVMs offer a range of options for developers and projects, aiming to create a dynamic, efficient, and secure Blockchain ecosystem while addressing specific needs.
Zero-Knowledge Ethereum Virtual Machines, or zkEVMs, are the latest buzz in the Blockchain world, promising to tackle the Blockchain trilemma – scalability, security, and decentralization. These three pillars are crucial for the mainstream adoption and functionality of Blockchain networks, and zkEVMs emerge as a potent solution.
These are like powerful engines making sure everything on the Blockchain runs smoothly, securely, and without forming a long queue. Now, these engines or zkEVMs come in different types, each with its own special features, just like cars have different models. Some are built for speed, some for carrying heavy loads, and some for cruising comfortably on rough roads.
Today, we are going to peek under the hood to understand the different types of zkEVMs and what makes each one tick. So, buckle up and let’s get started!
What are zkEVMs and how do they work?
zkEVM, short for Zero-Knowledge Ethereum Virtual Machine, is an innovative technology designed to enhance the scalability, security, and efficiency of the Ethereum Blockchain. It’s a class of Layer 2 solutions that leverage Zero-Knowledge Proofs (zk-SNARKs) to validate and execute Ethereum transactions and smart contracts off the main Ethereum network.
So, how does a zkEVM work? Here’s a brief overview:
- Offloading Transactions: zkEVM takes transactions off the Ethereum mainnet to reduce congestion.
- Zero-Knowledge Proofs: It uses cryptographic proofs to validate transactions without revealing their details.
- Transaction Bundling: Transactions are batched together for cost-effective processing.
- EVM Compatibility: Maintains compatibility with Ethereum applications.
- Optimistic Rollup: Assumption of transaction validity speeds up processing.
- Data Compression: Efficient data storage for faster execution.
Different Types of zkEVMs
Now that we know what zkEVMs are and how they work, let’s understand the various categories of zkEVMs. They come in various types, each with its unique characteristics, offering a spectrum of trade-offs that cater to the diverse needs of the Blockchain ecosystem. To answer the question in brief, “What are the types of zkEVMs?”, there are 5 main types of zkEVMs, and they are, Type 1, Type 2, Type 2.5, Type 3 and Type 4. Let’s understand each of them in detail:
Type 1 zkEVMs
Type 1 zkEVMs aim for the pinnacle of compatibility, striving to be fully Ethereum-equivalent. They make no alterations to Ethereum’s core, retaining everything from hashes to state trees. The advantages are clear: perfect compatibility with Ethereum as it exists today, making it a crucial ingredient for boosting Ethereum’s scalability. However, this pursuit of purity comes at a price – prover time. Since Ethereum wasn’t initially designed with ZK-friendliness in mind, creating proofs for Ethereum blocks can be a time-consuming endeavor. This type of zkEVM is ideal for Ethereum’s layer 1 and rollup solutions, but it’s not without its challenges.
Pros:
- Perfect compatibility with Ethereum.
- Long-term scalability improvement for Ethereum.
Cons:
- Prover time can be quite lengthy.
Type 2 zkEVMs
Type 2 zkEVMs strike a balance between EVM-equivalence and Ethereum-equivalence. They look like Ethereum from the inside, making them compatible with existing applications. However, they introduce slight changes to enhance development and speed up proof generation. This means that many applications designed for Ethereum would still work on a Type 2 zkEVM rollup, albeit with some modifications. Some exceptions include applications relying on Merkle proofs of historical Ethereum blocks, which can be affected by changes in the zkEVM. These zkEVMs streamline proof generation by modifying Ethereum’s data structures, leading to improved but not lightning-fast prover times.
Pros:
- Excellent compatibility with Ethereum applications.
- Improved prover times compared to Type 1 zkEVMs.
Cons:
- Some applications may require adjustments.
- Prover times, while improved, are not exceptionally fast.
Type 2.5 zkEVMs
Type 2.5 zkEVMs, also known as gas-equivalent zkEVMs, tackle the challenge of worst-case prover times by significantly increasing the gas costs of specific operations in the EVM that are challenging to ZK-prove. While this approach may reduce compatibility with certain applications, it’s generally considered less risky than making deeper changes to the EVM. Alternatively, some projects set hard limits on the number of times each operation can be called to manage resource constraints. This approach balances the need for performance with maintaining compatibility.
Pros:
- Improved worst-case prover times.
- More efficient resource management.
Cons:
- Reduced compatibility with specific applications.
- Hard gas limits can be less flexible and interact differently with EVM security assumptions.
Type 3 zkEVMs
Type 3 zkEVMs make some compromises to improve prover times and make the EVM more developer-friendly. They may remove some features that are exceptionally hard to implement in a ZK-EVM. While the goal is compatibility with most applications, some may require rewriting. The advantage here is that these zkEVMs are easier to build, and they offer faster prover times due to certain feature removals.
Pros:
- Easier to develop and faster prover times.
- Compatibility with a wide range of applications.
Cons:
- Some applications may require rewriting.
- Not fully EVM-equivalent.
Type 4 zkEVMs
Type 4 zkEVMs take a different approach by compiling smart contract source code written in high-level languages directly to a language designed for ZK-SNARKs. This method leads to very fast prover times by bypassing the need to ZK-prove every EVM execution step. However, this approach introduces more incompatibility with certain applications, as contract addresses may not match those on the EVM, and handwritten EVM bytecode may not be supported. Debugging infrastructure may also need adjustments, although the advantages in prover times are substantial.
Pros:
- Very fast prover times.
- Reduction of overhead by not proving every EVM execution step.
Cons:
- Incompatibility with some applications.
- Challenges with contract addresses and debugging infrastructure.
zkEVMs come in a variety of types, each offering a unique blend of compatibility, performance, and resource management. Depending on the specific requirements of a project, one type may be more suitable than another. By understanding these zkEVM types and their trade-offs, developers can make informed choices to advance the future of Blockchain scalability while maintaining the integrity of the Ethereum ecosystem.
Also Read- What is zkEVM?
Examples of zkEVMs and their Working Principles
As we have already discussed, in the dynamic landscape of Ethereum scaling solutions, zkEVMs (Zero-Knowledge Ethereum Virtual Machines) have emerged as game-changers. We have learned about the different types of zkEVMs. Now, let’s analyze some of the best zkEVMs of today’s world and how exactly they work:
Polygon zkEVM
Polygon’s zkEVM is a Type 3 zk-Rollup that aims to maintain Ethereum Virtual Machine (EVM) equivalence. This means it’s designed to be highly compatible with existing Ethereum tools and clients while significantly boosting scalability.
- How it works: Polygon zkEVM preserves Ethereum opcode compatibility, ensuring seamless migration of decentralized applications (dApps) to its network. It achieves this by providing a secure and decentralized environment for smart contracts to operate efficiently.
zkSync Era
zkSync Era, developed by Matter Labs, takes a different approach. It’s a Type 4 zkEVM that prioritizes faster proof generation by introducing a custom virtual machine (VM). This VM optimizes cryptographic operations and enhances user experience.
- How it works: zkSync Era streamlines the process of generating zk proofs by using its custom VM. It supports native Ethereum cryptographic primitives and simplifies development with a Hardhat plugin. By doing so, it significantly improves the scalability of the Ethereum ecosystem.
Linea
Linea, backed by ConsenSys, follows a transitional path. It starts as a Type 3 zkEVM but has plans to evolve into a Type 2 zkEVM. Its focus is on maintaining Ethereum compatibility while increasing scalability.
- How it works: Linea executes native bytecode in line with the Ethereum VM specification, ensuring a high level of security. It aims to offer near-complete compatibility with Ethereum, making it a smooth transition for existing dApps.
Scroll zkEVM
Scroll is on a mission to achieve the pinnacle of zkEVMs, the Type 1. Currently at Type 3, it’s gradually enhancing its EVM-compatibility and decentralization. The end goal is to replicate Ethereum Layer 1 while delivering scalability.
- How it works: Scroll’s alpha testnet is open to the public, and it’s actively working towards becoming a Type 1 zkEVM. By replicating Ethereum exactly, it sets the stage for seamless migration of dApps and provides a secure and decentralized environment.
Taiko
Taiko takes a unique approach, emphasizing decentralization from the beginning. It aspires to become a Type 1 native zkEVM, prioritizing EVM-compatibility and security over faster proof generation.
- How it works: Taiko is decentralizing its sequencers and provers, ensuring maximum EVM-compatibility. While it might have slower proof generation, it places a strong emphasis on maintaining the integrity of the Ethereum ecosystem.
Hermez zkEVM
Hermez is a Type 3 zkEVM that concentrates on optimizing transaction throughput. It aims to achieve EVM-equivalence while enhancing performance for decentralized applications.
- How it works: Hermez employs efficient zk-SNARK technology to validate transactions and execute smart contracts. This approach significantly reduces transaction processing time and offers a promising solution for high-volume dApps.
Optimism
Optimism, often referred to as an Optimistic Rollup, is a Type 2 zkEVM. It is designed to offer EVM-compatibility while improving the efficiency of Ethereum transactions.
- How it works: Optimism operates by offloading transactions from the Ethereum mainnet to its Layer 2 solution. It utilizes an optimistic execution model, assuming that transactions are valid unless proven otherwise, which accelerates transaction processing and reduces gas fees.
ZkPorter
ZkPorter, a subcomponent of zkSync, is an innovative solution that combines the best of both worlds. It’s a Type 4 zkEVM focused on providing fast proof generation and enhanced security.
- How it works: ZkPorter integrates with zkSync to offer users a choice between high-security zkRollup accounts and zkPorter accounts with stable transaction fees. By utilizing data compression and zkPorter technology, it optimizes the balance between speed and security.
StarkWare Cairo
StarkWare introduces a different perspective with Cairo, which is a high-level language that can be compiled into ZK-SNARK-friendly code. While not a zkEVM per se, it influences the development of Type 4 zkEVMs.
- How it works: Developers can write smart contracts in high-level languages like Solidity and then compile them into Cairo, which is explicitly designed for ZK-SNARKs. This approach simplifies the generation of cryptographic proofs and enhances decentralization.
Also Read- How Does zkEVM Work?
Conclusion
From Type 1 to Type 4, the landscape of zkEVMs is as varied as it is promising, offering a rich tableau of options for developers and projects. Each type, with its unique set of pros and cons, presents a narrative of how the Ethereum ecosystem can morph, adapt, and thrive amidst the challenges.
As developers and projects align with different types of zkEVMs based on their distinct needs, a dynamic, efficient, and secure Blockchain landscape emerges. With the likes of Polygon zkEVM, zkSync Era, and others, we see these powerful engines in action, promising a future where we can expect a promising, hassle-free Blockchain world. And in this world, zkEVMs are set to play a crucial role in driving us towards a smoother, faster, and safer digital tomorrow.
FAQs
What is a Type 4 zkEVM?
- A Type 4 zkEVM compiles smart contract source code directly to a language designed for ZK-SNARKs.
- This approach leads to very fast prover times by bypassing the need to ZK-prove every EVM execution step.
- However, it can introduce incompatibility with certain applications.
Which type of zkEVM is most compatible with Ethereum?
- Type 1 zkEVMs are the most compatible with Ethereum.
- They aim for full Ethereum-equivalence and make no alterations to Ethereum’s core, retaining everything from hashes to state trees.
- This type offers perfect compatibility with Ethereum but can have lengthy prover times.
What is a Type 3 zkEVM?
- A Type 3 zkEVM is a category of zkEVM that makes compromises to improve prover times and make the Ethereum Virtual Machine (EVM) more developer-friendly.
- It may remove some features that are exceptionally hard to implement in a ZK-EVM, potentially requiring some applications to be rewritten.
- The advantage is faster prover times due to certain feature removals.
What is the benefit of zkEVM?
- The main benefit of zkEVMs is that they enhance the scalability, security, and efficiency of Blockchain networks, particularly the Ethereum Blockchain.
- They achieve this by offloading transactions from the Ethereum mainnet, using cryptographic proofs to validate transactions, and batching transactions for cost-effective processing.
- This helps in reducing congestion and improving the overall performance of Blockchain networks.
What is a zkEVM?
- A zkEVM, or Zero-Knowledge Ethereum Virtual Machine, is an innovative technology designed to enhance the scalability, security, and efficiency of the Ethereum Blockchain.
- It falls under the category of Layer 2 solutions that leverage Zero-Knowledge Proofs (zk-SNARKs) to validate and execute Ethereum transactions and smart contracts off the main Ethereum network.
- zkEVMs play a crucial role in improving the mainstream adoption and functionality of Blockchain networks by addressing the Blockchain trilemma – scalability, security, and decentralization.