Ethereum flavored WebAssembly (ewasm)
Specification Revision 4
This repository contains documents describing the design and high-level overview of ewasm. Expect the contents of this repository to be in flux: everything is still under discussion.
This repository is also available through ReadTheDocs.
What is WebAssembly?
WebAssembly (or Wasm as a contraction) is a new, portable, size- and load-time-efficient format. WebAssembly aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms. WebAssembly is currently being designed as an open standard by a W3C Community Group.
A few key points:
- WebAssembly defines an instruction set, intermediate source format (WAST) and a binary encoded format (WASM).
- WebAssembly has a few higher level features, such as the ability to import and execute outside methods defined via an interface.
- LLVM includes a WebAssembly backend to generate WASM output.
- Other non-browser implementations exist too: wasm-jit-prototype (a standalone VM using an LLVM backend), wabt (a stack-based interpreter), ml-proto (the OCaml reference interpreter), etc.
What is Ethereum flavored WebAssembly (ewasm)?
ewasm is a restricted subset of WASM to be used for contracts in Ethereum.
- specifies the VM semantics
- specifies the semantics for an ewasm contract
- specifies an Ethereum environment interface to facilitate interaction with the Ethereum environment from an ewasm contract
- specifies system contracts
- specifies metering for instructions
- and aims to restrict non-deterministic behavior
- specifies a backwards compatible upgrade path to EVM1
Goals of the ewasm project
- To provide a specification of ewasm contract semantics and the Ethereum interface
- To provide an EVM transcompiler, preferably as an ewasm contract
- To provide a metering injector, preferably as an ewasm contract
- To provide a VM implementation for executing ewasm contracts
- To implement an ewasm backend in the Solidity compiler
- To provide a library and instructions for writing contracts in Rust
- To provide a library and instructions for writing contracts in C
- Ewasm contract: a contract adhering to the ewasm specification
- Ethereum environment interface (EEI): a set of methods available to ewasm contracts
- metering: the act of measuring execution cost in a deterministic way
- metering injector: a transformation tool inserting metering code to an ewasm contract
- EVM transcompiler: an EVM bytecode (the current Ethereum VM) to ewasm transcompiler. See this chapter.
- VM semantics
- Ethereum environment interface
- Ewasm Contract Interface
- System contracts
- Backwards compatibility instructions
- Original Proposal (EIP#48)
- WebAssembly Specification
- WebAssembly design documents
Design Process & Contributing
For now, high-level design discussions should continue to be held in the design repository, via issues and pull requests. Feel free to file issues.