2023 On the eve of the L2 explosion, an analysis of various zkEVMs

2023 Analysis of various zkEVMs on the eve of the L2 explosion

Let’s look forward to continuous innovation in expanding Ethereum and ZK Rollup on different paths.

Original author: 0xRJ.eth

Introduction

The Cancun-Deneb Upgrade, a major upgrade to Ethereum expected to be implemented in the fall and winter of 2023, aims to enhance the scalability, security, and usability of the Ethereum network while greatly reducing gas fees on layer-two networks. Therefore, if successfully implemented, it will directly benefit the Ethereum layer-two scaling (L2 Rollups) ecosystem and may even drive the explosion of the entire L2 track.

In the L2 scaling track, zero-knowledge proof scaling solutions (ZK Rollups) with excellent data compression performance have been regarded as the core solution for Ethereum in the medium to long term. In 2022, Ethereum founder Vitalik classified them into four different types based on the compatibility between various ZK Rollups and the Ethereum Virtual Machine (EVM), establishing the basic standards for zkEVM.

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

What is EVM?

EVM (Ethereum Virtual Machine) 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 automate functions on a decentralized network.

As the longest-tested blockchain virtual machine released in 2015, the EVM is definitely an important infrastructure for Ethereum. Even when evaluating other blockchains, whether they are EVM-compatible or not is an important consideration, as EVM compatibility represents not only a smart contract execution environment and a usable set of Ethereum tools but also significant network effects and a mature and complex ecosystem.

However, when EVM was designed, it did not anticipate that ZK Rollup L2 would become the core solution for Ethereum scalability in the future, so the design of the EVM did not take into account being friendly to zero-knowledge proofs. This has made it extremely difficult to build a zero-knowledge proof-friendly EVM (zkEVM).

What is zkEVM?

Because of the difficulty in achieving compatibility between zero-knowledge proofs 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), and were therefore limited to relatively simple specific scenarios, such as token swaps and payments.

In order to solve this problem, many organizations and researchers focus on creating zkEVM (Zero Knowledge Ethereum Virtual Machine), which, as the name suggests, generates zero-knowledge proofs for the execution (process and result) of smart contracts in the EVM.

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

Different types of zkEVM:

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

In 2022, Vitalik explained the “different types of zkEVM” and classified and compared the zk scalability projects on the market.

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

Type 1 zkEVM: Fully equivalent to Ethereum

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

Type 3 zkEVM: Almost compatible with EVM Ethereum Virtual Machine

Type 4 zkEVM: Compatible with higher-level languages

Type 1 zkEVM – Fully equivalent to Ethereum

Architecture:

– Identical to Ethereum and does not require any changes to any part of the Ethereum system environment.

– No need to replace hashes, state trie, transaction trie, precompiled contracts, and any other consensus logic.

– Its 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 Rollups. Therefore, it is the most developer-friendly solution – allowing developers to deploy existing code to L2 smoothly without modification, because all consensus logic and system environment are identical to Ethereum.

– It is highly consistent with Ethereum’s exploration of scalability 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 Rollups to smoothly migrate existing massive Ethereum infrastructure (for example: Ethereum execution clients can be used to generate and process Rollup blocks in the original way, and existing block explorers and block generators can also be deployed smoothly to L2).

· It is able to verify Ethereum blocks, similar to the current Ethereum, or more precisely, verifying the execution layer (including all transaction execution, smart contracts, and account logic, but currently excluding the beacon chain consensus logic).

· As mentioned earlier, one of the great values of a fully equivalent Ethereum is that it can leverage the huge network effects and mature complex ecosystem of Ethereum.

Disadvantages:

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

· The biggest problem is the time required to generate proofs. The main solutions currently in the industry are: clever engineering for massively parallelizing proofs or hardware optimization for acceleration.

Mainstream projects:

· Ethereum Foundation PSE (Privacy and Scaling Explorations) team

· Taiko: It has been updated to the Alpha-4 testnet in July this year and is expected to go live on the mainnet in early 2024. Taiko project prioritizes decentralization and compatibility from the beginning and is currently the only ZK Rollup that implements decentralized proposers.

Type2 zkEVM – Fully compatible with EVM Ethereum Virtual Machine

Architecture:

· Striving to be fully compatible with the EVM Ethereum Virtual Machine, but not equivalent to Ethereum.

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

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

Advantages:

· By repricing gas fees (more zk-unfriendly op codes are more expensive, and vice versa) and removing some Ethereum stacks that are unfriendly to ZK, it provides faster verification time than Type1.

· Type2 can achieve compatibility with the majority of existing Ethereum applications, so most developers and users will not feel much 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 and long term. For example, replacing Ethereum’s commonly used hash function (Keccak) with other zk-friendly hash functions (such as Poseidon) may cause compatibility issues (unable to use or produce different results) for programs and applications that rely 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) after migrating to Type2 projects.

· Changes to the pricing rules for gas fees (the intention is to price op codes based on their zk-friendliness, in order to “guide” developers to reduce the use of zk-unfriendly op codes), which will cause problems for contracts and gas fee optimization tools that have already been optimized for gas fees on Ethereum.

· Although these modifications further improve the efficiency of provers compared to Type1 zkEVM, proof time is still a relative drawback compared to Type4 zkEVM.

Mainstream Projects:

· Scroll: Pre-Alpha testnet launched in September 2022, Alpha testnet scheduled for February 2023, and mainnet scheduled for August 2023. The testnet is of Type3 zkEVM, but it is gradually enhancing EVM compatibility and transitioning to Type2 zkEVM.

· Polygon zkEVM (Polygon team’s ZK Rollup solution): Beta version of the mainnet launched in March 2023. The launch is of Type3 zkEVM, but it is currently transitioning to Type2 zkEVM.

Type3 zkEVM – Almost EVM-compatible Ethereum Virtual Machine

Architecture:

· Vitalik referred to Type3 zkEVM as more of a transition in his 2022 blog post (transitioning to Type2/1 by increasing compatibility; or transitioning to Type4 by reducing compatibility and increasing zk-friendliness).

· Almost compatible with the EVM Ethereum Virtual Machine. By sacrificing further in terms of compatibility, it makes zkEVM easier to develop and zk proof generation 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 in zkEVM.

· The goal is to be compatible with most existing applications.

Advantages:

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

· It can be 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 developer-friendly for Ethereum developers). This is also why Type3 is more like a transition, and solutions in this type will probably transition to Type2 zkEVM by increasing compatibility.

· Proof time is slower compared to Type4 zkEVM.

Mainstream Projects:

· Scroll: Pre-Alpha testnet launched in September 2022, Alpha testnet scheduled for February 2023, and mainnet scheduled for August 2023. Scroll was of this type a year ago, but it is currently developing towards Type2 zkEVM by increasing Ethereum compatibility.

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

Type 4 zkEVM – Compatible with High-Level Languages

Architecture:

· This class actually belongs to zkVM (Zero-Knowledge Proof Virtual Machine) rather than zkEVM (Zero-Knowledge Proof Ethereum Virtual Machine).

· It can be understood as compatibility at the programming language level. The general logic is: developers can continue to use the programming language (such as Solidity) they are accustomed to using on Ethereum to write smart contracts. Projects of this type will use compilers to convert this programming language 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 execute it in their custom environment (such as Starknet’s Cairo VM and zkSync’s Sync VM).

· The goal is low cost, high efficiency, and maximum zero-knowledge proof friendliness.

Advantages:

· Very fast verification time.

· Direct compilation from a high-level language can greatly reduce costs (time, money, and computational workload).

· Reduces the technical threshold for becoming a prover and increases decentralization.

· This type of zkEVM can natively support account abstraction by using its custom virtual machine. Because EVM-equivalent chains cannot natively support account abstraction, it needs to be implemented through Ethereum’s ERC-4337.

Disadvantages:

· A large number of existing Ethereum applications cannot be replicated in this type of zkVM, or problems may occur during the replication process: for example, the addresses of contracts in Type 4 zkVM may be different 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); (previously mentioned that this type achieves compatibility at the Solidity code language level through compilers) its compiler does not support some features of Solidity.

· Ethereum developers who want to deploy applications on projects of this type need to make more complex adjustments. Therefore, compared to the previous types of zkEVM, the developer friendliness of projects of this type is relatively low, which may affect the development of the ecosystem and the speed of technological 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 team): zkSync Lite (zkSync 1.0) was launched in June 2020, mainly supporting simple payment and asset exchange scenarios, and does not support EVM-compatible smart contracts; zkSync Era (zkSync 2.0) was launched in March 2023, which can achieve compatibility at the high-level language level through the above-mentioned architecture. The goal of zkSync is not EVM compatibility, but to improve zero-knowledge proof generation speed.

· Starknet (ZK Rollup solution built by Starkware team): The mainnet was launched in November 2021, and has been updated to version v0.12.0 in July this year. It belongs to Type 4 zkEVM itself, and the goal is not EVM compatibility. However, currently, there are projects like Kakarot on it, aiming to make Starknet achieve a compatibility level similar to Type 2.5-3 zkEVM.

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

(Classification of mainstream ZK Rollup projects)

Mainstream zkEVM Projects

(Comparison chart of mainstream ZK Rollup projects)

In his conclusion, Vitalik stated: “Personally, I hope that over time, through the improvement of zkEVM and Ethereum itself, it will become more friendly to ZK-SNARK, and ultimately everything will become Type1.”

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

However, it will take a considerable amount of time to achieve this future. At the same time, we will also see a lot of innovation in the different paths of Ethereum (itself) scalability and Ethereum-based ZK Rollup.”

It should be emphasized that although the mainstream classification of zkEVM on the market is the classification introduced by Vitalik in 2022 (quoted in this article), there are also other classification standards. Regardless of the classification, these zkEVM types do not have an absolute advantage or disadvantage. They only make trade-offs between compatibility and speed: Type1 zkEVM has the highest compatibility with Ethereum, but the proof speed is slower (belongs to the ZK Rollup track); Type4 zkEVM has lower compatibility with Ethereum, but faster verification speed.

Of course, the compatibility and speed of zkEVM are not the only criteria that developers should consider when deploying applications based on which ZK Rollup. 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;

· Fees: which tokens are used to pay fees, and 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 still be recovered on L1 when accidents occur on L2;

· Data availability: the cost of complete data availability is naturally higher, whether it is acceptable to adopt a lower-cost data availability model used by some ZK Rollups.

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

Finally, the type to which any zkEVM project belongs is not static and unchanging. With the exploration of various solutions in zkEVM and even the improvement of Ethereum itself, it is possible that all solutions will eventually achieve the same effect as Type 1 zkEVM. At that time, we will have multiple zkEVM implementations that can be used for both ZK Rollups and verifying the Ethereum chain itself.

Before that, let us look forward to the continuous innovation on different paths for scaling Ethereum and 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

South Korea officially legalizes cryptocurrency transactions, Bitcoin stands at $ 9,000

The entire session of the National Assembly of South Korea passed an amendment to the "Reporting and Utilization...

Policy

The Crypto Circus: A Bug’s Billion-Dollar Bonanza

During the 10th day of Sam Bankman-Fried's trial, talks focused on a software glitch and the allocation of funds for ...

Blockchain

Bitfinex abolishes the minimum balance threshold of $10,000

Bitfinex, a Hong Kong-based cryptocurrency exchange, is now open to all traders as they canceled a minimum entry thre...

Blockchain

Beginner's Guide | Why choose a highly liquid exchange?

Source: Medium Translation: First Class (First.VIP) Liquidity is the most important concept that everyone needs to un...

Blockchain

report! This 14,000-person hacker organization is eyeing the exchange | DVP hackers are coming to an end

According to Baihuhui, in 2018, the economic loss caused by security problems in the digital currency industry was 2....

Blockchain

Is the 'big boss' of the cryptocurrency world, Binance, starting to decline?

LianGuaiBitpushNews Mary Liu As 2022 comes to a close, it seems that Zhao Changpeng, co-founder and CEO of Binance, ...