Aleph Zero Blog

Fundamentals: WASM vs. EVM and Why Aleph Zero Explores the New Frontier

Apr 13, 2023

Smart contracts are now active on Aleph Zero Mainnet. Let’s understand WASM and EVM, the main runtime environments enabling this tech to function on the blockchain.

Smart contracts are one of the more exciting developments of recent years, allowing users to create personalized use cases whose execution is bereft of any kind of institutional intermediary or middleman. 

These contracts are pieces of specialized code that can be executed by users on demand. For example, two parties can potentially engage in an exchange of real estate through the help of a smart contract.

In this scenario, the smart contract will stipulate all of the requirements for the deal to be concluded. Once the pre-decided conditions occur, the property will change hands. The whole process will be completed and finalized by applying the smart contract without involving any real estate brokers, lawyers, or banks. 

In order to make smart contracts possible, it is necessary to employ a runtime environment known as virtual machines in which they can be executed. We’ll explore the two most popular ones, the Ethereum Virtual Machine (EVM) and WebAssembly (WASM). 

The Building Blocks of Smart Contracts

Before we dive into the whole debate on EVM versus WASM, we should explain the mechanism that makes smart contracts feasible. This mechanism consists of the following elements:

  1. The smart contract language in which the contract is written, e.g., Solidity, Vyper, ink!;
  2. The compiler translates the code into the actual smart contract. This list of instructions that inhabits the smart contract is called the bytecode and must follow a certain standard to be executable. These rules are pre-established in the virtual machine standard; 
  3. This bytecode is finally uploaded to the blockchain, where it is stored. When a user performs a smart contract call, the corresponding piece of bytecode is loaded into the execution environment (a virtual machine able to execute that particular type of bytecode), where the instructions constituting that call are executed.

The Languages Behind Smart Contracts 

Solidity is one of the programming languages through which we can code smart contracts.


Solidity is one of the programming languages through which we can code smart contracts. It is the foundation upon which the Ethereum blockchain is built and is the most popular smart contract language currently in use. Some of the pros of Solidity are as follows: 

  • Solidity offers inheritance properties for their contracts, including multiple-level inheritance properties;
  • It is arguably easier to learn than an eDSL (embedded domain-specific language) like Ink! due to Solidity’s similarity to other popular high-level languages.
  • A wide selection of type-safe functions are supported in Solidity by facilitating ABI (Application Binary Interface);
  • It is the default smart contract programming language when working within the Ethereum blockchain, as it was designed solely with the purpose of working with Ethereum. This translates into considerable support from a large community that worked through many of the initial bugs and provided a more user-friendly / dev-friendly environment.
The Aleph Zero smart contract pallet takes advantage of ink!, a Rust-embedded domain-specific language (eDSL) that compiles to WASM.


The Aleph Zero smart contract pallet, takes advantage of ink!, a Rust-embedded domain-specific language (eDSL) that compiles to WASM. This language was developed particularly for writing smart contracts for the FRAME Contracts pallet developed by Parity Technologies. 

The main advantage of ink! is that it provides an immensely open ecosystem for developers because it simply expands on Rust instead of creating a novel language from scratch. This makes it easier for veterans and newcomers to begin creating smart contracts without delay. 

Besides employing ink!, Aleph Zero employs the cargo-contracts solution proposed by Parity Technologies, a CLI tool that helps you develop smart contracts in ink! 

Here are the main reasons why we opted for ink!: 

  • Ink! possesses type and memory safety, which prevents overflows from occurring;
  • Existing tools for Rust work for ink!;
  • Existing libraries may be used if they can be compiled with the no_std feature – this is one of the bigger advantages of ink!;
  • Inheritance by using Rust’s traits.

What is EVM?

EVM is a custom solution designed by Dr. Gavin Wood that permits the Ethereum blockchain to host smart contract functionalities. From a technical perspective, the EVM call stack has a depth of 1024 items, and each item is a 256-bit word. 

Profound implications arise from these numbers as the 1024 item ceiling means that there are limits on the complexity of EVM smart contracts. What makes matters more complicated is that all operations are 256-bit, which means that our processors, which are usually 32- or 64-bits, need to simulate these 256-bit instructions using their actual register sizes (32/64-bit). The important consequence of this fact is the performance penalty that comes with the need for such a simulation. 

EVM faces a challenge because it can only convert a few languages other than Solidity to bytecode. Additionally, few people widely use these languages. If someone wants to use a different language in this system, they will have to make a compiler. This limits the expandability of the solution proposed by EVM

Apart from simple smart contracts, Ethereum’s own system has started to show its limits in the past few years. Ethereum is the second biggest blockchain system worldwide. Many developers create apps on their network, which is a good thing. This has resulted in a healthy ecosystem for developers working with EVM and Solidity.

The main competitor to EVM is WASM, which is a portable binary-code format and corresponding text format for executable programs.

Introduction to WASM

WASM is the main competitor to EVM. It is a portable binary code format and text format for executable programs. The developers designed it as a versatile platform for making web applications. It does not assume anything about the web or provide web-specific features.

The platform is adaptable to suit different needs. It offers flexibility for developers to create various types of web applications. This makes it perfect for applying it in a wide range of scenarios. 

The W3C workgroup provides ongoing support and development for this environment, showing its quality. Companies involved in the WC3 workgroup include such household names as Google, Mozilla, Apple, and others.

The Reasons Aleph Zero Uses ink! and WASM

One of the main advantages of WASM is the flexibility it offers smart contract developers regarding language choices.

A Technical Analysis of WASM

One of the main advantages of WASM is the flexibility it offers smart contract developers regarding language choices. This impressive list includes Rust, C/C++, C#, Typescript, Haxe, and Kotlin. Such a selection allows developers to write smart contracts in whichever language they are most comfortable with. 

An interesting twist involves the fact that there are tools (Solang) that can compile Solidity to WASM, so one could in principle, write Solidity contracts on Aleph Zero. The team behind Aleph Zero has been working in Rust for several reasons, including its lack of runtime overhead and its inherent security properties. 

The pros of WASM are as follows: 

  • It is memory-safe, sandboxed, and platform-independent;
  • The environment possesses 64 and 32-bit integer operation support that maps one-to-one with CPU instructions;
  • Floating point operations have been removed, which is necessary to enforce deterministic execution;
  • It is supported by the LLVM compiler infrastructure project. This means that WASM takes advantage of over a decade of LLVM’s compiler optimization.

Why WASM and ink! Are Ideal for Smart Contracts?

Several key reasons led us at Aleph Zero to choose to employ the tandem of WASM and ink!. The growing popularity of WASM and ink! has resulted in a healthy, growing ecosystem that is constantly evolving and improving its functionality, making it easier and faster to implement smart contracts.

The streamlined nature of these two systems makes them free of undefined behaviors, and excess weight makes them lightweight and CPU-friendly. They also possess features that remove dead code, and through compiler flags, they can protect themselves against integer overflow. Moreover, they boast numerous tools that make programming simpler, such as rustfmt, clippy, and rust-analyzer.

Aleph Zero and Smart Contracts 

Smart contracts are one of the underpinnings of the decentralized internet, so it is paramount that the technological stack supporting them is both flexible and hospitable for developers of all backgrounds who are interested in exploring the Web3 space. 

The team behind Aleph Zero is confident that our choice to take advantage of the WASM standard combined with Rust and ink! will result in an ecosystem that, for years to come, will provide an exciting playground for innovative smart contract use cases—and significant real-world value as a result.

Be a part of the Aleph Zero community for updates on the latest developments in the ecosystem. You can also stake AZERO today.

Keep learning about the Fundamentals of Aleph Zero:

Related articles