Whether eWASM is the future of EVM

The Ethereum Virtual Machine (EVM) is a key component of the Ethereum platform. It is a sandboxed runtime environment in which smart contracts are executed. A smart contract is a self-executing program stored on the Ethereum blockchain and runs when certain conditions are met. The key benefit of the EVM is that it ensures that smart contracts are executed in a secure and reliable manner. The EVM has many security features, such as gas limits and opcode restrictions. However, the main shortcoming of EVM is, currently it supports only a limited set of programming languages, such as Solidity and Vyper. This can limit the variety of applications built on the Ethereum network and make it challenging for developers to work with. In such case, eWASM can be a good alternative of EVM.

Concept behind eWASM

The concept behind eWASM is WASM. WASM stands for WebAssembly, which is a low-level binary format designed as a portable target for the compilation of high-level programming languages. It is designed to be a safe, fast, and platform-agnostic format that can be used on the web and beyond.

WASM is a stack based virtual machine, also called WASM Engine, designed to run in web browsers alongside JavaScript. It allows developers to run code at near-native speeds in a browser, making it an attractive option for performance-critical applications like games and video processing. WASM engines are typically embedded in web browsers, allowing web pages to run WebAssembly code. Still, they can also be standalone runtimes for executing WebAssembly code outside of a web browser. Examples of WASM engines include V8 (used in Google Chrome), SpiderMonkey (used in Mozilla Firefox), and Wasmtime (a standalone runtime).

One of the key benefits of WASM is that it allows developers to write code in any language and compile it to the WASM format, which can then be executed in a browser. This enables developers to leverage the strengths of different programming languages and libraries to build more complex applications.

WASM also offers better performance compared to JavaScript for certain types of applications. This is because WASM code is compiled ahead of time, rather than interpreted at runtime, and can be optimized for specific hardware architectures.
F16Fig
Figure: Workflow diagram of WASM

WebAssembly modules(.wasm) can be loaded into web pages and run in the browser using JavaScript. The JavaScript glue code is responsible for loading the WebAssembly module, instantiating it, and providing access to its exported functions and data as shown in the figure. The JavaScript glue code can be written manually, but tools can also automate this process. For example, the Emscripten toolchain can compile C and C++ code to WebAssembly and generate the corresponding JavaScript glue code. This makes it easier for developers to integrate WebAssembly modules into their web applications without writing low-level code themselves.

eWASM stands for Ethereum WebAssembly, a new virtual machine (VM) designed for the Ethereum blockchain. eWASM is an upgrade to Ethereum’s existing virtual machine (EVM) and is intended to improve the efficiency, security, and flexibility of the Ethereum network. It is designed to be compatible with existing Ethereum smart contracts. It allows developers to write contracts in languages other than Solidity, such as C++, Rust, and TypeScript, and compile them to eWASM.

With eWASM, developers can write smart contracts in languages other than Solidity or Vyper and still be able to deploy them on the Ethereum blockchain. This opens up a whole new world of possibilities for Ethereum developers and could lead to greater adoption of the Ethereum platform.

The eWASM project is under development and is expected to be integrated into the Ethereum ecosystem in the coming days.

Reference:

[1] https://ethereum.org/en/developers/docs/evm/

[2] https://webassembly.org/

[3] https://ewasm.readthedocs.io/en/mkdocs/

[4] Zheng, Shuyu, et al. VM Matters: A Comparison of WASM VMs and EVMs in the Performance of Blockchain Smart Contracts. 2020. DOI.org (Datacite), https://doi.org/10.48550/ARXIV.2012.01032.

1 Like