Vitalik Buterin: The different types of ZK-EVMs

Vitalik Buterin發佈於 2022-08-05更新於 2022-08-05

文章摘要

This post will attempt to describe a taxonomy of the different "types" of EVM equivalence, as well as the benefits and costs of trying to implement each type.

Special thanks to the PSE, Polygon Hermez, Zksync, Scroll, Matter Labs and Starkware teams for discussion and review.

There have been many "ZK-EVM" projects making flashy announcements recently. Polygon open-sourced their ZK-EVM project, ZKSync released their plans for ZKSync 2.0, and the relative newcomer Scroll announced their ZK-EVM recently. There is also the ongoing effort from the Privacy and Scaling Explorations team, Nicolas Liochon et al's team, an alpha compiler from the EVM to Starkware's ZK-friendly language Cairo, and certainly at least a few others I have missed.

The core goal of all of these projects is the same: to use ZK-SNARK technology to make cryptographic proofs of execution of Ethereum-like transactions, either to make it much easier to verify the Ethereum chain itself or to build ZK-rollups that are (close to) equivalent to what Ethereum provides but are much more scalable. But there are subtle differences between these projects, and what tradeoffs they are making between practicality and speed. This post will attempt to describe a taxonomy of different "types" of EVM equivalence, and what are the benefits and costs of trying to achieve each type.

Overview (in chart form)

Type 1 (fully Ethereum-equivalent)

Type 1 ZK-EVMs strive to be fully and uncompromisingly Ethereum-equivalent. They do not change any part of the Ethereum system to make it easier to generate proofs. They do not replace hashes, state trees, transaction trees, precompiles or any other in-consensus logic, no matter how peripheral.

Advantage: perfect compatibility

The goal is to be able to verify Ethereum blocks as they are today - or at least, verify the execution-layer side (so, beacon chain consensus logic is not included, but all the transaction execution and smart contract and account logic is included).

Type 1 ZK-EVMs are what we ultimately need make the Ethereum layer 1 itself more scalable. In the long term, modifications to Ethereum tested out in Type 2 or Type 3 ZK-EVMs might be introduced into Ethereum proper, but such a re-architecting comes with its own complexities.

Type 1 ZK-EVMs are also ideal for rollups, because they allow rollups to re-use a lot of infrastructure. For example, Ethereum execution clients can be used as-is to generate and process rollup blocks (or at least, they can be once withdrawals are implemented and that functionality can be re-used to support ETH being deposited into the rollup), so tooling such as block explorers, block production, etc is very easy to re-use.

Disadvantage: prover time

Ethereum was not originally designed around ZK-friendliness, so there are many parts of the Ethereum protocol that take a large amount of computation to ZK-prove. Type 1 aims to replicate Ethereum exactly, and so it has no way of mitigating these inefficiencies. At present, proofs for Ethereum blocks take many hours to produce. This can be mitigated either by clever engineering to massively parallelize the prover or in the longer term by ZK-SNARK ASICs.

Who's building it?

The Privacy and Scaling Explorations team ZK-EVM effort is building a Type 1 ZK-EVM.

Type 2 (fully EVM-equivalent)

Type 2 ZK-EVMs strive to be exactly EVM-equivalent, but not quite Ethereum-equivalent. That is, they look exactly like Ethereum "from within", but they have some differences on the outside, particularly in data structures like the block structure and state tree.

The goal is to be fully compatible with existing applications, but make some minor modifications to Ethereum to make development easier and to make proof generation faster.

Advantage: perfect equivalence at the VM level

Type 2 ZK-EVMs make changes to data structures that hold things like the Ethereum state. Fortunately, these are structures that the EVM itself cannot access directly, and so applications that work on Ethereum would almost always still work on a Type 2 ZK-EVM rollup. You would not be able to use Ethereum execution clients as-is, but you could use them with some modifications, and you would still be able to use EVM debugging tools and most other developer infrastructure.

There are a small number of exceptions. One incompatibility arises for applications that verify Merkle proofs of historical Ethereum blocks to verify claims about historical transactions, receipts or state (eg. bridges sometimes do this). A ZK-EVM that replaces Keccak with a different hash function would break these proofs. However, I usually recommend against building applications this way anyway, because future Ethereum changes (eg. Verkle trees) will break such applications even on Ethereum itself. A better alternative would be for Ethereum itself to add future-proof history access precompiles.

Disadvantage: improved but still slow prover time

Type 2 ZK-EVMs provide faster prover times than Type 1 mainly by removing parts of the Ethereum stack that rely on needlessly complicated and ZK-unfriendly cryptography. Particularly, they might change Ethereum's Keccak and RLP-based Merkle Patricia tree and perhaps the block and receipt structures. Type 2 ZK-EVMs might instead use a different hash function, eg. Poseidon. Another natural modification is modifying the state tree to store the code hash and keccak, removing the need to verify hashes to process the EXTCODEHASH and EXTCODECOPY opcodes.

These modifications significantly improve prover times, but they do not solve every problem. The slowness from having to prove the EVM as-is, with all of the inefficiencies and ZK-unfriendliness inherent to the EVM, still remains. One simple example of this is memory: because an MLOAD can read any 32 bytes, including "unaligned" chunks (where the start and end are not multiples of 32), an MLOAD can't simply be interpreted as reading one chunk; rather, it might require reading two consecutive chunks and performing bit operations to combine the result.

Who's building it?

Scroll's ZK-EVM project is building toward a Type 2 ZK-EVM, as is Polygon Hermez. That said, neither project is quite there yet; in particular, a lot of the more complicated precompiles have not yet been implemented. Hence, at the moment both projects are better considered Type 3.

Type 2.5 (EVM-equivalent, except for gas costs)

One way to significantly improve worst-case prover times is to greatly increase the gas costs of specific operations in the EVM that are very difficult to ZK-prove. This might involve precompiles, the KECCAK opcode, and possibly specific patterns of calling contracts or accessing memory or storage or reverting.

Changing gas costs may reduce developer tooling compatibility and break a few applications, but it's generally considered less risky than "deeper" EVM changes. Developers should take care to not require more gas in a transaction than fits into a block, to never make calls with hard-coded amounts of gas (this has already been standard advice for developers for a long time).

An alternative way to manage resource constraints is to simply set hard limits on the number of times each operation can be called. This is easier to implement in circuits, but plays much less nicely with EVM security assumptions. I would call this approach Type 3 rather than Type 2.5.

Type 3 (almost EVM-equivalent)

Type 3 ZK-EVMs are almost EVM-equivalent, but make a few sacrifices to exact equivalence to further improve prover times and make the EVM easier to develop.

Advantage: easier to build, and faster prover times

Type 3 ZK-EVMs might remove a few features that are exceptionally hard to implement in a ZK-EVM implementation. Precompiles are often at the top of the list here;. Additionally, Type 3 ZK-EVMs sometimes also have minor differences in how they treat contract code, memory or stack.

Disadvantage: more incompatibility

The goal of a Type 3 ZK-EVM is to be compatible with most applications, and require only minimal re-writing for the rest. That said, there will be some applications that would need to be rewritten either because they use pre-compiles that the Type 3 ZK-EVM removes or because of subtle dependencies on edge cases that the VMs treat differently.

Who's building it?

Scroll and Polygon are both Type 3 in their current forms, though they're expected to improve compatibility over time. Polygon has a unique design where they are ZK-verifying their own internal language called zkASM, and they interpret ZK-EVM code using the zkASM implementation. Despite this implementation detail, I would still call this a genuine Type 3 ZK-EVM; it can still verify EVM code, it just uses some different internal logic to do it.

Today, no ZK-EVM team wants to be a Type 3; Type 3 is simply a transitional stage until the complicated work of adding precompiles is finished and the project can move to Type 2.5. In the future, however, Type 1 or Type 2 ZK-EVMs may become Type 3 ZK-EVMs voluntarily, by adding in new ZK-SNARK-friendly precompiles that provide functionality for developers with low prover times and gas costs.

Type 4 (high-level-language equivalent)

A Type 4 system works by taking smart contract source code written in a high-level language (eg. Solidity, Vyper, or some intermediate that both compile to) and compiling that to some language that is explicitly designed to be ZK-SNARK-friendly.

Advantage: very fast prover times

There is a lot of overhead that you can avoid by not ZK-proving all the different parts of each EVM execution step, and starting from the higher-level code directly.

I'm only describing this advantage with one sentence in this post (compared to a big bullet point list below for compatibility-related disadvantages), but that should not be interpreted as a value judgement! Compiling from high-level languages directly really can greatly reduce costs and help decentralization by making it easier to be a prover.

Disadvantage: more incompatibility

A "normal" application written in Vyper or Solidity can be compiled down and it would "just work", but there are some important ways in which very many applications are not "normal":

Contracts may not have the same addresses in a Type 4 system as they do in the EVM, because CREATE2 contract addresses depend on the exact bytecode. This breaks applications that rely on not-yet-deployed "counterfactual contracts", ERC-4337 wallets, EIP-2470 singletons and many other applications.

Handwritten EVM bytecode is more difficult to use. Many applications use handwritten EVM bytecode in some parts for efficiency. Type 4 systems may not support it, though there are ways to implement limited EVM bytecode support to satisfy these use cases without going through the effort of becoming a full-on Type 3 ZK-EVM.

Lots of debugging infrastructure cannot be carried over, because such infrastructure runs over the EVM bytecode. That said, this disadvantage is mitigated by the greater access to debugging infrastructure from "traditional" high-level or intermediate languages (eg. LLVM).

Developers should be mindful of these issues.

Who's building it?

ZKSync is a Type 4 system, though it may add compatibility for EVM bytecode over time. Nethermind's Warp project is building a compiler from Solidity to Starkware's Cairo, which will turn StarkNet into a de-facto Type 4 system.

The future of ZK-EVM types

The types are not unambiguously "better" or "worse" than other types. Rather, they are different points on the tradeoff space: lower-numbered types are more compatible with existing infrastructure but slower, and higher-numbered types are less compatible with existing infrastructure but faster. In general, it's healthy for the space that all of these types are being explored.

Additionally, ZK-EVM projects can easily start at higher-numbered types and jump to lower-numbered types (or vice versa) over time. For example:

A ZK-EVM could start as Type 3, deciding not to include some features that are especially hard to ZK-prove. Later, they can add those features over time, and move to Type 2.

A ZK-EVM could start as Type 2, and later become a hybrid Type 2 / Type 1 ZK-EVM, by providing the possibility of operating either in full Ethereum compatibility mode or with a modified state tree that can be proven faster. Scroll is considering moving in this direction.

What starts off as a Type 4 system could become Type 3 over time by adding the ability to process EVM code later on (though developers would still be encouraged to compile direct from high-level languages to reduce fees and prover times)

A Type 2 or Type 3 ZK-EVM can become a Type 1 ZK-EVM if Ethereum itself adopts its modifications in an effort to become more ZK-friendly.

A Type 1 or Type 2 ZK-EVM can become a Type 3 ZK-EVM by adding a precompile for verifying code in a very ZK-SNARK-friendly language. This would give developers a choice between Ethereum compatibility and speed. This would be Type 3, because it breaks perfect EVM equivalence, but for practical intents and purposes it would have a lot of the benefits of Type 1 and 2. The main downside might be that some developer tooling would not understand the ZK-EVM's custom precompiles, though this could be fixed: developer tools could add universal precompile support by supporting a config format that includes an EVM code equivalent implementation of the precompile.

Personally, my hope is that everything becomes Type 1 over time, through a combination of improvements in ZK-EVMs and improvements to Ethereum itself to make it more ZK-SNARK-friendly. In such a future, we would have multiple ZK-EVM implementations which could be used both for ZK rollups and to verify the Ethereum chain itself. 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.

However, it is going to take quite some time until we get to such a future. In the meantime, we are going to see a lot of innovation in the different paths to scaling Ethereum and Ethereum-based ZK-rollups.

你可能也喜歡

Dylan Patel:黄仁勋力赞的SemiAnalysis,创始人是“养蜂人”、“贴吧老哥”

SemiAnalysis是一家快速崛起的独立半导体行业投研机构,年营收有望突破1亿美元,其创始人Dylan Patel的经历颇为传奇。他并非科班出身,成长于美国佐治亚州乡村,甚至曾当过养蜂人。他的半导体知识主要通过在Reddit等技术论坛以“贴吧老哥”式交流自学而来。 2020年,Dylan创立了个人博客SemiAnalysis,起初仅为小众技术分享。后在朋友建议下转向付费订阅,并逐渐发展为一个提供深度技术分析、商业咨询和研报的机构。如今,SemiAnalysis已拥有约60人的全球团队,并在美国建立了专业的芯片拆解实验室。 该机构以其硬核、细致的分析在业内建立起极高声誉,甚至能直接影响巨头决策。其关于AMD MI300X GPU软件栈存在问题的批评性报告,曾直接促使AMD CEO苏姿丰与之进行长时间通话,后者公开感谢其“建设性反馈”。随后SemiAnalysis发布的追踪报告也对AMD的改进给予了肯定。 英伟达创始人黄仁勋也曾在公开演讲中引用并称赞其报告。其分析内容时常能引发市场波动,例如近期一份关于英伟达AI服务器内存配置调整的研报被部分解读后,曾导致多家内存概念股股价下跌,尽管Dylan本人称报告原意被断章取义。 从论坛发烧友到受行业巨头尊敬的机构创始人,Dylan Patel与SemiAnalysis的故事,展现了深度、独立的技术分析在当今半导体与AI产业中的关键影响力。

marsbit37 分鐘前

Dylan Patel:黄仁勋力赞的SemiAnalysis,创始人是“养蜂人”、“贴吧老哥”

marsbit37 分鐘前

以太坊Q1报告:链上活跃度创新高,代币化资产领跑全行业

以太坊2026年第一季度报告显示,其链上活跃度创下历史新高,但以美元计价的资产规模和手续费收入同步收缩,呈现“量涨价跌”的两极分化态势。 **核心数据:** - **活跃度创新高**:月活跃用户达1320万个(环比+53.5%),一层网络交易量2.004亿笔(环比+38%),平均TPS升至25.78。这得益于1月的BPO#2升级,大幅提升了网络承载能力,导致单笔交易成本下降,总手续费环比减少47.9%。 - **生态规模领先但环比收缩**:全生态总锁仓资产3162亿美元(环比-11%),但仍占据五大公链总锁仓的71%。去中心化交易所交易量1345亿美元(环比-24%),略低于BNB链。生态手续费总收入20亿美元(环比-16.9%),但仍占五大公链总和的58.4%。 - **代币化资产领跑行业**:链上代币化资产总市值2034亿美元,同比大幅增长42.9%。其中,稳定币(1789亿美元)占比最大,代币化基金(194亿美元,环比+4.9%)和大宗商品(47亿美元,环比+60%)增速显著。以太坊在代币化基金和大宗商品赛道的市场份额分别高达73%和84%,显示出极强的统治力。 - **ETH基本面承压**:ETH完全稀释市值环比大跌30.3%至2900亿美元,是主要估值指标中跌幅最大的。但质押比率升至0.31,持币地址数环比增长8.1%至2.928亿个,表明用户长期信心仍在。 **核心解读:** 报告认为,当前“活跃度上升、手续费下降”的现象是网络主动扩容、牺牲短期收入以换取长期增长的体现,符合“杰文斯悖论”。类比互联网发展史,开放、无需许可的以太坊生态在积累了足够的流动性、开发者工具和机构案例后,已跨过临界点,成为机构布局代币化金融的首选底层网络。其在中立性、流动性和可组合性上的优势难以被私有链替代。未来随着监管成熟和扩容持续推进(如计划中的Glamsterdam升级),以太坊作为全球金融核心结算层的地位有望进一步巩固。

marsbit45 分鐘前

以太坊Q1报告:链上活跃度创新高,代币化资产领跑全行业

marsbit45 分鐘前

CryptoQuant指标显示鲸鱼在比特币64,000美元支撑位附近积累

加密货币分析平台CryptoQuant的数据显示,当比特币价格测试64,000美元支撑区域时,现货市场平均订单规模出现激增。这一指标通过交易量除以交易笔数计算,可用于区分市场活动是由小额零售订单还是大额资金流驱动。 分析指出,在价格承压的关键支撑位附近出现平均订单规模上升,可能意味着大型买家(鲸鱼)正在逢低吸纳,而非等待明确突破。这虽然不能保证市场已触底,但为交易者提供了一个关注该支撑区域能否持续守住的理由。 文章强调,并非所有交易量都具有同等意义。由大量小额交易驱动的高成交量可能反映恐慌或短期投机,而平均订单规模的急剧上升则往往指向大型参与者入场。不过,该指标需结合其他证据(如价格企稳、卖压减轻或订单簿深度改善)来综合判断,因为它有时也可能反映交易所内部钱包转移或批量执行等非方向性操作。 目前,64,000美元区域已成为市场焦点。该数据显示有大买家可能愿意捍卫此区域,但后续价格能否守住支撑并开始收复失地,对于判断该信号的真正含义至关重要。鲸鱼的买入行为是市场中的一个线索,表明此次回调并非全由恐慌驱动,但它并不能消除宏观风险、ETF资金流敏感性等影响因素,也不能直接等同于看涨趋势的反转。 总之,当前数据支持了存在谨慎的积累叙事的观点,但并未给出明确的多头反转信号。

bitcoinist1 小時前

CryptoQuant指标显示鲸鱼在比特币64,000美元支撑位附近积累

bitcoinist1 小時前

俄罗斯一边说“USDC 可以用了",一边又要对它收 3% 的钱?

俄罗斯财政部近期就加密货币监管作出两项关键表态,看似矛盾实则统一。首先,其宣布对USDT、USDC、BNB等被视作“高风险”或“不友好”的外国稳定币征收最高3%的专项费用,理由是这些资产背后的发行方有能力配合外部司法要求冻结资金。随后,又表示将USDC与比特币、以太坊、USDT一同列入“受监管名单”,允许其进入合法交易范畴。 这反映出俄罗斯对加密货币的核心立场并非禁止,而是“严格监管、纳入体系”。其策略类似于海关管理:允许特定资产“入境”,但通过差异化收费(风险高的收费高,风险低或友好的收费低甚至免收)进行风险定价和流向引导。这旨在将国际流通的主流加密资产纳入本国监管框架,增加税收,同时鼓励资金流向与卢布或友好国家货币挂钩的“更可控”的数字资产。 这一系列举措的紧迫性,与外部制裁压力直接相关。欧盟正计划升级对俄加密货币制裁,试图限制俄罗斯接入全球加密服务网络,尤其针对其用于跨境结算的通道。俄罗斯因此加速立法,意在外部封锁完全形成前,建立国内加密监管闭环,减少对美元体系稳定币的依赖,保障对外金融通道的自主性。 最终,加密资产的属性在复杂地缘政治下已超越单纯的投资工具,成为不同司法管辖区间争夺规则制定权和金融通道控制权的关键接口。俄罗斯的举措正是为此布局。

marsbit1 小時前

俄罗斯一边说“USDC 可以用了",一边又要对它收 3% 的钱?

marsbit1 小時前

交易

現貨
合約
活动图片