LogoLogo
  • Digital Assets Knowledge Portal
  • Purpose (Why)
    • Decentralization
      • The meaning of decentralization
      • Why decentralization matters
      • Quantifying decentralization
      • Fat protocols / Thin applications
    • Trustless
      • What do we mean by “blockchains are trustless”?
      • Hackernoon understand trustless blockchain
      • Trustless blockchains and non-custodial wallets
      • Is Bitcoin really triple-entry accounting?
    • Consensus
      • Understanding distributed consensus
      • Byzantine fault tolerance and blockchain
      • PoW vs PoS
    • Privacy
      • The case for privacy
      • A cypherpunk's manifesto
  • Applications (How)
    • Payments
      • Crypto’s evolution to a medium of exchange
      • Bitcoin’s lightning network primer
    • DeFi
      • A beginner's guide to DeFi
      • The definitive guide to DeFi
      • DeFi infrastructure 101
    • Yield Farming
      • Yield farming for serious people
      • Inside Yield Farming
      • The true sources of DeFi yield
    • Liquidity Pools (AMM)
      • AMMs deep-dive
      • What explains the rise of AMMs?
      • Angle explains: automated market makers
    • Lending
      • Decentralized lending: an overview
      • Lending and borrowing in DeFi explained
    • Staking
      • The investor’s guide to staking
      • Liquid staking with Lido
      • Liquid staking primer
    • Risk Management
      • A primer on DeFi’s risks
      • Miscalculating your impermanent loss
      • DeFi insurance
      • Hedging against impermanent loss
    • Tokenomics
      • Why I have changed my mind on tokens
      • Value of the token model
      • Understanding token velocity
    • Governance
      • Blockchain governance: Programming our future
      • Do veTokens deliver on their promise?
      • First principles of crypto governance
      • Moving beyond coin voting governance
  • Products (What)
    • Bitcoin (BTC)
      • Bitcoin: A peer-to-peer electronic cash system
      • Blockchain inside out: How Bitcoin works
      • Bitcoin for the open-minded skeptic
      • The case for a small allocation to Bitcoin
      • The bullish case for Bitcoin
      • Bitcoin's academic pedigree
      • Bitcoin: addressing misconceptions
      • Bitcoin mining and the environment
    • Ethereum (ETH)
      • Ethereum whitepaper
      • Getting up to speed on Ethereum
      • How Ethereum and smart contracts work
      • Ethereum is the forefront of digital currency
      • On staking pools and staking derivatives
    • Layer 1 (other)
      • Layer-1 platforms: a framework for comparison
      • The AMM test: a true look at L1 performance
    • Layer 2 (scaling)
      • Layer-2 for beginners
      • Making sense of rollups
      • Optimistic rollups vs ZK rollups
      • An incomplete guide to rollups
      • The complete guide to rollups
      • Overview on ZK Rollups and zkEVM
    • Stablecoins
      • Stablecoin primer intro
        • Stablecoin primer - Pt 1
        • Stablecoin primer - Pt 2
        • Stablecoin primer - Pt 3
        • Stablecoin primer - Pt 4
      • An overview of stablecoins
      • Chasing stability - a stablecoin deep dive
      • Stablecoins: designing a price-stable cryptocurrency
      • A deep dive into algorithmic stablecoins
    • CBDC
      • CBDCs: an opportunity for the monetary system
      • Central bank digital currency (CBDC) 101- A primer
    • Derivatives
      • Ramblings on DeFi derivatives
      • An explanation of DeFi options vaults (DOVs)
      • What are perpetual swaps?
    • NFT
      • A beginner's guide to NFTs
      • All digital content is going on-chain
      • Evaluating NFT financialization methods
    • Infrastructure
      • Peeking under the hood
      • Price oracle
      • Blockchain bridges
    • Metaverse
      • The Future of (Crypto) Gaming
  • Resources
    • Research
    • Tools & Analytics
    • Video
    • Podcasts
    • Newsletters
    • Institutional
    • Github
    • Telegram
Powered by GitBook
On this page
  • What is a ZK Rollup?
  • What is a zkEVM?
  • Scroll
  • Polygon Hermez
  • ZKSync
  • Starkware
  • Closing Thoughts
Export as PDF
  1. Products (What)
  2. Layer 2 (scaling)

Overview on ZK Rollups and zkEVM

https://medium.com/neworderdao/an-overview-on-zk-rollups-and-zkevm-33ee5ffb2f6a

PreviousThe complete guide to rollupsNextStablecoins

Last updated 2 years ago

Zero knowledge (ZK) tech has positioned itself as the frontrunner for scaling blockchains over the past couple of years. As scaling solutions mature, we’ve seen many ZK adaptations reveal themselves, but how these solutions work can be confusing to many. In this post we hope to demystify ZK tech so that readers can better understand the future of our industry.

What is a ZK Rollup?

A rollup is an L2 scaling solution that operates off-chain from the main L1 (in most cases Ethereum, but soon also on Celestia). This solution performs transactions off-chain, which means it doesn’t have to compete for precious blockspace on the L1. After executing the transactions, it will send a batch of transaction data (Optimistic) or proof of execution (ZK) to the L1 where it will be settled. Because of this, the layer 2 scaling solutions are secured by the same layer 1 security measures, since the data availability (DA) layer or settlement layer acts as the source of truth for the rollup.

ZK Rollups in particular are a solution that uses validity proofs to scale computation: each batch of transactions comes with a cryptographic proof (SNARKs, Kimchi, STARKs, etc) that is verified by an Ethereum smart contract — often referred to as an L2 bridge contract. This way, every single transaction is fully verified by all Ethereum full nodes before a block is finalized.

What is a zkEVM?

zkEVM is a virtual machine that executes EVM smart contracts in a way that is compatible with ZKproof computation. There are various types of zk(E)VMs, so we must distinguish between these types of solutions to a “zkEVM”:

  • EVM-compatibility = Solidity/Vyper-level compatibility

  • EVM-equivalence = EVM bytecode-level compatibility + Ethereum execution client (Geth etc)

  • Full-scale zkEVM = EVM specification-level compatibility

What they all have in common is that they add in-circuit support of EVM in their own way with various tradeoffs.

The way the these solutions work is relatively simple:

Note: Smart contract code written in high-level languages (such as Solidity/Vyper) needs to be compiled into EVM bytecode to get deployed to the Ethereum blockchain.

  • For EVM-compatibility, you transpile Solidity/Vyper code into the VM’s bytecode and then prove the validity of the execution trace in-circuit.

  • For EVM-equivalence, you transpile or interpret the EVM bytecode into your VM’s bytecode and then prove the validity of the execution trace in-circuit.

  • For a full-scale zkEVM, you prove the validity of the EVM execution trace in-circuit.

With most existing zkEVMs, such as Hermez and ZKSync, they run different bytecode through an interpreter/compiler that mirrors all the functions of EVM bytecode but is not complete EVM equivalent bytecode. Thus, EVM-compatible ZK rollups compile Solidity/Vyper into a bytecode targeting a custom VM rather than EVM.

So why does this matter? It matters because of EVM tooling compatibility and on a security trade-off level since adding extra layers of complexity adds new vulnerabilities.

Scroll

It has two main focuses:

  1. Design a circuit to link the bytecode with the real execution trace.

  2. Design circuits for each opcode (prove and write that computations in each opcode are correct).

For Scroll this is the most important part — to prove each opcode in the execution trace is correct and consistent. This means that Scroll’s focus is on building an EVM opcode for opcode zkEVM. This route has the benefit of making it extremely compatible with Ethereum and thus extremely secure, but also adds a damper on its performance — especially in regards to the proving time of their ZK proofs.

Scroll’s zkEVM will be able to prove the correctness of an execution trace extracted from Geth (Ethereum execution client in Go — widely used). Their approach is thus closely aligned with Ethereum. Because of this Ethereum alignment, it enables them to minimize additional attack surfaces (by reusing the code and sticking as closely as possible to the specification of Ethereum) while maximizing compatibility with existing tooling.

Polygon Hermez

Polygon’s design is unique since they use an interpreter that translates EVM opcodes into their own assembly language called zkASM, which is then ZK verified. This means that it is EVM-compatible, however it uses internal logic to verify EVM code.

Hermez’s approach introduces a few extra steps when executing EVM bytecode, which does add quite a surface where there could be vulnerabilities and results in it being less compatible with existing tooling than other solutions. Though, this approach is a lot more prover friendly and speeds up the proving of ZK proofs significantly.

This means that they minimize prover overhead while being somewhat compatible with Ethereum by making a few sacrifices. Thus, Hermez will be compatible with most EVM applications and only require some re-writing for a few outliers that use things such as pre-compiles which Hermez doesn’t inhabit.

ZKSync

ZKSync’s and Polygon Hermez’s approach to building their zkVM is quite similar. They both aim for EVM-Compatibility, which is Solidity/Vyper compatibility.

Instead of Scroll’s approach where you take your Solidity smart contracts and compile them into EVM Bytecode, you instead take your Solidity code and compile it into zkSync Bytecode. The bytecode of this virtual machine is a different bytecode. For a developer this doesn’t make much of a difference, however, it does add some hurdles and possible vulnerabilities in the system, same as with Hermez. Regardless, you still just take your code, compile it, and get some bytecode which is then deployable. This bytecode is optimized to be run in ZK systems. This means that ZKSync supports solidity at the source code level.

This has the advantage of causing very fast ZKP proving times as the specific language/VM in question is very ZK friendly and therefore you can minimize overhead and increase performance.

ZKSync is also working on a validium solution for their DA, which is called ZKPorter: that holds calldata and provides data availability — essential transaction data needed to reconstruct state off-chain rather than on Ethereum. Instead, the data remains available using PoS that signs off on signatures, where stakers are zkSync token holders.

They are the closest to mainnet launch, which will happen in the next few months.

Starkware

Closing Thoughts

It’s clear that regardless of which zkEVM you find most interesting, they all make various trade-offs for gains whether that’s in regards to compatibility or performance. Some of them value having more EVM compatibility than performance, while others prefer performance over compatibility.

At the end of the day, it’s up to the developers of applications to decide on what is right for their specific application. As such, there’s a place for several different types of solutions to the same problem, which is making zkEVMs that are fit for a specific product type. This means that in all likelihood you’ll see several ZK Rollups succeed in their specific market fit, just like how we’ve seen specific L1s find their own market fit.

With this in mind, let’s utilize Vitalik’s that plots in the various types of zkEVMs and plugs in the existing solutions:

The core part of Scroll is their , which is used to prove the correctness of EVM execution on their ZK rollup. They have been building it in tandem with the Privacy and Scaling Explorations (PSE) group at the Ethereum Foundation (who are also working on a ZK-EVM that strives to be fully Ethereum-equivalent).

Nethermind’s project is building a compiler from Solidity to Starkware’s Cairo, which will turn StarkNet into an “EVM-compatible” system through compiling. However, it’s worth mentioning that for now Starkware uses a specialized zkVM with its own domain-specific language (Cairo) that is friendly to building applications on zkVMs.

diagram
zkEVM
Warp