zkEVM Deep Dive (Polygon, Scroll, StarkWare, and zkSync)
“In the medium to long term, zk rollups will win out in all use cases as zk-SNARK technology improves.” —Vitalik Buterin
Contents
- What is a ZK Rollup?
- Why ZK Rollups?
- What is a zkEVM?
- zkEVM Analysis Frameworks
- Top zkEVM Projects
- Polygon
- Scroll
- StarkWare
- zkSync
- Key Differences
- Which Project Will Win?
What is a ZK Rollup?
To understand what a zk rollup is, we need to know two core concepts:
- Zero-Knowledge Proofs
- Rollups
Zero-Knowledge Proofs
A zero-knowledge proof (zk proof) is used to mathematically verify a statement without revealing any information about the statement.
A zk-SNARK is a type of zk proof that stands for "zero-knowledge succinct arguments of knowledge." A zk-SNARK allows a computer to quickly verify the output of a computation. Proofs can be generated much faster than the computation would take to run, which improves the speed of the system. They are useful in cryptography because they allow some inputs of the computation to be hidden.
A common analogy used to explain zk-SNARKs is the "Where's Waldo?" example. Imagine you're looking at a Where's Waldo? image and you need to prove to Person X that you found Waldo without revealing his location. You could cut out the image of Waldo and give it to Person X, which would verify that you found Waldo but not reveal where he was hiding. Zk-SNARKs work in a similar way, using zk proofs to verify transactions without revealing any additional information.
Rollups
Rollups are the main way that Ethereum developers plan to scale the Ethereum network. Rollups can increase throughput (measured in transactions per second), improve transaction finality speed, and lower transaction fees. They are a type of "layer 2." A layer 2 is a blockchain that runs on top of a layer 1 blockchain.
In short, rollups allow Ethereum to complete more transactions faster and at a lower cost.
A popular analogy for explaining rollups is the "mail" analogy. Imagine you're sending 5 separate letters to 5 people who all live in the same house. You put each of the letters into separate envelopes, pay for 5 stamps, and send them. It would make more sense to put all of the letters into one envelope, pay for one stamp, and send that one envelope to their house. This would reduce your postage costs and allow you to send more letters.
Rollups work similarly to the "mail" analogy because they take, say, 2,000 transactions (2,000 letters) and put them into a single batch (a single envelope). That batch is then sent (mailed) to Ethereum (the recipient's house), where the transaction data is stored as a single Ethereum transaction. This process results in higher TPS, quicker finality, and lower transaction fees.
For more info on rollups, I recommend Vitalik Buterin's An Incomplete Guide to Rollups and Delphi Digital's The Complete Guide to Rollups.
A zk rollup (zero-knowledge rollup) is a type of rollup that uses zero-knowledge proofs to verify transactions.
Why ZK Rollups?
Ethereum has two main problems:
- It has a (low) throughput of 15-45 transactions per second (TPS).
- It has expensive transaction fees when the network is congested.
Between January 2021 and May 2022, the average Ethereum transaction fee was roughly $40. On May 1, 2022, the average transaction fee was $196.63.
The solution to Ethereum's low TPS and high transaction fees is layer 2 solutions like zk rollups and optimistic rollups.
The main competition for zk rollups is optimistic rollups, a type of rollup that uses fraud proofs instead of zero-knowledge proofs. Zk rollups have improved speed and privacy when compared to optimistic rollups, but they are more technically difficult to implement. The previous implementations of zk rollups have limited functionality. They can (largely) only do token transfers and swaps. But zk rollup technology is improving with the development of sharding (and zkEVMs, which we'll cover in the next section). Figure 2 shows the potential future of sharding technology, where rollup block data is split up over time between shards.
“In the medium to long term, zk rollups will win out in all use cases as zk-SNARK technology improves.” —Vitalik Buterin, co-founder of Ethereum
Zk rollups are the key to Ethereum scaling over the long term. The technical team at Scroll, a leading layer 2 project, has said that zk rollups are as secure as the Ethereum layer 1 and have the fastest finality of any layer 2 scaling solution. Additionally, Vitalik Buterin has said that rollups are essential to scaling TPS:
- Ethereum has 15-45 TPS.
- Ethereum with zk rollups will have 1,000-4,000 TPS.
- Ethereum post-merge with zk rollups will have 25,000-100,000 TPS.
To get to the endgame of Ethereum scalability and functionality, we need the next generation of zk rollup technology, zkEVMs.
What is a zkEVM?
To understand what a zkEVM is, we need to understand one more core concept: The Ethereum Virtual Machine.
The Ethereum Virtual Machine (EVM)
In short, the Ethereum Virtual Machine (EVM) is a decentralized cloud computer that runs the Ethereum network and processes smart contracts. The EVM is the runtime environment for Ethereum. It's a standard set of rules and software packages, rather than a single piece of hardware or software. It was initially defined in the Ethereum Yellow Paper and is updated through Ethereum Improvement Proposals (EIPs), like EIP1559. When the EVM is run on many different computers, the result is a cohesive but decentralized blockchain network. In this case, the network is the Ethereum mainnet, but there are other EVM-compatible mainnets and testnets, like Avalanche and Fantom. A mainnet is a fully functional blockchain that is available to the public, as opposed to a testnet, which is used for testing new projects and updates.
For a zk rollup to work well with the EVM, Solidity code, and Ethereum developer tools, it must be compatible with the EVM. Previous zk rollup implementations were not EVM-compatible, so they were incompatible with many Ethereum decentralized applications (dApps) and developer tools.
A zkEVM is a type of zk rollup that is EVM-compatible.
zkEVM Analysis Frameworks
ZkEVM projects all have a similar goal – to create developer and user experiences that are exactly like Ethereum. There are 4 top zkEVM projects taking different approaches with unique tradeoffs. Some are more developer-friendly. Some are easier to maintain. Some finalize transactions faster. Some have lower transaction fees. In this section, we will cover 3 different frameworks to help us understand the differences between zkEVM projects.
"Level" zkEVM Analysis Framework
Scroll’s Luozhu Zhang and Toghrul Maharramov have an analysis framework where there are 3 levels of zkEVM compatibility:
- Consensus level. (Developer-friendly.) Commonly called a "true" zkEVM.
- Bytecode level. (Developer-friendly.) Commonly called EVM-equivalent.
- Language level. (Not developer-friendly.) Commonly called EVM-compatible.
Figure 5 shows how language level zkEVMs transpile Solidity code. Language level zkEVMs, like StarkNet and zkSync, take Solidity, Vyper, or Yul code and transpile it into a zk-friendly language like Cario or Zinc.
Bytecode level zkEVMs do not transpile Solidity code into another coding language and should be able to use common Ethereum developer tools (like Hardhat and Foundry), libraries (like ethers.js), wallets (like MetaMask), marketplaces, and debuggers. Language level zkEVMs, in contrast, may not be compatible.
"Type" zkEVM Analysis Framework
Vitalik Buterin has an analysis framework that identifies 4 or 5 types of zkEVMs.
We need to know what a zkEVM "prover" is to understand Vitalik's framework. The prover is the part of the code that generates zk proofs. Improving prover times would decrease the time it takes to finalize a transaction.
Vitalik Buterin's zkEVM analysis framework:
- Type 1: Fully Ethereum-equivalent. All Solidity smart contracts and developer tools will work flawlessly.
- Type 2: Fully EVM-equivalent. Similar to Type 1, but has some modifications to improve prover time and developer-friendliness.
- Type 2.5: The same as Type 2 except prover times are improved by increasing transaction fees.
- Type 3: Almost EVM-equivalent. The key difference between Type 2 and Type 3 is that smart contracts may require rewriting to run properly.
- Type 4: High-level-language-equivalent. The key difference between Type 3 and Type 4 is that smart contracts will likely require rewriting and common Ethereum developer tools may not be compatible.
"True" zkEVM Analysis Framework
Messari research analysts, Tom Dunleavy and Eshita Nandini, have a different zkEVM analysis framework. The standard for a "true" zkEVM is determined by how the bytecode is executed. If it is executed directly, it is a "true" zkEVM. If the bytecode is interpreted before it is executed, it is not a "true" zkEVM.
Top zkEVM Teams and Projects
Polygon (Polygon zkEVM), Scroll, StarkWare (StarkNet), and Matter Labs (zkSync 2.0) are the leading zkEVM development teams and projects.
Figure 7 shows the process that Solidity code must go through before running on each project's zkEVM. It is broken up into 3 levels on the "y-axis," similar to Luozhu Zhang's zkEVM analysis framework.
Polygon
Polygon is a leading layer 2 development team that offers multiple scaling solutions for Ethereum. Polygon uses many different technologies to scale Ethereum like zk and optimistic rollups, sidechains, a data availability layer, and a blockchain SDK. The most widely adopted is Polygon’s Proof of Stake (PoS) sidechain, which uses staked coins and validators to verify transactions.
- Polygon PoS: an EVM-compatible Proof of Stake sidechain. (Live)
- Polygon zkEVM: an open-source zk rollup focused on EVM-equivalence. (Public Testnet)
- Polygon Avail: a standalone layer 2 chain focused on data availability. (Development)
- Polygon Nightfall: a privacy-focused rollup chain using both zk and optimistic rollups. (Mainnet Beta)
- Polygon Miden: a zk-STARK rollup. (Development)
- Polygon Zero: a zk rollup chain focused on scalability. (Development)
The most important of Polygon’s scaling solutions are Polygon PoS and Polygon zkEVM.
Polygon Proof of Stake (PoS)
Polygon Proof of Stake launched in 2017 and is now the most used layer 2 on Ethereum. The PoS sidechain is EVM-compatible and uses the Plasma bridging framework. It currently handles almost all of Polygon’s transactions, has a throughput of 7,000 TPS, and has a 2s block time. It's roughly 10,000x lower cost than transacting on Ethereum and the average transaction is less than 1 cent. Its main downside is that its security is poor compared to rollups.
Polygon zkEVM
Polygon is currently developing its zk rollup infrastructure. In Q3 2022, they raised $450 million and committed $1 billion to develop multiple zk rollup scaling solutions.
In August 2021, Polygon acquired the Hermez Network, a layer 2 zk rollup project, and integrated it into their product lineup as Polygon Hermez. In July 2022, they rebranded Polygon Hermez to Polygon zkEVM.
Polygon zkEVM is an open-source layer 2 rollup with a throughput of 2,000 TPS. It is currently at the public testnet stage of development. Over 2,000 transactions can be batched and put onto the Ethereum layer 1 as a single transaction. The Polygon zkEVM launched a public testnet on October 10, 2022. The mainnet zkEVM is expected to launch in early 2023.
Polygon zkEVM (as well as StarkNet and zkSync 2.0) has promised data availability volition in the future. Volition gives the user the ability to choose the degree to which their data is stored on-chain or off-chain. There are different use cases where it can be useful to control data availability. Figure 9 contrasts volition with other data availability solutions.
Analysis Frameworks Results:
Scroll
Scroll is a layer 2 zkEVM scaling solution. There is a pre-alpha testnet with over 10,000 users testing demo forks of dApps. Scroll released an update on October 9, 2022, which allows developers to deploy smart contracts using Ethereum developer tools (like Hardhat and Foundry) and Ethereum smart contracts will work without rewriting code. The update also adds support for ERC-20, ERC-721, and ERC-1155 standards. Scroll will soon release a testnet version open to the public.
Analysis Frameworks Results:
StarkWare
StarkWare is one of few zkEVM teams using zk-STARKs rather than zk-SNARKs. Zk-STARKs make transactions more secure but higher in fees. They also have larger batch sizes, faster proving, and are post-quantum secure (meaning they cannot be cracked by a quantum computer). StarkWare has 2 projects, StarkNet and StarkEx.
StarkNet
StarkNet is a layer 2 zkEVM scaling solution. StarkNet Alpha launched on the Ethereum mainnet in November 2021.
“StarkNet provides Ethereum-level composability – facilitating easy development and innovation.” —StarkWare
StarkWare claims to have solved composability but its critics would disagree. StarkWare uses the Warp transpiler to transform Solidity code into Cairo. Transpiling works for EVM compatibility, but there are some known Solidity features that are not supported on StarkNet. A full list of the unsupported features can be found on Nethermind's GitHub under the "Unsupported Solidity Features" section. StarkWare is creating its own APIs and JavaScript libraries, which will require tools to manually add StarkNet compatibility.
Analysis Frameworks Results:
StarkEx
StarkEx is a layer 2 scaling solution made specifically for NFT trading, derivative trading, spot trading, payments, DeFi pooling, and automated market makers (AMMs). It can be thought of as a permissioned version of StarkNet. "Permissioned" means it's tailor-made to work for certain dApps that are given permission to use the network.
zkSync
Matter Labs launched zkSync 1.0 in June 2020. It's a non-EVM-compatible zk rollup layer 2. This version of zkSync was able to scale to 300 TPS. In a later update, zkSync 1.1 increased throughput to 3,000 TPS.
zkSync 2.0
ZkSync 2.0 is a zkEVM layer 2 scaling solution. It launched on the Ethereum mainnet on October 28, 2022. The network is currently only accessible to the Matter Labs team and it will not be public until they are confident that it is running properly. In late 2022 or early 2023, after zkSync 2.0 has been tested, the alpha will fully launch and anyone will be able to use it. If all goes well during the testing phase, Matter Labs will be the first to deploy a working zkEVM on the Ethereum mainnet.
"ZkSync's zk rollup technology combined with Ethereum 2.0 data sharding is the endgame, hitting 100,000+ TPS without sacrifices [in programmability, security, scalability, or decentralization]." —Matter Labs
Matter Labs claims that zkSync 2.0 has near-frictionless porting of Ethereum dApps. That means that developers can port their Solidity code onto zkSync with minimal changes. Matter Labs' critics would say that zkSync 2.0 is not as developer-friendly as they claim and that common Ethereum developer tools may not be compatible.
One benefit of Matter Labs' zkEVM approach is that they can add unique non-EVM-compatible features or build new features from EIPs before they launch on Ethereum. One of these features is that users can pay transaction fees in any ERC-20 token, like USDC, DAI, ETH, LINK, or WBTC. This greatly improves the user experience when you have to pay a transaction fee but don't have any of the native token.
Analysis Frameworks Results:
Key Differences
Every zkEVM project is currently marketing itself as the most developer-friendly to try to attract developers to their platform. They're projecting the 3+ year goal for their projects and claiming that they will have that functionality soon.
Luozhu Zhang zkEVM Analysis Framework Results
Polygon and Scroll are bytecode level (developer-friendly). With these projects, there is no transpiler step. The smart contracts written in Solidity are not converted before being transpiled and interpreted.
StarkNet and zkSync 2.0 are language level (not developer-friendly). For zkSync 2.0, smart contracts written in Solidity will run, but zkSync will transpile the code into Yul, another coding language. StarkNet will transpile code into Cairo.
Vitalik Buterin zkEVM Analysis Framework Results
- Polygon zkEVM is Type 2 or 3
- Scroll is Type 2
- StarkNet is Type 4
- zkSync 2.0 is Type 4
A lower number means it is more Ethereum-equivalent, but Alex Connolly, co-founder and CTO of Immutable X has said, "It is crucial to understand that none of the [zkEVM] approaches are inherently superior—it’s a categorization, not a hierarchy. They all make different tradeoffs: easier to build, maintain and upgrade, more performant, more easily compatible with existing tools. Ultimately, the leading rollup will also be determined by better distribution and marketing, rather than pure technical capability."
Messari zkEVM Analysis Framework Results
Using Messari's framework, Scroll is the only "true" zkEVM. Scroll is the most EVM-equivalent, followed by Polygon zkEVM, zkSync 2.0, and StarkNet (in that order). Polygon zkEVM is closer to a "true" zkEVM than zkSync or StarkNet, but it may execute code slightly differently than the EVM. This is because it has micro opcode that runs before the Solidity code is compiled into bytecode.
Overview
There are many other zkEVM analysis frameworks and opinions. Scroll’s co-founder, Sandy Peng, has said that there isn’t a consensus on definitions for EVM equivalence and compatibility.
I think that over the long term, the differences between zkEVMs will diminish as:
- Each project develops ways to improve developer-friendliness.
- Ethereum releases updates that make it more zk rollup-friendly.
Which Project Will Win?
Justin Drake, a researcher for the Ethereum Foundation, has said, “It turns out that in this space, oftentimes it is not just about technology. Sometimes, it’s the network effects – the culture of the community – that is actually the most important thing.”
An example of network effects can be seen in the Apple App Store. Even though it is unstable and randomly rejects apps, developers still want to publish their apps on it because it has the most active users. In contrast, the Google Play Store is more developer-friendly, but developers favor Apple's platform because of its network effects.
Polygon is like the Apple App Store of web3, it has strong network effects. Polygon PoS has more daily active addresses than any other layer 2, with over 350,000 at the time of writing. They can eventually be converted into Polygon zkEVM users.
I believe Polygon will remain the dominant layer 2 scaling solution for Ethereum unless a competitor can make a product that's 10x better for developers and users. Polygon has the network effects, investors, cash, technical team, brand, and community to win.
I also think that there will be multiple successful blockchain projects. Other blockchain networks may be used for different purposes or as backups. It could look something like Figure 15, where there are multiple layer 2 rollups connected by bridges.
Sources and Further Reading
General Sources
- Vitalik Buterin's Incomplete Guide to Rollups: https://vitalik.ca/general/2021/01/05/rollup.html
- A complete guide to rollups: https://members.delphidigital.io/reports/the-complete-guide-to-rollups/
- Vitalik Buterin's zkEVM analysis framework: https://vitalik.ca/general/2022/08/04/zkevm.html
- Scroll's Luozhu Zhang on zkEVM types: https://threadreaderapp.com/thread/1538166119785111552.html or https://twitter.com/luozhuzhang/status/1538166119785111552?lang=en
- https://vitalik.ca/general/2021/12/06/endgame.html
- https://ethereum.org/en/developers/docs/evm/
- https://ethereum.org/en/zero-knowledge-proofs/
- https://vitalik.ca/general/2021/01/26/snarks.html
- Vitalik's 2016 guide to SNARKs: https://medium.com/@VitalikButerin/quadratic-arithmetic-programs-from-zero-to-hero-f6d558cea649
- https://vitalik.ca/general/2017/11/09/starks_part_1.html
- https://vitalik.ca/general/2017/11/22/starks_part_2.html
- https://vitalik.ca/general/2018/07/21/starks_part_3.html
- Vitalik on Bankless Podcast – Rollups: https://youtu.be/wcCHlqgGSH4
- Vitalik on Lex Fridman Podcast – Eth 2.0: https://youtu.be/XW0QZmtbjvs
- https://blockworks.co/news/defi-is-betting-big-on-zero-knowledge-is-the-technology-ready/
- https://www.coindesk.com/tech/2022/07/27/ethereums-rollup-race-what-is-a-true-zkevm/
- https://immutablex.medium.com/ground-up-guide-zkevm-evm-compatibility-rollups-787b6e88108e
- https://medium.com/ethereum-optimism/introducing-evm-equivalence-5c2021deb306
- Data availability – Volition: https://medium.com/starkware/volition-and-the-emerging-data-availability-spectrum-87e8bfa09bb
- Eli Ben-Sasson (StarkWare) on different crypto proofs: https://medium.com/starkware/the-cambrian-explosion-of-crypto-proofs-7ac080ac9aed
- Jordi Baylina (Polygon zkEVM team) presentation on zkEVMs: https://youtu.be/17d5DG6L2nw
Polygon Sources
- https://wiki.polygon.technology/docs/develop/getting-started/
- https://messari.io/report/polygon-a-multi-sided-approach-to-zk-scaling
- https://messari.io/report/state-of-polygon-q3-2022?referrer=asset:polygon
- https://messari.io/report/the-big-three-zkevm-announcements-what-you-need-to-know-and-potential-implications
- https://polygon.technology/solutions/polygon-pos
- https://polygon.technology/solutions/polygon-hermez
- Polygon zkEVM docs: https://docs.hermez.io/zkEVM/Overview/Overview/#why-is-pod-not-the-best-option
- https://polygon.technology/solutions/polygon-nightfall
- https://www.linkedin.com/pulse/say-hello-nightfall-paul-brody-1f/
- https://polygon.technology/blog/polygon-zkevm-public-testnet-the-next-chapter-for-ethereum
- https://www.coindesk.com/business/2021/08/13/polygon-merges-with-hermez-network-in-250m-deal/
- https://wiki.polygon.technology/docs/faq/commit-chain-multisigs/
- zkEVM vs EVM presentation: https://youtu.be/BEo4F9IlK70
- Polygon PoS endgame: https://mirror.xyz/apriori.eth/9pLFJc6t5N__uPEHMZ1GolfNY5k1UMS7yGiS6Vw63as
Scroll Sources
- Scroll architecture: https://scroll.mirror.xyz/nDAbJbSIJdQIWqp9kn8J0MVS4s6pYBwHmK7keidQs-k
- https://scroll.io/blog/zkEVM
- Scroll team on Blockworks Empire: https://youtu.be/OYRqbw37_xQ
- Pre testnet alpha: https://scroll.mirror.xyz/FYzq9QWb2UhS00p-AOFMBh1Oq6SCqLA6L855GAHczOw
StarkWare Sources
- Starkware blog home: https://starkware.medium.com
- https://starkware.co/starknet/
- https://starkware.co/starkex/
- StarkNet update: https://medium.com/starkware/starknet-alpha-2-4aa116f0ecfc
- Eli Ben-Sasson, StarkWare Co-founder and President on STARKs, Cairo, and StarkNet: https://youtu.be/QPNp8w9rx7o
- https://medium.com/starkware/the-cambrian-explosion-of-crypto-proofs-7ac080ac9aed
- Self-custody series: https://medium.com/starkware/tagged/starkex-self-custody
zkSync Sources
- Matter Labs zk rollup presentation: https://youtu.be/8pYShEW3-QE
- zkSync Baby Alpha update: https://blog.matter-labs.io/baby-alpha-has-arrived-5b10798bc623
- zkSync V2 update: https://matterlabs.medium.com/introducing-account-abstraction-l2-l1-messaging-and-more-760282cb31a7
- Interesting layer 3: https://blog.matter-labs.io/zksync-l3-pathfinder-to-hit-testnet-in-q1-2023-367a425592db
- Bankless Podcast—Differences between zkSync and Scroll: https://youtu.be/sokVnpaqIEc
Notable Tweets
A zkEVM analysis framework from Toghrul Maharramov, a Senior Researcher at Scroll:
Scroll's Ye Zhang makes the argument that Polygon may behave differently than the EVM when running Solidity code. Brendan Farmer of Polygon says that Polygon zkEVM will run the same as Scroll in practice:
The co-founder of zkSync calls out the co-founder of Polygon for claiming that Polygon zkEVM is EVM-equivalent:
Alex Gluchowski, the co-founder of zkSync, claims that Matter Labs is intentionally making zkSync 2.0 EVM-compatible rather than EVM-equivalent so that they can make a better developer and user experience with custom features:
Comments ()