What is WASI

Another important component of wasmification is WASI. WASI, or WebAssembly System Interface, is a group of standard API specifications for Wasm programs and runtimes. In others words, WASI specifies how your Wasm-compiled program can communicate with the outer world (i.e., which system calls are availables) if this outer world complies with particular WASI standards.

WASI makes Wasm modules truly portable: your code shouldn't no about whether it's about to be executed in the browser or in some other Wasm runtime. It only requries for specific API to be implemented.

For example, WASI defines how to work with the underlying filesystem, random number generators, etc.

WASI is still a young initiative. There were just two releases: so-called Preview 1 and Preview 2 (not they're called WASI 0.1 and WASI 0.2 respectively).

Preview 1 provided only basic syscall APIs while Preview 2 consists of multiple modules (clocks, http, cli, etc.) and, more importantly, introduces the Component Model. Component Model makes it possible to link modules together without re-compiling them into a single module from sources.

component-model.png

Before and after introducing WebAssembly Components (image is courtesy of wasmcloud)

So, we have a set of binary instructions and a set of standard APIs we can call from our Wasm programs. The latter act as limitations we have to overcome when trying to port existing software to WebAssembly.