What's the difference b/w WASM and EVM?


I have been reading a lot about teams using WASM instead of EVM for their blockchain. What is WASM? What is EVM? And what makes WASM better than EVM?

This is my understanding: WASM (Web Assembly) is a very low-level language that’s similar to Bytecode, the low-level input to EVM (ethereum virtual machine). The difference is WASM can be compiled from multiple languages like Go, C, Rust, Javascript etc whereas Bytecode is just from solidity or Viper. People who are trying to use WASM are creating VM like thing that will replace EVM for running smart contracts on blockchain.

My understanding is like swiss cheese, it has a lot of holes. Looking for someone to explain it in depth.


The EVM is an extremely simplistic virtual machine. It was mainly optimized to have a small number of operations and be relatively easy to apply gas metering on. EVM instructions are interpreted by the Ethereum runtime. The EVM was not designed to be efficient on commodity hardware with features like 256 bit register values that don’t map to any conventional machine architecture.

WebAssembly is an architecture independent low level language with a very simple memory model that was originally design to meet the needs of web browsers to run programs supplied by untrusted websites where javascript was a bad fit. While the needs of blockchains are pretty different from browsers, web assembly also caught the attention of the serverless cloud application community. Their needs are much more similar to the needs of blockchain developers. WebAssembly is designed to be compiled by the actual platform into efficient machine code and executed or it can interpreted. WebAssembly will frequently generate as efficient code as if the program was directly written for the platform.

Webassembly has become a first class target for a number of different programming languages like C++, Rust and Go. It also supports standard ways of injecting runtime features into the environment.


Thanks for the explanation. :slight_smile: