On the eve of Cancun’s upgrade, taking a look at the world of zkEVM in Ethereum.

Previewing zkEVM in Ethereum ahead of Cancun's upgrade.

Author: RJ; Source: Author’s Twitter @0xRJ_eth

Introduction

The Cancun-Deneb Upgrade, a major upgrade of Ethereum expected to be implemented in the autumn and winter of 2023, aims to enhance the scalability, security, and usability of the Ethereum network while significantly reducing the gas fees of Layer 2 networks. If successfully implemented, it will directly benefit the Ethereum Layer 2 scaling (L2 Rollups) ecosystem and even potentially drive the explosion of the entire L2 track.

In the L2 scaling track, Zero-Knowledge Proof (ZK Rollups), which has excellent data compression performance, is considered the core solution for Ethereum in the medium to long term. In 2022, Ethereum founder Vitalik classified ZK Rollups into four different types based on their compatibility with the Ethereum Virtual Machine (EVM), establishing the foundation standards for the zkEVM type.

This article is deeply inspired by Vitalik’s pioneering classification standards mentioned above. After a year of development, significant progress has been made in this field. This article aims to provide track updates and a more detailed explanation (friendly to non-technical beginners) based on clear logic and concise language with Vitalik’s insights as the foundation.

What is EVM?

The Ethereum Virtual Machine (EVM) is the first Turing-complete blockchain virtual machine. It can be understood as the code execution environment on Ethereum, specifically used to execute smart contracts deployed on the Ethereum network. Through the EVM, smart contracts can achieve automated functionality on decentralized networks.

As the longest-tested blockchain virtual machine since its release in 2015, the EVM is undoubtedly a crucial infrastructure for Ethereum. Even when evaluating other blockchains, EVM compatibility has become an important consideration dimension, as it represents not only the smart contract execution environment and the available Ethereum toolset but also significant network effects and a mature and complex ecosystem.

However, when designing the EVM, it did not anticipate that ZK Rollup L2 would become the core solution for Ethereum scalability in the future. Therefore, the design of the EVM did not consider being ZK proof-friendly, making it very difficult to build a ZK proof-friendly EVM (zkEVM).

What is zkEVM?

Due to the high difficulty in achieving compatibility between Zero-Knowledge Proofs (ZKPs) and the Ethereum Virtual Machine (EVM), early ZK Rollups did not support the EVM. They generally lacked the ability to execute smart contracts (or supported special virtual machines), thus being limited to relatively simple specific scenarios such as token swaps and payments.

To address this problem, many organizations and researchers have focused on creating zkEVM (Zero Knowledge Ethereum Virtual Machine). As the name suggests, zkEVM generates zero-knowledge proofs for the execution of smart contracts in the EVM, including the process and results.

With the increase in determinism and technological progress of the ZK Rollup scaling solution, various zk scaling projects have pioneered different methods of combining EVM execution with zero-knowledge proof computation based on the trade-off between compatibility and performance (proving time).

Types of zkEVM:

Source: Vitalik’s blog “The different types of ZK-EVMs”

In 2022, Vitalik wrote about “different types of zkEVM” and roughly classified and compared the zk scaling projects on the market.

Next, let’s use simple language and clear logic to sort out the types, technical architectures, and advantages and disadvantages of zkEVM.

Type 1 zkEVM: Equivalent to Ethereum

Type 2 zkEVM: Fully compatible with EVM Ethereum Virtual Machine (there used to be Type 2.5, but it seems to have merged with Type 2)

Type 3 zkEVM: Almost compatible with EVM Ethereum Virtual Machine

Type 4 zkEVM: Compatible with high-level languages

Type 1 zkEVM – Equivalent to Ethereum

Architecture:

  • Equivalent to Ethereum without changing any part of the Ethereum system environment.

  • Does not replace hashes, state trie, transaction trie, precompiled contracts, and any other consensus logic.

  • The goal is to be fully compatible with existing applications, allowing developers to smoothly migrate their applications.

Advantages:

  • It is the most compatible solution among all types of ZK Rollup. Therefore, it is the most developer-friendly solution, allowing developers to deploy existing code on L2 without friction (no need for modification) because all consensus logic and system environment are equivalent to Ethereum.

  • It is highly consistent with Ethereum’s exploration of scaling direction because the exploration on Type 1 zkEVM can be smoothly introduced to Ethereum itself in the future, making Ethereum L1 more scalable.

  • It allows Rollup to smoothly migrate existing massive Ethereum infrastructure (e.g., Ethereum execution clients can be used to generate and process Rollup blocks in the original way, existing block explorers and block generators can also be smoothly deployed to L2).

  • It can verify Ethereum blocks just like the current Ethereum, or more precisely, verify the execution layer (including all transaction execution, smart contract, and account logic, but currently excluding beacon chain consensus logic).

  • As mentioned earlier, one of the great values of being equivalent to Ethereum is the ability to leverage Ethereum’s existing network effects and mature complex ecosystem.

Disadvantages:

  • Ethereum faces the same problems in integrating zero-knowledge proofs as Type 1 solutions (after all, it is equivalent to Ethereum, and Ethereum was not originally designed for zk functionality).

  • The biggest problem is the long time required to generate proofs. Currently, the main solutions in the industry are: cleverly engineering large-scale parallelization of proofs, or accelerating through hardware optimization.

Mainstream Projects:

  • Privacy and Scaling Explorations (PSE) team of Ethereum Foundation

  • Taiko: updated to Alpha-4 testnet in July this year, expected to launch the mainnet in early 2024. Taiko project prioritizes decentralization and compatibility from the beginning, and is currently the first and only ZK Rollup that implements decentralized proposer.

Type 2 zkEVM – Fully compatible with Ethereum Virtual Machine (EVM)

Architecture:

  • Strives for full compatibility with Ethereum Virtual Machine (EVM), but not equivalent to Ethereum.

  • Compared with Ethereum’s own runtime environment, this type of zkEVM makes some modifications to block structure, data structure of state tree, pricing logic of gas fee (repricing based on zk-friendliness), and data storage to generate zk verification proofs faster and cheaper.

  • The goal is to be compatible with the majority of existing applications, with only a few applications requiring some modifications.

Advantages:

  • By repricing gas fee (more zk-unfriendly op code is more expensive, and vice versa) and removing some Ethereum stack elements that are unfriendly to ZK, Type 2 zkEVM provides faster verification time than Type 1.

  • Type 2 can achieve compatibility with the majority of existing Ethereum applications, so most developers and users can hardly feel any friction.

  • Although it cannot directly use Ethereum execution clients without modification, it can still support existing EVM debugging tools and other development infrastructure through some debugging. Therefore, it can still leverage the thriving ecosystem of Ethereum to a great extent.

Disadvantages:

  • Although the impact of changing the execution environment is small, there are still potential development issues in the medium to long term. For example, replacing Ethereum’s commonly used hash (Keccak) with other zk-friendly hashes (such as Poseidon) may cause compatibility issues (inability to use or produce different results) for programs and applications that depend on Keccak hashes (involving historical data), such as cross-chain bridges (roughly speaking, cross-chain bridges are not real-time communication, usually when you perform an action on Chain A, such as burning something, you need to perform a corresponding action on Chain B, such as minting something… In essence, you need to prove the historical data of Chain A on Chain B, which involves using Keccak to prove historical data).

  • The change in gas fee pricing rules (originally intended to guide developers to reduce the use of zk-unfriendly op codes by repricing op codes based on zk-friendliness) will cause problems for contracts that have already optimized gas fees on Ethereum, and even gas fee optimization tools on Ethereum.

  • Although these modifications further improve the efficiency of verifiers compared to Type 1 zkEVM, proof generation time is still a relative disadvantage compared to Type 4 zkEVM.

Mainstream Projects:

  • Scroll: Pre-Alpha testnet launched in September 2022, Alpha testnet launched in February 2023, and the mainnet is expected to launch in August 2023. When the testnet is launched, it will belong to Type3 zkEVM, but it is gradually enhancing EVM compatibility and transitioning to Type2 zkEVM.

  • Polygon zkEVM (Polygon team’s ZK Rollup solution): The mainnet Beta version was launched in March 2023. When launched, it belongs to Type3 zkEVM, but it is currently transitioning to Type2 zkEVM.

Type3 zkEVM – Almost compatible with EVM

Architecture:

  • In his blog article in 2022, Vitalik referred to Type3 zkEVM as more of a transition (transitioning to Type2/1 by increasing compatibility or transitioning to Type4 by reducing compatibility and enhancing zk-friendliness).

  • Nearly compatible with the EVM. By further sacrificing compatibility, zkEVM becomes easier to develop and generates zk proofs faster.

  • More features that are difficult to implement in zkEVM (such as precompiled functions) have been removed.

  • There are greater differences in handling contract code, memory, and stack.

  • The goal is compatibility with most existing applications.

Advantages:

  • Compared to Type1 and Type2 zkEVM, this type is more zk-friendly and has shorter zk proof computation time.

  • It is compatible with more existing Ethereum applications compared to Type4 zkEVM.

Disadvantages:

  • Compared to Type1 and Type2 zkEVM, this type has higher incompatibility and sacrifices more elements (less friendly to Ethereum developers). This is why Type3 is more like a transition, and solutions in this type will likely transition to Type2 zkEVM by increasing compatibility.

  • Computation speed is slower compared to Type4 zkEVM.

Mainstream Projects:

  • Scroll: Pre-Alpha testnet launched in September 2022, Alpha testnet launched in February 2023, and the mainnet is expected to launch in August 2023. Scroll used to belong to this type a year ago, but it is currently transitioning to Type2 zkEVM by enhancing Ethereum compatibility.

  • Polygon zkEVM (Polygon team’s ZK Rollup solution): The mainnet Beta version was launched in March 2023. When launched, it belonged to Type3 zkEVM, but it is currently transitioning to Type2 zkEVM.

Type4 zkEVM – Compatible with high-level languages

Architecture:

  • This type actually belongs to zkVM (zero-knowledge proof virtual machine) instead of zkEVM.

  • It can be understood as compatibility at the programming language level. The general logic is: developers can continue to use the programming languages they are accustomed to on Ethereum (such as Solidity) to write smart contracts. Projects of this type will use compilers to convert these programming languages into their custom readable code (such as Starkware using the Warp compiler to convert Solidity code into Cairo bytecode; zkSync using the LLVM compiler to convert Solidity code into their custom virtual machine executable code LLVM-IR) for compilation and execution in their custom environment (such as Starknet’s Cairo VM and zkSync’s Sync VM).

  • The goal is low cost, high efficiency, and maximized zk-friendliness.

Advantages:

  • Very fast verification time.

  • Significant cost reduction (time, money, and computational workload) by compiling directly from high-level languages.

  • Reduces the technical threshold for becoming a validator and increases decentralization.

  • ZkEVMs of this kind can natively support account abstraction by using their custom virtual machine. Equivalent chains like EVM cannot natively support account abstraction and require the implementation of ERC-4337 on Ethereum.

Disadvantages:

  • A large number of existing Ethereum applications cannot be replicated in this type of zkVM or may encounter issues during the replication process. For example, contract addresses in Type 4 zkVM systems may differ from those in EVM. Type 4 zkEVM does not support handwritten EVM bytecode (while many applications currently use handwritten EVM bytecode to save gas fees). The compiler of this type of zkEVM also does not support certain features of Solidity.

  • Ethereum developers who want to deploy their applications on this type of project need to make more complex adjustments. Therefore, compared to the previous types of zkEVMs, this type of project is less developer-friendly, which may affect the development of the ecosystem and the speed of technical iteration.

  • It is extremely difficult to leverage the existing complex and prosperous ecosystem and network effects of Ethereum.

Mainstream Projects:

  • zkSync Era (ZK Rollup solution built by Matter Labs): zkSync Lite (zkSync 1.0) was launched in June 2020, mainly supporting simple payment and asset exchange scenarios, but does not support EVM-compatible smart contracts. zkSync Era (zkSync 2.0) was launched in March 2023, and compatibility at the high-level language level can be achieved through the aforementioned architecture. The goal of zkSync is not EVM compatibility but to improve the speed of zero-knowledge proof generation.

  • Starknet (ZK Rollup solution built by Starkware): The mainnet was launched in November 2021, and as of July this year, it has been updated to version v0.12.0. It belongs to Type4 zkEVM and its goal is not EVM compatibility. However, there are also projects on it, such as Kakarot, which aims to achieve compatibility similar to Type 2.5-3 zkEVM.

Based on Vitalik’s classification of different zkEVMs in 2022, combined with the progress of various projects (as of August 2023), we can summarize it simply in the following figure:

Classification of mainstream ZK Rollup projects

Mainstream zkEVM Projects

Comparison of mainstream ZK Rollup projects

In conclusion, Vitalik stated, “Personally, I hope that over time, with the improvement of zkEVM and Ethereum itself, Ethereum will become more friendly to ZK-SNARKs, and eventually everything will become Type 1.”

In such a future, we will have multiple implementations of zkEVM, which can be used for both ZK Rollup (zero-knowledge scalability) and for verifying the Ethereum chain itself. In theory, Ethereum does not need to adopt a single standardized zkEVM specification for Layer 1 (L1); different clients can choose different proof methods, allowing us to continue benefiting from redundancy at the code level.

However, achieving such a future will take a considerable amount of time. Meanwhile, we will also see a lot of innovation in terms of Ethereum (itself) scalability and Ethereum-based ZK Rollup.

It is worth emphasizing that although the mainstream classification of zkEVM on the market is the one proposed by Vitalik in 2022 (referenced in this article), there are also other classification standards. Regardless of the classification, these types of zkEVM do not have absolute pros and cons. They simply make trade-offs between compatibility and speed: Type 1 zkEVM has the highest compatibility with Ethereum but slower verification speed (in the ZK Rollup track); Type 4 zkEVM has lower compatibility with Ethereum but faster verification speed.

Of course, the compatibility and speed of zkEVM are not the only criteria developers should consider when choosing which ZK Rollup to deploy their applications on. There are many other factors that will affect their choice, such as:

Decentralization of L2 transaction ordering: whether the sequencer/proposer is decentralized, which directly affects the complexity of ecosystem participants and the security of the entire network;

Cost: which tokens are used for payment, the token economic model of a public chain;

Rules for generating proofs: incentive mechanisms for provers, hardware standards for accelerating proof generation;

Self-custody: whether there is a clear mechanism to ensure that user assets can be recovered on L1 when accidents occur on L2;

Data availability: complete data availability naturally incurs higher costs, whether lower-cost data availability models adopted by some ZK Rollups are acceptable.

However, since most general-purpose ZK Rollup projects are still in the testnet stage, these factors cannot be compared horizontally at this time.

Finally, the type of zkEVM project is not static. With the exploration of various solutions in zkEVM and even improvements to Ethereum itself, it is possible that all solutions will eventually achieve the effect of Type 1 zkEVM. By then, we will have multiple implementations of zkEVM that can be used for both ZK Rollups and verifying the Ethereum chain itself.

But before that, let us look forward to continuous innovation in expanding Ethereum and the different paths of ZK Rollup.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Raise $130 million! Encrypted exchange INX will issue securities tokens via IPO

According to Coindesk's August 20 report, the incremental exchange startup INX Limited plans to raise $129.5 mil...

Blockchain

I left the project side and went to the exchange.

In the first article of "Industry Reflection", we briefly reviewed the secondary market conditions of the f...

Blockchain

What are the chances of decentralized exchanges completely replacing Binance and Coinbase?

This article will compare three common centralized trading features and contrast them with their decentralized coun...

Blockchain

Fake foreign exchange platform to enter the currency circle: reverse shouting, tampering with data, investors become the biggest victims

After the spread of money and funds, there has been a new routine in the currency circle – a false exchange. Pu...

Opinion

Wall Street Journal Binance Empire on the Verge of Collapse

After the collapse of FTX, the largest cryptocurrency exchange in the world seems to be Binance. However, less than a...

Blockchain

Where is the decentralized Chuhe Han Realm? Which is the trend?

❖Centralized Exchanges ❖ The reason for the closure of Fcoin is that the trading platform cannot be res...