Search code examples
webassemblywasm-pack

WASI vs Web-Assembly


I came across the web-assembly wasm, even I tried some of the code using web-assembly, Recently I read about wasi and I notice Ethereum Ewasm, Cosmos coswasm in the blockchain. What is main difference between them? When is WASI the right solution and when should WebAssembly be used?


Solution

  • WASI is an extension of WASM to run not only on the web, but on any platform. WebAssembly provides a build target for a conceptual machine, meaning that a single binary can be run on different processors and computers (rather than having to build multiple different binaries). WASI provides a conceptual operating system which means that a program can use a common set of commands and subroutines to interact with the operating system without needing to be rewritten to handle the differences between operating systems.

    If your code only needs to run in the browser you should use WebAssembly. If you are interacting with an operating system in a program you might want to consider using WASI.

    A description by Mozilla