WebAssembly

TOC

EVM ABI WebAssemble

solidity

contract Test {
    event Event(uint indexed a, bytes32 b);
    function foo(uint a) public { emit Event(a, b); }
    bytes32 b;
}

test-contract-output-abi.json

[
    {
        "type": "event",
        "inputs": [
            {
                "name": "a",
                "type": "uint256",
                "indexed": true
            },
            {
                "name": "b",
                "type": "bytes32",
                "indexed": false
            }
        ],
        "name": "Event"
    },
    {
        "type": "function",
        "inputs": [
            {
                "name": "a",
                "type": "uint256"
            }
        ],
        "name": "foo",
        "outputs": []
    }
]

Wasm for Blockchain 2019

Wasm for Blockchain 2019 - NEAR Protocol - Medium

Wasmer opens discussion of unifying APIs of smart contracts, by presenting two approaches: the first one is the one suggested by Oasis in this blog post, where they emulate blockchain interface through POSIX-like imports available in standard WASI modules; the second approach is to either use imports without WASI (Ewasm approach) or have a special WASI module for blockchains.

Wasmtime

CraneStation/wasmtime: Standalone JIT-style runtime for WebAssembly, using Cranelift relation to wasmtime? · Issue #142 · wasmerio/wasmer

WASI cowsay

wapm-packages/cowsay: Cowsay in WebAssembly

Cloudflare Worker , wrangler , Serverless Wasm

wasm32-wasi

目前 wasi net 部份未支援

// 
// cargo +nightly build --target wasm32-wasi
// 
fn main() {
    println!("Hello, WASM/WASI world!");
}
$ wasmer run target/wasm32-wasi/debug/hello-wasi.wasm
Hello, WASM/WASI world!

Links