A look at the Ethereum zkEVM on the eve of the Cancun upgrade

Author: RJ; Source: Author Twitter @0xRJ_eth

Introduction

The major upgrade of Ethereum, the Cancun-Deneb Upgrade, is expected to be implemented in the autumn and winter of 2023. The core goal is to enhance the scalability, security, and availability of the Ethereum network, while greatly reducing the gas of the second-layer network. fee. Therefore, if it is successfully implemented, it will directly benefit the L2 Rollups ecology of Ethereum, and it is even expected to drive the outbreak of the entire L2 track.

In the L2 expansion track, the zero-knowledge proof expansion scheme (ZK Rollups) with excellent data compression performance has been considered as the medium and long-term core scheme of Ethereum. In 2022, Vitalik, the founder of Ethereum, divided ZK Rollups into 4 different types according to their compatibility with the EVM (Ethereum Virtual Machine) Ethereum virtual machine, and established the basic standard for the zkEVM type.

This post was heavily inspired by Vitalik's seminal taxonomy mentioned above. After a year of development, the field has made significant progress. This article aims to provide track updates and more detailed interpretations (friendly to novices) with clear logic and concise language, based on Vitalik's insights.

What is EVM?

EVM (Ethereum Virtual Machine) is the first Turing-complete blockchain virtual machine. It can be understood as the code runtime environment on Ethereum, which is specially used to execute smart contracts deployed on the Ethereum network. Through EVM, smart contracts can realize automated functions on a decentralized network.

As the most proven blockchain virtual machine released in 2015, EVM is definitely a very important infrastructure for Ethereum. Even when judging other blockchains, EVM compatibility is already an important dimension of consideration, because EVM compatibility represents not only the smart contract execution environment, the available Ethereum toolset, but also the huge network effect And mature and complex ecology.

However, at the beginning of the design of EVM, it was not imagined that ZK Rollup L2 would become the core solution of Ethereum expansion one day, so the design of EVM did not consider being friendly to zero-knowledge proofs. This makes it very difficult to build a zero-knowledge proof-friendly EVM (zkEVM).

What is zkEVM?

Because of the difficulty in compatibility between Zero Knowledge Proof and Ethereum Virtual Machine (EVM), the early ZK Rollup did not support EVM. They generally lack the ability to execute smart contracts (or support special virtual machines), so they are limited to relatively simple specific scenarios: such as token exchange (swap) and payment (payment).

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 EVM.

With the increase in the certainty of the ZK Rollup expansion scheme and the advancement of technology, various zk expansion projects have created different futures based on the trade-offs between Compatibility and Performance (Proving Time for generating zero-knowledge proofs). EVM execution combined with zero-knowledge proof computation.

Different types of zkEVM:

Source: Vitalik blog "The different types of ZK-EVMs"

In 2022, Vitalik published an article explaining "different types of zkEVM", and roughly classified and compared zk expansion projects on the market.

Next, let us use plain language and clear logic to sort out the types, technical architecture, and respective advantages and disadvantages of zkEVM.

Type1 class zkEVM: completely equivalent to Ethereum

Type2 class zkEVM: fully compatible with EVM Ethereum virtual machine (there used to be Type2.5 class, but now it seems that it is basically integrated with Type2 class)

Type3 class zkEVM: Almost compatible with EVM Ethereum virtual machine

Type4 class zkEVM: Compatible with high-level languages

Type1 class zkEVM - fully equivalent to Ethereum

Architecture:

  • Fully equivalent to Ethereum without changing any part of the Ethereum system environment.
  • There is no need to replace Hashes, State Trie, Transactions Trie, Precompiles, and any other consensus logic.
  • Its goal is to be fully compatible with existing applications, and developers can copy applications in the past silky-smoothly.

advantage:

  • is the most compatible scheme among all types of ZK Rollup. Therefore, it is also the most friendly solution for developers - allowing developers to deploy existing codes to L2 with zero friction (without modification), because all consensus logic and system environment are completely equivalent to Ethereum.
  • It is highly consistent with the exploration and expansion direction of Ethereum itself, because the exploration on Type1 zkEVM can be introduced into Ethereum itself without friction in the future, thus making Ethereum L1 itself more scalable.
  • It allows Rollup to frictionlessly copy the existing massive Ethereum infrastructure (eg: Ethereum execution client can be used to generate and process Rollup blocks, existing block explorers and block generation in the original way and other tools can also be deployed to L2 silky-smoothly).
  • Ability to validate Ethereum blocks as Ethereum does today, or more precisely the execution layer side (including all transaction execution, smart contracts, and account logic, but not the Beacon Chain consensus logic for now).
  • As mentioned earlier, a major value of being completely equivalent to Ethereum is that it can take advantage of Ethereum's existing huge network effect and mature and complex ecology.

shortcoming:

  • The problems faced by Ethereum in integrating zero-knowledge proofs are also faced by Type1 schemes (after all, it is equivalent to Ethereum, and Ethereum was not originally designed for the zk function).
  • The biggest problem is the time it takes to generate proofs. To solve this problem, the main solutions in the industry at present are: to prove through ingenious large-scale parallelization of engineering, or to accelerate through hardware optimization.

Mainstream projects:

  • Ethereum Foundation PSE (Privacy and Scaling Explorations privacy and expansion) team
  • Taiko: It has been updated to the Alpha-4 test network in July this year, and it is expected to launch the main network in early 2024. The Taiko project has prioritized decentralization and compatibility from the very beginning, and is currently the first and only ZK Rollup to implement a decentralized proposer.

Type2 zkEVM - fully compatible with EVM Ethereum virtual machine

Architecture:

  • Strive to be fully compatible with EVM Ethereum Virtual Machine, but not equivalent to Ethereum.
  • Compared with the operating environment of Ethereum itself, this type of zkEVM mainly makes some modifications to the block structure, the data structure of the state tree, the pricing logic of gas fee (re-pricing according to zk friendliness) and data storage, so that zk-verified proofs are faster and cheaper to generate.
  • The goal is to be as compatible as possible with the vast majority of existing applications, with a few requiring some modification.

advantage:

  • By re-pricing the gas fee (the more ZK-unfriendly op code is more expensive, and vice versa), and deleting part of the ZK-unfriendly Ethereum stack, it provides faster verification time than Type1.
  • Type2 can be compatible with most of the existing Ethereum applications, so most developers and users basically feel no friction.
  • Although it is impossible to directly use Ethereum to execute the client with zero modification, it can still support existing EVM debugging tools and other development infrastructure through some debugging. Therefore, it can still leverage on the existing prosperous ecology of Ethereum to a large extent.

shortcoming:

  • The impact of changing the execution environment is small, but there are still potential development problems in the medium and long term. For example, replacing the commonly used Ethereum hash (Keccak) with other zk-friendly hash values (such as Poseidon) may cause those applications that rely on Keccak hash values (involving historical data) (such as: cross-chain bridges) .General principle: cross-chain bridge is not real-time communication, usually you do a behavior in A chain - such as what has been burned; you want to do a corresponding behavior in B chain - what to forge... The essence is that you are in B chain It is necessary to prove the historical data of the A chain, so it will involve the use of Keccak to prove the historical data) After migrating to Type2 type projects, there will be incompatibility problems (unable to use, or run out of different results).
  • Changes to the gas fee pricing rules (the original intention is to "guide" developers to reduce the use of zk-unfriendly op codes by re-pricing op codes based on zk-friendliness), for gas fees that have already been carried out on Ethereum Optimized contracts and even gas fee optimization tools on Ethereum can cause problems.
  • Although these modifications have further improved the efficiency of the prover compared with the Type1 zkEVM, the proof time is still a relative disadvantage compared with the Type4 zkEVM.

Mainstream projects:

  • Scroll: The Pre-Alpha test network will be launched in September 2022, the Alpha test network will be launched in February 2023, and the main network is expected to be launched in August 2023. When the testnet was launched, it belonged to Type3 zkEVM, but it is gradually enhancing EVM compatibility and transitioning to Type2 zkEVM.
  • Polygon zkEVM (Polygon team's ZK Rollup solution): In March 2023, the Beta version of the main network will be launched. It belongs to Type3 zkEVM when it goes online, but it is currently transitioning to Type2 zkEVM.

Type3 zkEVM - almost compatible with EVM Ethereum virtual machine

Architecture:

  • Vitalik stated in his 2022 blog article that Type3 zkEVM is more like a transition (transition to Type2/1 by increasing compatibility; or transition to Type4 by reducing compatibility and improving zk friendliness).
  • Nearly compatible with EVM Ethereum Virtual Machine. By further sacrificing compatibility, its zkEVM is easier to develop and zk proofs are generated faster.
  • Deleted more functions that were difficult to implement in zkEVM (such as precompilation functions).
  • There are bigger differences in dealing with contract code, memory or stack.
  • Aim to be compatible with most existing applications.

advantage:

  • Compared with Type1 and Type2 zkEVM, this type is more zk-friendly, and the calculation time of zk proof is shorter.
  • There are more existing Ethereum applications compatible with zkEVM than Type4.

shortcoming:

  • Compared with Type1 and Type2 zkEVM, this type has higher incompatibility and sacrifice of more elements (more unfriendly to Ethereum developers). This is why the Type3 class is more like a transition. There is a high probability that a solution in this category will transition to the Type2 class zkEVM by improving compatibility.
  • Compared to Type4 class zkEVM proves to be slower.

Mainstream projects:

  • Scroll: The Pre-Alpha test network will be launched in September 2022, the Alpha test network will be launched in February 2023, and the main network is expected to be launched in August 2023. Scroll belonged to this type a year ago, but now it is developing towards Type2 zkEVM by improving the compatibility of Ethereum.
  • Polygon zkEVM (Polygon team's ZK Rollup solution): The mainnet Beta version will be launched in March 2023. It belongs to Type3 zkEVM when it goes online, but it is currently transitioning to Type2 zkEVM.

Type4 zkEVM-compatible high-level language

Architecture:

  • This class actually belongs to zkVM (Zero-Knowledge Proof Virtual Machine, not Zero-Knowledge Proof Ethereum Virtual Machine).
  • Can be understood as compatibility at the programming language level. The general logic is: developers can continue to write smart contracts in the programming language they are accustomed to using on Ethereum (such as Solidity). This type of project will use a compiler to convert this programming language into their custom readable code (for example, Starkware uses the Warp compiler to convert Solidity code to Cairo bytecode; zkSync uses the LLVM compiler to convert Solidity code to its custom LLVM-IR) compiled and executed in their custom environments (such as Starknet's Cairo VM and zkSync's Sync VM).
  • The goal is low cost, high efficiency, and maximum zero-knowledge proof friendliness.

advantage:

  • Very fast verification time.
  • Compiling directly from a high-level language can greatly reduce costs (time, money, and computational effort).
  • Lower the technical threshold for becoming a certifier and increase the degree of decentralization.
  • This type of zkEVM can natively support Account Abstraction by using its custom virtual machine. Because the EVM equivalent chain cannot natively support account abstraction, it needs to be implemented through Ethereum's ERC-4337.

shortcoming:

  • A large number of existing Ethereum applications cannot be copied into this type of zkVM, or there will be problems during the copying process: for example, the address of the contract in the Type 4 type zkVM system may be different from the address in the EVM; Type 4 type zkEVM Does not support handwritten EVM bytecode (and many applications currently use handwritten EVM bytecode to save gas fees); (it was mentioned earlier that this type is compatible with the Solidity code language level through the compiler) its compiler does Some features of Solidity are not supported.
  • Ethereum developers need to make more complex adjustments if they want to deploy their applications to such projects. Therefore, compared with the previous types of zkEVM, the developer friendliness of this type of project is relatively low, which may affect the development of ecology and the iteration speed of technology.
  • It is extremely difficult to take advantage of Ethereum's existing complex and prosperous ecology and network effects.

Mainstream projects:

  • zkSync Era (the ZK Rollup solution built by the Matter Labs team): zkSync Lite (zkSync 1.0) will be launched in June 2020. It mainly supports simple payment (payment) and asset exchange (swap) scenarios, and does not support EVM Compatible smart contracts; zkSync Era (zkSync 2.0) will be launched in March 2023. Compatibility at the high-level language level can be achieved through the above architecture. The goal of zkSync is not EVM compatibility, but to increase the speed of zero-knowledge proof generation.
  • Starknet (ZK Rollup solution built by the Starkware team): The mainnet will be launched in November 2021, and it has been updated to v0.12.0 in July this year. It itself belongs to Type4 zkEVM, and the target is not EVM compatible. But there are currently projects like Kakarot on it, aiming to make Starknet reach a level of compatibility similar to Type 2.5-3 zkEVM).

Based on Vitalik's classification of different zkEVMs in 2022, combined with the progress of each project (as of August 2023), we can briefly summarize with the following figure:

Classification of mainstream ZK Rollup projects

All kinds of zkEVM mainstream projects

Comparison Chart of Mainstream ZK Rollup Projects

Vitalik concluded at the end of his article: "Personally, I hope that over time, through the improvement of zkEVM combined with the improvement of Ethereum itself, it will make (Ethereum) more friendly to ZK-SNARK, and eventually everything Both will be Type1 classes.

In such a future, we will have multiple zkEVM implementations that can be used both for ZK Rollup (zero-knowledge scaling) and for validating the Ethereum chain itself. In theory, there is no need for Ethereum to have a single, standardized zkEVM specification for L1 (first layer) use; different clients can choose to use different proofs, so we can continue to benefit from code-level redundancy .

However, it will take quite some time before such a future can be realized. At the same time, we will also see a lot of innovation in the expansion of Ethereum (itself) and the different paths of ZK Rollup based on Ethereum. "

At the same time, it should be emphasized that although the mainstream zkEVM classification method on the market is the classification launched by Vitalik in 2022 (cited in this article), there are also other classification standards. And no matter how they are classified, there is no absolute distinction between these zkEVM types. They are just a trade-off between compatibility and speed: Type1 zkEVM has the highest compatibility with Ethereum, but proves to be slower (in the ZK Rollup track); Type4 zkEVM is less compatible with Ethereum, But verification is faster.

Of course, the compatibility and speed of zkEVM are not actually the only indicators for developers to consider which ZK Rollup should be used to deploy applications. There are many other factors that can influence their choice, such as:

Decentralization of L2 transaction ordering: Whether the sequencer/proposer is decentralized or not, this directly affects the complexity of ecological participants and the security of the entire network;

Fees: Which tokens are used to pay fees, and what is the token economic model of a public chain;

Rules for Proof Generation: Incentive mechanism for prover, hardware standard for accelerating proof generation;

Self-hosting: Is there a clear mechanism to ensure that user assets can still be recovered in L1 when an accident occurs in L2;

Data Availability: The cost of complete data availability is naturally higher. Is it acceptable to accept the lower-cost data availability mode adopted by some ZK Rollups.

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

Finally, the type of any zkEVM project is not static. With the exploration of various schemes in zkEVM, and even the improvement of Ethereum itself, it is possible that all schemes can eventually achieve the effect of Type 1 zkEVM. At that point we will have multiple zkEVM implementations - both for ZK Rollups and for validating the Ethereum chain itself.

Until then, let’s look forward to seeing continued innovation on different paths to scaling Ethereum and ZK Rollup.

View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Repost
  • Share
Comment
0/400
No comments
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate App
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)