Quickstart

A complete wasm64 canister with one root and an opaque scores module. Public put, get, remove and count endpoints lend a root frame to the bound scores service. Writes use the native retained map directly.

The scores owner keeps its MemoryKey and data private in scores/memory/v1.rs. The root version names that exact child version in module_memory!, which declares its ChildSlot. Transient services own nonowning bindings; rebuilding them does not pin abandoned modules. The root attribute owns SDK lifecycle hooks. Its admission catalog checks every module and allocator carrier before KEEP, and its explicit transient inventory clears the service graph before the SDK publishes a clean handoff.

Use the release Quickstart build with the tools bundle, or the checkout build with a harness clone. Native tests check mutation and service rebind. PocketIC lifecycle checks use the prepared Wasm.

Pass the initial score from a generated client

The root declares arguments = (u64, u32) and forwards the tuple to the scores owner for installation. The generated descriptor places the complete Rust tuple in one outer Wire slot. Build the constructor codec from descriptor.constructor and descriptor.types using the application's .wire.runtime.mjs, then pass initCodec.encode([[1n, 23]]) as the raw install argument for player 1 and score 23.

Import get from the generated .wire.ts to read the initial score. Send get.encodeRequest([1n]) to get.methodName, then pass the raw reply to get.decodeResponse. The result is { some: 23 }. The installed runner checks this row at install, after populating the map, and after KEEP. Generated-client runner

Rehearse Wire evolution with the original client

Use example=quickstart and follow the release build and host setup to set sdk, run, host, and POCKET_IC_BIN. Build three variants from that same copied app. Keep each image with its original generated bindings.

for variant in wire-evolution wire-evolution-v2 wire-evolution-breaking
do
  python3 "$sdk/tools/build-app.py" --manifest-path "$run/app/Cargo.toml" \
    --features "$variant" --name "$variant" --out-dir "$run/artifacts" \
    --offline --locked >"$run/$variant.log" 2>&1
done
node "$host/wire-evolution.mjs" \
  "$run/artifacts/wire-evolution" "$run/artifacts/wire-evolution-v2" \
  "$run/artifacts/wire-evolution-breaking" "$POCKET_IC_BIN" "$run/wire-result"

The runner installs and populates V1 twice. Compatible V2 makes overwrite optional, so the original writer still works. V2 sends labels in the nested page rows only when the caller requests them. An ordinary V1 query receives the exact bytes it received before KEEP.

The breaking variant passes its own metadata check and KEEP. Its required overwrite tag rejects the original writer. Its optional label also fits a short reply and exceeds the original client's 128-byte cap on a full page. These small caps make the failure observable with eight scores. Use the SDK defaults for ordinary endpoints and rehearse with your own full populations. Versioned methods · Wire evolution guide