ZK-EVM: The Holy Grail of ZK-Rollup
- ZEC0%
- ETH0%
- ZK0%
- DYDX0%
- GTC0%
Ethereum scaling has been a hot topic, eagerly anticipated by many users. A common misconception is that the September 2022 Ethereum Merge, which transitioned its consensus mechanism from PoW to PoS, would improve Ethereum’s performance. In reality, the Merge did not alter block size, and block time only decreased from an average of 13 seconds to 12 seconds, meaning performance gains are expected to be limited. Ethereum’s short-term scaling hope still rests on layer-2 networks (Rollups). Among the two main Rollup approaches—Optimistic Rollup and ZK-Rollup—many people favor the latter. ZK-Rollup not only reduces network fees by batching multiple off-chain transactions but also inherits Ethereum’s security through zero-knowledge proof, eliminating the need for a challenge period as in Optimistic Rollup.
Payment-Only ZK-Rollups
Early ZK-Rollups were criticized for lacking EVM compatibility and thus not supporting smart contract functionality. For instance, zkSync 1.0, Gitcoin’s primary donation payment method, could only support basic transfers. Current ZK applications, like dYdX, are custom-built and non-interoperable, making development challenging. Additionally, different ZK applications use distinct custom circuits, limiting composability. Therefore, the market urgently needs a ZK-Rollup compatible with Ethereum smart contracts, for which the primary hurdle is achieving a zero-knowledge proof-compatible virtual machine. This article will introduce EVM, ZK-EVM, and the main ZK-EVM projects and their differences.
What is EVM?
The Ethereum Virtual Machine (EVM) serves as Ethereum’s execution engine, functioning as the runtime environment for smart contracts. Developers write business logic in high-level languages like Solidity, which is then compiled into bytecode. EVM interprets this bytecode into machine-readable opcodes, executing corresponding instructions to update the system state. EVM is a stack-based virtual machine interacting with stack, memory, and storage. For Ethereum and various scaling solutions or competing chains, EVM has become synonymous with the Ethereum ecosystem, representing its developers, applications, and tools. Non-EVM compatible blockchains must build their ecosystem, requiring developers to recreate applications and tools. Compatibility with EVM allows developers to seamlessly migrate existing Ethereum contracts and access Ethereum’s tools.
:quality(80)/2024-11-01/A714DCE1B8F371B89956C2371A70637F.png)
The Emerging ZK-EVM
Although EVM plays a crucial role in Ethereum’s ecosystem, developing a ZK-EVM is challenging. A ZK-EVM generates zero-knowledge proofs while being EVM-compatible, allowing Ethereum smart contracts to deploy without modification and to validate computations via zero-knowledge proof. EVM was not designed with ZK compatibility in mind since zero-knowledge proof algorithms, like zk-SNARKs, were not widely adopted until 2016 by Zcash. Some EVM operations are ZK-unfriendly, making proof generation difficult, slow, or large.
Developing ZK is notoriously complex, involving cryptography, mathematics, and hardware expertise. Building a ZK-EVM adds to this challenge since it requires both EVM compatibility and ZK-friendliness. Fortunately, significant breakthroughs have been made in ZK technology in recent years. Players in the ZK-EVM space, including Starkware, zkSync 2.0, Polygon, and Scroll, have been accelerating ZK-EVM development, with most announcing mainnet launches starting in 2023.
ZK-EVM Project Comparison
ZK-EVMs do not follow a unified design or standard, and each project strikes its own balance between EVM compatibility and ZK support. There are two main approaches:
1. Programming Language-Level Support: Customizing EVM opcodes to optimize for ZK, restructuring the virtual machine to support ZK-friendly operations and compiling Solidity into a new VM opcode.
2. Bytecode-Level Support: Maintaining native EVM opcodes compatibility.
Projects in the first category include Starkware’s StarkNet and zkSync 2.0. StarkNet can run any Ethereum dApp by compiling Solidity into StarkNet’s language, Cairo, for deployment on its ZK-friendly VM. Similarly, zkSync 2.0 achieves ZK-EVM functionality through its Yul and Zinc compilers, with Yul as an intermediate Solidity representation and Zinc, a Rust-based language, for smart contracts and general ZK circuits. Both are built on the LLVM framework to enable highly efficient ZK-EVM bytecode.
These projects offer Solidity compatibility at the language level, allowing developers to migrate Solidity contracts, though the underlying VM architecture differs from EVM and is technically a zkVM. Some existing developer tools may not work directly due to differing VM instruction sets, but this approach is more ZK-friendly and can generate proofs more efficiently.
In the second approach, projects like Polygon ZK-EVM and Scroll maintain native EVM opcode compatibility. Polygon’s uVM, a ZK-optimized VM, uses custom opcodes to enhance EVM operations by compiling EVM bytecode into micro-opcodes for execution. The Polygon ZK-EVM is fully EVM-compatible, enabling seamless operation of existing smart contracts, developer tools, and wallets. Scroll similarly designs circuits for each bytecode, verifying every EVM execution step, including loading bytecode, executing opcodes, and updating storage.
:quality(80)/2024-11-01/8E7A132B35AC2C81323EB19261745B19.png)
In Vitalik’s blog, he categorizes ZK-EVMs into types. Type 1 refers to ZK-EVMs directly developed on Ethereum, which is complex and inefficient, with ongoing research by the Ethereum Foundation. Types 2, 2.5, and 3 are EVM-equivalent ZK-EVMs, with Scroll and Polygon Hermez currently at Type 3, working toward Type 2.5 or even Type 2. Type 4 includes ZK-EVMs compatible with higher-level languages, such as Starkware and zkSync. These types have no intrinsic advantage or disadvantage, as there is no standardized ZK-EVM model. As Vitalik stated, “Theoretically, there is no need for Ethereum to standardize on a single ZK-EVM implementation for L1 use; different clients could use different proofs, so we continue to benefit from code redundancy.”
:quality(80)/2024-11-01/6B3BDB25C4B2EE57BBD405EC560A24AF.png)
Conclusion
Each ZK-EVM solution has unique strengths, and since most projects have not yet open-sourced their code, efficiency comparisons are unavailable. As the largest smart contract platform, Ethereum’s ecosystem and network effects are strong. ZK-EVM, the holy grail of ZK-Rollups, leverages Ethereum’s ecosystem and network effects to inherit its security, reduce fees, and foster a vibrant developer ecosystem. In early 2021, Vitalik suggested in his blog that Optimistic Rollup might outperform in general EVM computation in the short term, while ZK-Rollup may excel in simpler payments, trades, and application-specific use cases. However, with advancements in zk-SNARK technology, ZK-Rollup could prevail in all use cases in the mid-to-long term. With multiple ZK-EVM projects launching mainnets, Ethereum’s layer-2 scaling landscape promises to be exciting in the near future.