Author:PSE Trading Analyst @cryptohawk
A virtual machine is a software simulation computer system that provides an execution environment for programs. It can simulate various hardware devices and allow programs to run in a controlled and compatible environment.
The Ethereum Virtual Machine (EVM) is a stack-based virtual machine used to execute Ethereum smart contracts; zkEVM has made certain zk-proof generation efficiency optimizations in terms of EVM equivalence/compatibility;
zkVM abandons EVM equivalence/compatibility and increases the priority of zk-friendliness;
Privacy zkVM superimposes native privacy features on zkVM;
SVM, FuelVM, and MoveVM have in common the pursuit of ultimate performance through parallel execution, but they have their own characteristics in design details;
ESC VM and BitVM have conducted certain innovative computing layer experiments on the ETH and BTC chains respectively, but the actual demand for implementation is low in the current environment.
EVM’s huge user ecosystem determines that any blockchain network that abandons it will be difficult to compete with it in the short term. Therefore, the non-EVM ecosystem introduces EVM ecological users through translators/compilers/bytecode interpreters and even VM compatibility layers. Using non-EVM virtual machine features to build a new ecological narrative may be a necessary path to success.
A virtual machine (VM) is a building block of virtualized computing resources that performs almost the same functions as a computer, including running applications and operating systems. The concept of virtual machines is not new, and the technology is widely used in many technology ecosystems.
In the context of blockchain, a virtual machine (VM) is a piece of software that runs programs, often referred to as the runtime environment that executes blockchain smart contracts. Virtual machines usually provide a virtual computer environment by simulating different hardware devices. The hardware devices that different virtual machines can simulate vary, but usually include CPU, memory, hard disk, network interface, etc. When an on-chain transaction is submitted, the virtual machine is responsible for processing the transaction and updating the blockchain state (the current global state of the entire network) affected by the execution of the transaction. The specific rules for changing network status are defined by the VM. When processing a transaction, the VM converts the smart contract code into a format that the node/validator hardware can execute.
The most important kernel among VMs is LLVM (low-level-virtual-machine), which can be regarded as the most important kernel of the compiler. The picture shows the original EVM operation scheme. The smart contract is converted through the intermediate code of LLVM IR and converted into Bytecode. These Bytecodes will be stored on the blockchain. When the smart contract is called, the Bytecode will be converted into the corresponding Opcode, and then executed by the EVM and node hardware.
Top projects: Optimism, Arbitrum
As the blockchain ecosystem with the most active developers & users in the industry, the Ethereum Virtual Machine (EVM) is a stack-based virtual machine that provides a virtual computer by simulating hardware devices such as CPU, memory, storage and stacks. Environment to execute the instructions of the smart contract and store the status and data of the smart contract. The instruction set of the EVM includes various opcodes, such as arithmetic operations, logical operations, storage operations, jump operations, etc.
The memory and storage simulated by EVM are devices used to store the state and data of smart contracts. EVM treats memory and storage as two different areas, and it can access the state and data of smart contracts by reading and writing memory and storage.
The EVM simulated stack is used to store the operands and results of instructions. Most instructions in the EVM's instruction set are stack-based, reading operands from the stack and pushing the result back onto the stack.
The design process of EVM is obviously bottom-up. First, the simulated hardware environment (stack, memory) is finalized, and then its own set of assembly instruction set (Opcode) and bytecode (Bytecode) are designed according to the corresponding environment. . The Ethereum community has designed two compiled high-level languages—Solidity and Vyper—for EVM execution efficiency. It goes without saying that Solidity needs to be emphasized. Vyper is an EVM high-level language designed by Vitalik to improve some of the defects existing in Solidity. However, it did not gain high adoption in the community and gradually faded out of the stage of history.
Top projects:Taiko、Scroll、Polygon zkEVM
Since EVM was not built with zk-proof computations in mind, it has characteristics that are unfriendly to proof circuits, especially in terms of special opcodes, stack-based architecture, storage overhead, and proof costs. zkEVM is a virtual machine that executes smart contracts in a way that is compatible with zk-proof calculations, so that the execution process of EVM can be verified more efficiently and cost-effectively through zk-proof/validity-proof. Compared with OP Rollup, the execution layer only needs to copy EVM, and building EVM to be ZK-friendly is an additional challenge for ZK Rollup.
ZK-rollups are not easily compatible with the Ethereum Virtual Machine (EVM). Proving general-purpose EVM computations in a circuit is more difficult and resource-intensive than proving simple computations (such as the token transfer described previously).
However, advances in zero-knowledge technology (opens in a new tab) have reignited interest in wrapping EVM computations in zero-knowledge proofs. These efforts aim to create a zero-knowledge EVM (zkEVM) implementation that can efficiently verify the correctness of program execution. .
Like EVM, zkEVM transitions between states after performing computations on certain inputs. The difference is that zkEVM also creates zero-knowledge proofs to verify the correctness of each step in program execution. Validity proofs verify the correctness of operations involving the virtual machine state (memory, stack, storage) and the computation itself (i.e., did the operation call the correct opcodes and execute them correctly?).
The idea is beautiful, but the reality is very skinny. Currently, it is difficult for Rollup to achieve both ZK friendliness and EVM compatibility (or even equivalence), that is, it must either copy the Ethereum L1 execution layer as completely as possible, including hash, state tree, and transaction tree. , precompilation, etc., so that the Ethereum L1 execution client can be used as-is to process Rollup blocks; or discard EVM compatibility and recreate the existing Opcode for in-circuit attestation/verification, allowing smart contract execution .
Top projects:Starknet、Zksync、RISC ZERO
zkVM abandons EVM compatibility, takes data proof and status update as its core goals, and finds a common denominator between cryptography and high-level languages to provide a common framework for various applications.
Since Starkware started earlier in the entire ZK field, it has accumulated sufficient technology and has a certain technological lead. It is a representative ZK-centric technical architecture and built Cairo VM and Cairo language around ZK. The disadvantage is that the learning cost of Cairo is relatively high.
The framework of ZKsync is compatible with the characteristics of EVM and ZK, integrating Solidity with its self-developed circuit language Zinc, and unifying the two at the IR level within the compiler. The advantage is that the LLVM of the compiler core is compatible with multiple languages.
RISC Zero uses the RISC-V architecture to build a simulator that allows programmers to write programs for zkVM using common languages such as Rust, C/C++ and Go. This means that application logic does not need to be limited to what can be expressed in Solidity, allowing writing and chaining Irrelevant code.
Top projects:Aleo、Ola、Polygon Miden
Blockchain serves as a public ledger system, and all transactions are conducted on the chain, which means that state changes containing asset information related to addresses or accounts are open and transparent. Therefore, in addition to working on scaling solutions, some blockchain teams believe that the next key feature to be implemented is privacy.
In addition to being zk-friendly and supporting expansion, Privacy zkVM also allows upper-level application developers to develop privacy-related dapps due to the privacy features natively supported by its own programming language. This will bring new application scenarios and grand narratives. For example, completely solve the MEV problem and protect user data ownership. Of course, the complexity of Privacy zkVM design requires a larger technical team to implement it, and it may take several years to achieve it.
Top projects:Eclipse Mainnet、Nitro、MakerDAO Chain(maybe)
SVM, the Solana virtual machine, focuses on a high-performance execution environment, and smart contracts are mainly written in the Rust language. Compared with the single-threaded EVM and EOS WASM execution environments, by requiring Solana transactions to describe all states that a transaction will read or write when executing, SVM implements concurrent execution of non-overlapping transactions and transactions that only read the same state.
Additionally, to enable fast verification/broadcasting of large transaction blocks, the transaction verification process on the Solana network makes extensive use of pipeline optimizations common in CPU design. In order to satisfy the situation where the input data flow is processed in a series of steps and each step has different hardware responsible for it. A typical analogy is a washer and dryer that wash/dry/fold multiple loads of laundry in sequence. Cleaning must be done before drying, and folding must be done before drying, but each of these three operations is performed by a separate unit.
In addition, SVM is register-based and has a much smaller instruction set than EVM, making the execution of SVM easier to prove in ZK. For optimistic rollups, a register-based design makes it easier to set checkpoints.
Top projects:Fuel
Fuel VM is an improvement based on the technical framework of EVM, Solana, WASM, BTC & Cosmos. Compared with EVM, it has the following characteristics:
The most unique thing is that Fuel not only sets access lists similar to SVM, but also has the ability to execute transactions in parallel with non-overlapping transactions. It also adopts the UTXO model, which is divided into token UTXO and contract UTXO, further improving access efficiency and computing throughput.
In addition, Fuel VM provides a powerful and smooth developer experience through its own domain-specific language Sway and supporting tool chain Forc. Its development environment retains the advantages of smart contract languages such as Solidity, while adopting the paradigm introduced in the Rust tool ecosystem.
In the future, Fuel VM will also implement Sway language upgrades, including compiler optimization in terms of bytecode size, Sway will support more backends (the EVM backend is already under development), abstraction will be more economical, and more applications will be available. Migrating from Solidity/Vyper to Sway, improving compiler-level reentrancy analysis, etc.
Top projects:Ethscriptions Protocol
ESC VM, or Ethscriptions Virtual Machine, is a smart contract solution proposed by Ethscriptions Protocol. The Ethscriptions Protocol itself is a protocol similar to BTC Ordinal on the Ethereum chain, focusing on exploring low-cost alternatives different from smart contracts and L2.
Ethscriptions allow users to bypass smart contract storage and execution at extremely low cost, by applying the protocol rules agreed in advance to the calldata in Tx for calculation. To put it simply, as long as there is a successful Ethereum transaction and its calldata complies with the specified valid data specifications & the unique & "to" address is not 0, it can be considered that an Ethscription has been legally created, and the "from" address is the creator, " to" address is the owner.
At the beginning of the design, each Ethscription prefers the form of NFT, such as picture NFT. The picture content is directly written into the calldata in Base64 format:
ETHS is kind of Ethscription created with reference to the brc-20 protocol specification:
The smart contract introduced by ESC VM is called a "Dumb Contract". It is published as a logical contract, but it does not interact on the chain in the form of EVM. In addition, ESC VM also adds a special format "computer command". Ethscriptions created using this format will be recognized by ESC VM and interact with dumb contracts, such as Deploy - deploy dumb contracts, Call - invoke dumb contracts.
This solution has some limitations. First, the function of the "dumb contract" is not payable. That is to say, if you want to send ETH through the dumb contract, you must go through a "bridge contract", and the "bridge contract" itself involves abuse of control rights. & Risk of asset theft; second, there are entry barriers to the ecosystem, which does not allow arbitrary creation of dumb contracts, and its code needs to be defined through the Ethscriptions Protocol governance proposal.
To sum up, ESC VM is a computing layer built on top of Ethereum L1 as the data storage layer. It is implemented by placing contract logic, contract calls, contract calls and other data contents in the calldata of Ethereum tx. ESC VM The global state consensus is the ESC VM client consensus, which is similar to Arweave's SmartWeave implementation logic, except that the data storage layer of SmartWeave is Arweave.
1.2.8 Bit VM——An interesting research experiment: peer-to-peer execution channels on top of BTC
Top projects:ZeroSync
ZeroSync founder Robin Linus released a white paper "BitVM: Compute Anything On Bitcoin" on October 9. To be precise, it is not a VM, but an attempt to create a Turing-complete computing space whose contracts are stored in Bitcoin. On-chain, but the logic of the contract is executed off-chain. If you believe that the other party has breached the contract, you can initiate a challenge on the chain. If the other party cannot respond correctly, you can take away all the funds in the contract.
The advantage is that Bitcoin can be given Turing completeness without any modifications to the Bitcoin protocol, no new opcodes, no soft forks, and it can be applied at any time.
Its shortcomings are also obvious. First, it only supports transactions between two parties (one party certifies and one party verifies). Second, creating a contract requires creating a large amount of data and pre-signing a large number of transactions. The cost of off-chain information storage is huge.
The following is a brief introduction to the technical logic:
(1) Bit value commitment
Bit value commitment allows the prover to set the input value 0 or 1 for the logic gate. In this commitment, there are two hash values H (A0) and H (A1). The prover needs to reveal a hash preimage, such as A0, then Set the input value to 0, and if A1 is revealed, set the input value to 1.
(2) Logic gate commitment
Once you have the input value, you can combine any logic gate in Bitcoin script by combining Bitcoin's AND, NOT and other opcodes.
(3) Binary circuit commitment
Turing completeness can be achieved by composing hundreds of millions of logic gates into a binary circuit. In order to commit this binary circuit to the Bitcoin network, all logic gates need to be placed into a leaf node at a Taproot address.
(4)Challenge and responses phase
It is not enough to commit the circuit on the chain. Both parties need an effective way to verify that the calculation results of the contract are correct. In an ideal world, the contract runs off-chain, and both parties are happy if they are cooperative and have no dispute over the outcome. However, if there is a dispute between the two parties of the transaction, they need to enter the challenge-response link to verify the calculation results and force the channel balance to be distributed through Bitcoin scripts.
Therefore, BitVM is far from being some kind of Bitcoin Rollup or L2, does not have a complete virtual machine execution environment, global state, high-level language for publishing complex smart contracts, nor does it allow any number of users to easily interact with these contracts. Let’s use a very popular example to illustrate: BitVM is like building a giant computer that is larger than a room in an era when everyone can use a mobile terminal.
Top projects:Aptos、Sui
Move is a programming language for writing secure smart contracts. It was originally developed by Facebook to provide support for the Diem blockchain. After the Diem blockchain project was suspended, projects represented by Aptos and Sui continued to use the Move language. . The biggest feature of the Move blockchain is that data storage uses global storage, consisting of a tree rooted at an account address. Each address can store resource data and module code.
Move has two different types of programs: modules and scripts. Modules are libraries that define structural types and functions that operate on these types. The structure type defines the global storage mode of Move, and the module function defines the rules for updating storage. The modules themselves are also stored in global storage. The script is the entry point of the executable file, similar to the main function in traditional languages, and is a temporary code fragment that is not published in global storage.
In summary, the Move module is similar to the dynamic library module loaded when the system executable file is run, while the script is similar to the main program. Users can write their own scripts to access global storage, including calling modules, while publishing modules or executing scripts operate through the Move VM.
Now that the EVM network effect is so powerful, the migration of EVM users to non-EVM chain ecology has become the biggest growth point for emerging blockchain projects. This will bring more Dapp composability and greater connectivity in the future. Several years trigger faster user growth.
Onboarding EVM users to non-EVM chains has historically been a major barrier, but the recently launched Metamask Snap will break that barrier. EVM users can continue to use MetaMask without switching wallets. Thanks to Drift's open source contributions to building the excellent MetaMask Snap implementation, the UX is equivalent to interacting with any EVM chain. Eclipse mainnet users will be able to interact with native applications in MetaMask, or use Solana native wallets such as Salmon.
1.3.2.1 Translator/Compiler
Top projects:Wrap
Warp is a Solidity-Cairo translator that has been developed by Nethermind, a well-known Ethereum infrastructure team. Warp can translate Solidity code into Cairo, but the translated Cairo program often needs to be modified and added with Cairo features (such as calling built-in functions, optimizing memory, etc.) to maximize execution efficiency.
1.3.2.2 Bytecode interpreter/VM compatibility layer
Top projects:Kakarot、Neon EVM
Kakarot is an EVM bytecode interpreter written in Cairo and implemented in the form of smart contracts deployed on Starknet. It simulates the stack, memory, execution and other aspects of EVM in the form of Cairo smart contracts. Compared with code translation, Kakarot implements the step-by-step implementation of Opcode and Pre-compile behind EVM, and builds components such as Account Registry and Blockhash Registry to perform additional processing on account address mapping, block information acquisition, etc., giving kakarot more capabilities. High native compatibility.
Neon EVM is an EVM that runs as a smart contract and can be deployed on any SVM chain. The Eclipse mainnet itself uses SVM as the execution environment, but brings full EVM compatibility (including EVM bytecode support and Ethereum JSON-RPC) through Neon EVM, and has higher throughput than single-threaded EVM. In addition, each Neon EVM instance has its own local fee market, that is, there is an upper limit on the computing units related to single contract account interaction at a block height (1/4 of the block computing units), so users only need to interact with specific hot contracts Or you need to pay a priority fee when the block is full. In this sense, applications deploying their own contracts can obtain the advantages of an application chain, thereby reducing the damage to the user experience, security or liquidity of the entire network caused by interaction tx congestion of a specific contract.
Reference:
1.“Kakarot: Exploring Starknet’s EVM Compatibility Road”,by Cynic & Starknet Astro, https://www.panewslab.com/zh/articledetails/o211e2kv.html
2. “BitVM arouses heated discussion, can the Bitcoin network achieve Turing completeness?”,by Haotian, https://foresightnews.pro/article/detail/44853
3. https://ethereum.org/en/developers/docs/evm/
4. "Starkware technical architecture and ecological review",by Maxlion, https://community.dorahacks.io/t/starkware/272
5.https://twitter.com/muneeb/status/1712461799327416491
6. "Project Research丨Modular High-speed Execution Layer Fuel Research Report",from Web3CN, https://www.panewslab.com/zh/articledetails/10v5xkx8.html
8.https://docs.ethscriptions.com/overview/introducing-ethscriptions
9. “Analysis of the First Critical Vulnerability of Aptos Move VM”,by Numen Cyber Labs, https://medium.com/numen-cyber-labs/analysis-of-the-first-critical-0-day-vulnerability-of-aptos-move-vm-8c1fd6c2b98e
10. https://ethereum.org/en/developers/docs/evm/
11.“What Is SVM - The Solana Virtual Machine”,by Squads, https://squads.so/blog/solana-svm-sealevel-virtual-machine
12.“Introducing Eclipse Mainnet: The Ethereum SVM L2”,by Eclipse, https://mirror.xyz/eclipsemainnet.eth/me7bXLWJDS177V6nl8j1uzF1mxpX6nbGOLNeyBAwXgs
13. https://john-hol.gitbook.io/bitvm/
14. https://bitvm.org/bitvm.pdf
15.“The different types of ZK-EVMs”,by Vitalik Buterin, https://vitalik.eth.limo/general/2022/08/04/zkevm.html 16. "Cipholio Research Report: Talking about ZkVM's solutions and future",by YOLO SHEN,Cipholio Ventures, https://web3caff.com/zh/archives/11666