WASM (WebAssembly)

← Target Reference


Parameters

Parameter Value
Architecture Stack
Word size 64-bit (i64), 32-bit (i32)
Hash function -- (runtime-dependent)
Digest width 32 bytes
Stack depth Operand stack (unlimited, bounded by metering)
Output format .wasm
Cost model Gas, cycles, or wall-clock (OS-dependent)

WASM is a VM, not an OS. One .wasm binary runs on multiple OSes — only the runtime binding differs.

Operating Systems Running WASM

OS Runtime Binding Notes
Near Protocol nearcore os.near.* 1 contract per account, promise-based async
Cosmos (100+ chains) CosmWasm / wasmd os.cosmwasm.* IBC cross-chain, typed entry points
Arbitrum Stylus (ArbOS) os.arbitrum.* WASM + EVM coexistence, EVM-compatible gas
Icp Canister runtime os.icp.* Deterministic time slicing, persistent memory
WASI wasmtime / wasmer os.wasi.* Filesystem, clock, random (planned)
Browser JS runtime os.browser.* DOM, fetch, Web APIs (planned)

Lowering

All WASM OSes share the same WasmLowering path:

TIR → WasmLowering → WASM module (.wasm)

The WASM bytecode is identical. What differs is:

  • Host functions — each OS provides different imports (storage, messaging, crypto, filesystem)
  • Entry points — Near uses #[near] attributes, CosmWasm uses instantiate/execute/query, Stylus uses Solidity ABI, Icp uses #[update]/#[query], WASI uses _start
  • Metering — Near and Cosmos use gas, Icp uses cycles, Stylus uses EVM-compatible gas, WASI uses wall-clock

The runtime binding (os.<os>.*) handles these differences. The compiler produces one WASM module; the linker injects the correct host function imports for the target OS.


Cost Model (OS-dependent)

WASM itself has no built-in metering — cost is imposed by the OS runtime.

OS Cost unit Notes
Near Gas Per-instruction (1 gas ≈ 1 opcode)
Cosmos Gas Per-instruction + storage
Arbitrum (Stylus) Gas EVM-compatible gas metering
ICP Cycles Deterministic time slicing
WASI Wall-clock No metering (direct execution)
Browser Wall-clock No metering (direct execution)

Detailed per-instruction cost model planned per OS.

Dimensions

wasm
powerful instruction set for a more portable execution [webassembly.org](https://webassembly.org) [some of implementations](https://webassembly.org/features/) cosmwasm, substrate legacy browsers ts, rust, go, python
cyb/wasm
CyberWasm A byte machine for sovereign computing. The Problem cosmwasm is a transaction processor pretending to be a computing environment. Programs cannot live in memory. Programs cannot wake themselves up. Programs pay for abstractions they never asked for. Every call crosses a Go→CGo→Rust→Wasm…
bostrom/wasm
store-code sender bostrom1frk9k38pvp70vheezhdfd4nvqnlsm9dw3j8hlq wasmByteCode particle clear-admin sender bostrom1frk9k38pvp70vheezhdfd4nvqnlsm9dw3j8hlq, contract bostrom1nwnejwsdpqktusvh8qhxe5arsznjd5asdwutmaz9n5qcpl3dcmhsujhemd update-admin sender bostrom1frk9k38pvp70vheezhdfd4nvqnlsm9dw3j8hlq,…

Pages in this namespace

Local Graph