Author: 0xRJ.eth
Introduction
The major Ethereum upgrade expected to be implemented in the fall and winter of 2023—the Cancun-Deneb Upgrade—aims to enhance the scalability, security, and usability of the Ethereum network, while significantly reducing the gas fees for layer 2 networks. Therefore, if successfully implemented, it will directly benefit the Ethereum layer 2 scaling (L2 Rollups) ecosystem and even have the potential to 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 recognized as the core long-term solution for Ethereum. Ethereum founder Vitalik, in 2022, categorized them into 4 different types based on the compatibility of various ZK Rollups with the Ethereum Virtual Machine (EVM), establishing the foundational standards for zkEVM type.
This article is deeply inspired by the groundbreaking classification standards of Vitalik. After a year of development, this field has made significant progress. The purpose of this article is to provide track updates and a more detailed interpretation (friendly to technical novices) based on clear logic and concise language, using 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 EVM, smart contracts can achieve automated functionality on a decentralized network.
As the longest-tested blockchain virtual machine released in 2015, EVM is an extremely important infrastructure for Ethereum. When evaluating other blockchains, whether they are EVM-compatible or not has become an important consideration, as EVM compatibility represents not only the smart contract execution environment and the available Ethereum toolset, but also the enormous network effect and mature complex ecosystem.
However, when EVM was designed, it did not anticipate that ZK Rollup L2 would become the core solution for Ethereum scaling in the future, so EVM's design did not consider being friendly to zero-knowledge proofs. This makes building a zero-knowledge proof-friendly EVM (zkEVM) very difficult.
What is zkEVM?
Due to the high difficulty in making zero-knowledge proofs (ZKPs) and the Ethereum Virtual Machine (EVM) compatible, early ZK Rollups did not support EVM. They generally lacked the ability to execute smart contracts (or supported a special virtual machine), thus being limited to relatively simple specific scenarios, such as token exchange (swap) and payments.
To solve this problem, many organizations and researchers focused on creating zkEVM (Zero Knowledge Ethereum Virtual Machine), which, as the name suggests, generates zero-knowledge proofs for the execution of smart contracts in the EVM (process and results).
With the increasing determinism of ZK Rollup scaling solutions and technological advancements, various zk scaling 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 elaborated on "different types of zkEVM" in an article and roughly categorized and compared zk scaling projects in the market.
Next, let's use simple language and clear logic to sort out the types, technical architecture, and the respective advantages and disadvantages of zkEVM.
Type1 zkEVM: Fully equivalent to Ethereum
Type2 zkEVM: Fully compatible with EVM (formerly there was Type2.5, but it now seems to have merged with Type2)
Type3 zkEVM: Almost compatible with EVM
Type4 zkEVM: Compatible with high-level languages
Type1 zkEVM—Fully Equivalent to Ethereum
Architecture:
It is completely identical to Ethereum and does not require any changes to any part of the Ethereum system environment.
There is no need to replace hashes, state trie, transaction trie, precompiled contracts, and any other in-consensus logic.
Its goal is to be fully compatible with existing applications, allowing developers to smoothly deploy existing applications to run on L2 without modification.
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 without friction, as all consensus logic and system environment are completely identical to Ethereum.
It is highly consistent with Ethereum's exploration of scaling directions, as the exploration on Type1 zkEVM can be seamlessly introduced into Ethereum itself in the future, making Ethereum L1 itself more scalable.
It allows Rollups to smoothly adopt existing massive Ethereum infrastructure (e.g., Ethereum execution clients can be used in the original way to generate and process Rollup blocks, and existing block explorers and block generation tools can also be smoothly deployed to L2).
It can verify Ethereum blocks just like Ethereum itself, 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, the great value of being fully equivalent to Ethereum is the ability to leverage the enormous network effect and mature complex ecosystem of Ethereum.
Disadvantages:
The biggest problem is the long time required to generate proofs. The main solutions in the industry currently focus on clever engineering for large-scale parallelization of proofs or hardware optimization to speed up the process.
Mainstream Projects:
Ethereum Foundation's PSE (Privacy and Scaling Explorations) team
Taiko: It has been updated to the Alpha-4 testnet in July this year and is expected to launch the mainnet in early 2024. Taiko prioritized decentralization and compatibility from the beginning and is currently the first and only ZK Rollup project to achieve decentralized proposers.
Type2 zkEVM—Fully Compatible with EVM
Architecture:
It aims to be fully compatible with the EVM but not equivalent to Ethereum.
Compared to Ethereum's own operating environment, this type of zkEVM mainly makes some modifications to the block structure, data structure of the state trie, gas fee pricing logic (repricing based on zk-friendliness), and data storage to generate proofs faster and cheaper.
Its goal is to be compatible with the vast majority of existing applications, with only a few applications requiring some modifications.
Advantages:
By repricing gas fees (more zk-unfriendly opcodes are more expensive, and vice versa) and removing some Ethereum stack elements that are unfriendly to ZK, it provides faster verification time than Type1.
Type2 can be compatible with the vast majority of existing Ethereum applications, so most developers and users will not feel much friction.
While 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 largely leverage the thriving ecosystem of Ethereum.
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 hash values (e.g., Poseidon) may cause compatibility issues for programs and applications that depend on Keccak hash values (involving historical data) when migrating to Type2 projects.
Changes to gas fee pricing rules (originally intended to guide developers to reduce the use of zk-unfriendly opcodes by repricing opcodes based on zk-friendliness) will cause problems for contracts that have already been optimized for gas fees on Ethereum, and even for gas fee optimization tools on Ethereum.
Although these modifications further improve the efficiency of verifiers compared to Type1 zkEVM, proving time is still a relative disadvantage compared to Type4 zkEVM.
Mainstream Projects:
Scroll: Launched the Pre-Alpha testnet in September 2022, the Alpha testnet in February 2023, and is expected to launch the mainnet 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): Launched the mainnet Beta version in March 2023. It belonged to Type3 zkEVM at launch, but is currently transitioning to Type2 zkEVM.
Type3 zkEVM—Almost Compatible with EVM
Architecture:
In his 2022 blog post, Vitalik referred to Type3 zkEVM as more of a transition (transitioning to Type2/1 by increasing compatibility or to Type4 by reducing compatibility and increasing zk-friendliness).
Almost compatible with the EVM. By further sacrificing compatibility, zkEVM becomes more developer-friendly and generates proofs faster.
More functions that are difficult to implement in zkEVM (such as precompiles functionality) have been removed.
There are greater differences in handling contract code, memory, or stack.
The goal is to be compatible with most existing applications.
Advantages:
Shorter proof generation time and more zk-friendly compared to Type1 and Type2 zkEVM.
Compatible with more existing Ethereum applications compared to Type4 zkEVM.
Disadvantages:
Higher incompatibility and more sacrifices compared to Type1 and Type2 zkEVM (less friendly to Ethereum developers). This is why Type3 is more like a transition, and solutions in this category will likely transition to Type2 zkEVM by increasing compatibility.
Slower proof generation compared to Type4 zkEVM.
Mainstream Projects:
Scroll: Launched the Pre-Alpha testnet in September 2022, the Alpha testnet in February 2023, and is expected to launch the mainnet in August 2023. A year ago, Scroll belonged to this type, but it is currently transitioning to Type2 zkEVM by increasing Ethereum compatibility.
Polygon zkEVM (Polygon team's ZK Rollup solution): Launched the mainnet Beta version in March 2023. It belonged to Type3 zkEVM at launch, but is currently transitioning to Type2 zkEVM.
Type4 zkEVM—Compatible with High-Level Languages
Architecture:
This type actually belongs to zkVM (Zero-Knowledge Virtual Machine, not Zero-Knowledge Ethereum Virtual Machine).
It can be understood as compatibility at the programming language level. The general logic is that 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 this programming language into their custom readable code (e.g., Starkware uses the Warp compiler to convert Solidity code into Cairo bytecode; zkSync uses the LLVM compiler to convert Solidity code into their custom virtual machine executable code LLVM-IR) and execute it in their custom environment (e.g., 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.
Significantly reduces costs (time, money, and computational effort) by compiling directly from high-level languages.
Reduces the technical barriers for verifiers and increases decentralization.
This type of zkEVM can natively support Account Abstraction, as equivalent chains like EVM cannot natively support account abstraction and need to implement it through Ethereum's ERC-4337.
Disadvantages:
Many existing Ethereum applications cannot be replicated in this type of zkVM, or problems may arise during replication: for example, contract addresses in Type 4 zkVM systems may be different from those in EVM; Type4 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 a compiler) its compiler does not support some features of Solidity.
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 very difficult to leverage the existing complex and thriving ecosystem and network effects of Ethereum.
Mainstream Projects:
zkSync Era (ZK Rollup solution built by Matter Labs team): Launched zkSync Lite (zkSync 1.0) in June 2020, mainly supporting simple payments and asset exchange scenarios, and does not support EVM-compatible smart contracts; launched zkSync Era (zkSync 2.0) in March 2023, achieving compatibility at the high-level language level through the above architecture. zkSync's goal is not EVM compatibility but to improve zero-knowledge proof generation speed.
Starknet (ZK Rollup solution built by Starkware team): Launched the mainnet in November 2021, and has been updated to version v0.12.0 in July this year. It belongs to Type4 zkEVM itself, and its goal is not EVM compatibility. However, there are projects on it, such as Kakarot, aiming to achieve compatibility similar to Type 2.5-3 zkEVM.
Based on Vitalik's 2022 classification of different zkEVM types and the progress of various projects (as of August 2023), we can summarize as follows:
Various mainstream ZK Rollup project classifications
Mainstream zkEVM Projects
Comparison chart of various mainstream ZK Rollup projects
Vitalik concluded in his article: "Personally, I hope that over time, through the improvement of zkEVM and Ethereum itself, Ethereum will become more friendly to ZK-SNARK and ultimately become Type1.
In such a future, we will have multiple zkEVM implementations that can be used for ZK Rollup and for verifying the Ethereum chain itself. In theory, Ethereum does not need to establish a single, standardized zkEVM specification for L1 (Layer 1) use; different clients can choose different proof methods, allowing us to continue benefiting from redundancy at the code level.
However, it will take quite a long time to achieve this future. In the meantime, we will also see a lot of innovation in the different paths of Ethereum (itself) scaling and Ethereum-based ZK Rollup."
It is important to note that while the mainstream classification of zkEVM is based on Vitalik's 2022 classification (as referenced in this article), there are also other classification standards. Regardless of the classification, these zkEVM types do not have absolute advantages or disadvantages. They only involve trade-offs between compatibility and speed: Type1 zkEVM has the highest compatibility with Ethereum but slower proof generation (in the ZK Rollup track); Type4 zkEVM has lower compatibility with Ethereum but faster verification.
However, the compatibility and speed of zkEVM are not the only factors 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 sequencing: 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 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 be recovered on L1 in the event of an L2 failure;
Data availability: complete data availability naturally comes at a higher cost, and whether it is acceptable for some ZK Rollups to use a lower-cost data availability model.
However, as most general ZK Rollup projects are currently 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 improvements to Ethereum itself, it is possible that all solutions will eventually achieve the effect of Type 1 zkEVM. At that time, we will have multiple zkEVM implementations that can be used for both ZK Rollups and for verifying the Ethereum chain itself.
Before that, let's look forward to seeing continued innovation in the different paths of scaling Ethereum and ZK Rollups.
References:
https://vitalik.ca/general/2022/08/29/zkevmzhTW.html_
https://taiko.mirror.xyz/w7NSKDeKfJoEy0p89I9feixKfdK-20JgWF9HZzxfeBo
https://docs.moonbeam.network/builders/pallets-precompiles/precompiles/eth-mainnet/
https://news.marsbit.co/20230329154749858367.html
https://www.evm.codes/precompiled?fork=shanghai
https://foresightnews.pro/article/detail/30153
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。