Gate Alpha 2nd Points Carnival Round 4 Hot Launch! Trade to Share $30,000 MORE & Alpha Points
Trade $MORE to unlock Listing Airdrops + $300K Points Prize Pool!
💰 Total Airdrop Volume: $30,000 MORE, Limited slots—first come, first served!
✅ Total Points: 2 Alpha Points per trade—accumulate points to share the $300K prize pool!
🔥Trade the Hottest On-Chain Assets First
For more information: https://www.gate.com/campaigns/1342alpha?pid=X&c=MemeBox&ch=vxDB0fQ5
Detailed proof of validity Rollup and Cairo VM technical characteristics
Original: Scaling Ethereum Efficiently
Translation and proofreading: "Starknet Chinese Community"
overview
Rollups were a hot topic this year about scaling Ethereum. Among various types of Rollup, we believe that Validity Proof Rollup (hereinafter referred to as VR, or zk-rollup) is the most promising expansion solution to increase the throughput of Ethereum in a safe and decentralized way. The core of this expansion scheme is the use of validity proofs for verifiable calculations. Here's how it works:
Validity Proof Rollup
Please note: Proof of Validity Rollups are often mistakenly called Zero-Knowledge Rollups (zkRollup), which is not accurate. Most Validity Proofs Rollup does not employ zero-knowledge proofs, nor are they used to ensure privacy. Therefore, the term "Validity Proof Rollup" is more accurate.
off-chain virtual machine
Before we go any further, we need to answer the first question: what is a virtual machine (VM)? In short, a virtual machine is an environment in which programs can run, such as a Windows operating system running on a Mac. The VM transitions between states after performing computations on some input. The Ethereum Virtual Machine (EVM) is the VM that runs Ethereum smart contracts.
A zero-knowledge virtual machine (zkVM) is a program execution environment that, together with program output, generates easily verifiable proofs of validity. Proof of validity is used to prove that a program has been executed correctly. When the term "zkEVM" is used, it usually refers to a Rollup that runs the Ethereum Virtual Machine (EVM) and can attest to the execution of the EVM. This terminology can be misleading because the EVM itself cannot generate these proofs; instead, the proofs are produced by a separate prover mechanism that takes the result of the EVM's execution as its starting point. In addition, the above proofs are all related to validity and have nothing to do with privacy. Therefore, it cannot be called a zero-knowledge proof to be precise. For consistency, the traditional term "zkEVM" is still used in this article.
While all Proof-of-Validity Rollups aim to scale Ethereum with Proof-of-Validity, different schemes make different choices about how the VM executes off-chain transactions. Many proofs of validity Rollup chose to replicate the EVM design (hence the name "zkEVM rollup"), attempting to replicate Ethereum on an L2 rollup. Starknet uses Cairo VM (CVM), a brand new VM designed to optimize the efficiency of proof of validity.
The above two methods have their own advantages and disadvantages and trade-offs, but zkEVM sacrifices performance for Ethereum compatibility, while Cairo VM puts performance above compatibility and prioritizes scalability.
Understand how zkEVM works
zkEVM is a proof-of-validity rollup designed to fully introduce the Ethereum experience on the L2 blockchain. The purpose is to replicate the Ethereum developer environment into Rollup. With zkEVM, developers do not need to adjust the code or abandon the original EVM tools (and smart contracts) when writing or porting smart contracts to expansion solutions.
This approach has a key flaw, which reduces the scalability of validity proofs. Due to the focus on being compatible with Ethereum, zkEVM is slower and more resource intensive. Unlike CVM, EVM is not designed with proof efficiency in mind. This limits the use of optimizations in improving efficiency and scalability, ultimately affecting the overall performance of the system.
Provability of the EVM
The core challenge of the zkEVM approach lies in the ingrained original blueprint of the EVM, which was not originally designed to run in a proof-of-validity environment. Therefore, if all the effort is put on realizing the functions of Ethereum, the full potential of the validity proof cannot be released, resulting in unsatisfactory efficiency. This inefficiency ultimately drags down the overall performance of the system. Compatibility of EVM with validity proofs is hampered by:
Therefore, various types of zkEVM are designed to provide different levels of support for Ethereum tools, but the higher the compatibility of zkEVM with Ethereum, the lower the performance. (see end of article for more zkEVM types)
Understand how Cairo-VM works
The zkEVM solution has invested a lot of development time in "making EVM suitable for Validity Proof Rollup", prioritizing compatibility over long-term performance and scalability. There is another option: adopt a new dedicated virtual machine, and add an additional layer to support Ethereum tools. That’s the step Starknet is taking, launching a permissionless proof-of-validity Rollup in November 2021. Starknet is the first proof-of-validity Rollup that implements a general-purpose smart contract platform in a fully composable network.
Starknet adopts Cairo-VM (CVM) and creates the high-level language Cairo of the same name. Cairo-VM is designed for efficient generation of validity proofs of program execution.
With Cairo (VM and programming language) it is possible to:
Developing a completely new language can be tailored to specific needs, can include features that were not available before, and meet new needs.
Cairo and coding pluralism
In order to create a proof of the validity of some computation, that computation must first be expressed as a series of mathematical constraints describing the computation. The process is complex, the difficulty lies in optimizing calculations for efficiency, and specific tools are required.
The Cairo language was designed to simplify this task so that StarkEx can easily add functionality and complex business logic. Cairo programs are compiled into algebraic machine code, a sequence of numbers, executed by a single, fixed VM. With Cairo, the complex process of generating mathematical constraints describing computations (very tricky for validity proofs) is abstracted and expressed as a fixed set of constraints (less than 50 constraints in total). This allows developers to extend applications with validity proofs by writing code in a familiar syntax without understanding the underlying mathematics and infrastructure.
Starknet's commitment to innovation is evident in its approach to code pluralization. Cairo adopts STARK technology to achieve optimal extension functions, not limited to writing contracts with Cairo local environment. Developers can also choose the most suitable method:
Although Cairo has not been around for a long time, according to TVL rankings, Cairo is the fourth most popular smart contract programming language, with a valuation of over $350 million.
Summarize
zkEVM aims to replicate the Ethereum developer environment into Rollup and allow developers to use familiar Ethereum tools. But this approach limits the potential for validity proofs and is resource intensive.
The Cairo VM, designed for validity proofs, is not subject to the limitations of the EVM. Cairo VM supports Cairo 1.0. Inspired by the Rust language, Cairo 1.0 is more in line with developer habits and safer, forming a powerful tool designed to use STARK to prove efficient expansion of Ethereum.
It's exciting to see how Cairo develops every week, and the options for developers like Kakarot zkEVM and Warp are growing. With Starknet dApps in production, demonstrating the power of Cairo, we firmly believe that in the future, Cairo will spawn outstanding projects that have never been seen before.
Three paths for SATRK expansion have been outlined above, and there will no doubt be more innovations to come in the coming months. Developers now have unprecedented control over scaling blockchains.
zkEVM type
Vitalik divides zkEVM into four main types: