ubl-wasm
UBL Chip execution engine compiled to WebAssembly with true BLAKE3 hashing.
Build
Usage in Browser
Exports
| Function | Description |
|---|---|
execute_chip(chip_json, ctx_json) |
Execute chip and return full result with Decision CID |
blake3_hash(data) |
Compute BLAKE3 hash of string data |
canonize_json(json_str) |
Canonize JSON (sorted keys, compact) |
compute_decision_cid(did, cid, ctx, result, reason) |
Compute Decision CID directly |
version() |
Get version string |
Decision CID
Same formula as CLI/HTTP/Postgres:
BLAKE3(CANON1 \0 did \0 chip_cid \0 canonical(ctx) \0 canonical(output))
Isomorphic execution guaranteed.
Size
ubl_wasm_bg.wasm: ~145KB (optimized with wasm-opt)
Integration with @ubl/sdk
import init, * as wasm from 'ubl-wasm';
import { registerWasm } from '@ubl/sdk';
await init();
registerWasm(wasm);
// Now <Chip/> uses true BLAKE3 via WASM