Basic Rechain canister

Port of rechain/examples/basic, preserving its public operations and canonical Add : nat | Create : {id : nat; name : text} actions. This port uses ICP3V 1.0.

root/memory/v1.rs attaches the shared Rechain runtime, shared Reactor transport, Counter and Objects memories. root/mod.rs constructs their transient bindings. commands.rs binds the two reducers as one typed dispatch pipeline, derives a DCID from this canister and its next block index, then dispatches synchronously. Endpoints use commands and read-only selectors; they cannot call commit callbacks or access another reducer's mutable state.

#[cdk_rsx::update]
fn create(name: String) -> api::CreateResult {
    root::with(|app| app.commands().create(name, cdk_rsx::api::time()))
}

Both reducers validate before either commits. An empty name or zero increment consumes no block ID. Object creation leaves the counter unchanged. The same creation command is registered on authenticated Reactor route objects.create; its private transport and permanent block payloads use native ic-wire. Public application methods and the standard Rechain queries use bounded Wire.

The counter preserves Motoko's arbitrary-size Nat, storing minimal unsigned little-endian bytes in an immutable retained SharedSlice. Names use SharedString. Object keys use 17 bytes: a u64 block index, full u64 canister number and DCID framing can need 131 bits. The public IDs and block IDs remain arbitrary Wire Nat; this port's history addresses are u64. A lookup of a larger ID returns None. These are private storage decisions, separate from the public DTOs in api.rs.

This version keeps history locally. scheduler_stats exposes actual RSX counters, not invented Motoko implementation counters. Standard Rechain queries include certified tips. Anonymous callers cannot authorize Reactor peers.

Run native behavior checks from the repository root:

source tools/env.sh
cargo test --manifest-path tests/Cargo.toml --locked --offline -p rrt-rechain-basic-canister --lib

Build the actual canister through the SDK pipeline:

python3 cdk-rsx/tools/build-app.py \
  --manifest-path tests/canisters/rrt-rechain-basic/Cargo.toml \
  --out-dir tests/tmp/rechain-basic --offline --locked

The native test covers owner isolation, rejection, original block numbering, canonical action decoding, reopen and a counter larger than u64. The historical smoke record reports canonical wasm64 business and drained same-artifact KEEP checks for its pinned build. It does not qualify a newly built artifact.