Construct ABI v1

A Construct is a #![no_std] Rust crate compiled to wasm32-unknown-unknown. Version 1 is immutable: later capabilities arrive as cz_v2_* alongside these.

Imports (module cz_v1)

FunctionSignatureMeaning
cz_v1_sense(i32) -> i64Reads one local sensor channel.
cz_v1_draw_joules(i64) -> i64Requests up to the given microjoules from the construct's input. Returns microjoules granted.
cz_v1_emit_wave(i64) -> i32Emits a local wave with the given microjoules of strength. Returns 1 if emitted.

Exports

FunctionSignatureMeaning
cz_tick() -> ()Runs once per tick while the construct is powered.

Limits

Limitv1 value
Linear memory2 pages (128 KiB) maximum, 16 KiB stack
Module size64 KiB
Gas limit1,000,000 metered instructions per tick maximum, declared in the manifest
ForbiddenFloating-point instructions, SIMD, threads and atomics, any import outside cz_v1

Manifest

{
  "abi_version": 1,
  "slug": "thermal-harvester",
  "author_id": "kip",
  "gas_limit": 5000,
  "royalty_bps": 250,
  "memory_page_limit": 1,
  "geometry": { "shape": "rect", "width_cell": 2, "height_cell": 1, "hue_index": 3 }
}

Validate with validateConstructManifest() from the cradlezero npm package.