Certify an HTTP page and Rechain history

A status page can render a bounded public event projection and expose the same events as Rechain records. Rechain publishes one certified root for both surfaces. The HTTP branch is labeled http_expr and sorts before rechain. Root composition

Register the HTTP branch

The SDK pins ic_certification::HashTree to ic-certification 3.2.0. With ic-http-certification = "=3.2.0", use cargo tree -i ic-certification@3.2.0 to verify that Rechain and HTTP certification share one resolved instance. Registry consumers use the stock crate for both. A standalone workspace using the checked-out SDK needs the [patch.crates-io] entry from the SDK manifest at its own workspace root, with the path adjusted to the SDK's vendor/ic-certification directory. SDK workspace patch · Rechain dependency pin

Build an HttpCertificationTree from a deterministic snapshot of retained public state. For an exact GET / route, use HttpCertificationPath::exact and HttpCertification::full with a v2 CEL expression that covers the response status, body and selected headers. Set IC-CertificateExpression in the response and insert the entry into the tree. Pass the tree's complete labeled digest to Rechain.

If a helper returns an entry built from local values, pass Cow::Owned(path) and Cow::Owned(certification) to HttpCertificationTreeEntry::new.

cdk_rsx_rechain::ic::set_application_root(http_tree.root_hash());

Start Reactor and then Rechain with its scheduler on install and restore. Rebuild and register the HTTP branch after Rechain starts, including after a drained KEEP. Refresh registration in the same synchronous transition that commits a public change. Keep rendering inputs deterministic across rebuilds and let Reactor drive deferred Rechain tip publication. Rechain IC API · Rechain startup example · Reactor host without peer routes

Serve the two proofs

Use Candid at the fixed IC HTTP gateway boundary and bounded IC Wire for the application's history queries. For the v2 route in http_request, build the response and its witness from the same public snapshot and certification entry. Trap if composing the branch fails. Read the data certificate in the query and attach the composed witness to the HTTP response.

let branch = http_tree
    .witness(&entry, request.url())
    .expect("HTTP route witness");
let witness = cdk_rsx_rechain::ic::application_witness(branch)
    .expect("public snapshot matches the registered branch");
let certificate = cdk_rsx::api::data_certificate().expect("certified query");
ic_http_certification::utils::add_v2_certificate_header(
    &certificate,
    &mut response,
    &witness,
    &entry.path.to_expr_path(),
);

Expose ic::get_tip_certificate via a typed IC Wire query. Its generated TypeScript client returns the certificate, CBOR hash_tree, and tip hash as Uint8Array. Have the record hook encode just the public DTO with block::encode and return it as RecordedPayload. Register its schema with a native cdk_rsx::interface::PayloadType if the DTO only appears inside stored bytes. block::encode frames the fixed DTO as one value in a sparse tuple with an empty extension block. Give the generated runtime that tuple schema and the same payload limits. For a registered type named PublicRecord, the decoded tuple contains one record.

const codec = createPayloadCodec({
  schema: {
    k: 'extension-tuple',
    items: [{k: 'ref', name: 'PublicRecord'}],
    extensions: [],
  },
  bytes, nodes, depth,
}, descriptor.types);
const [record] = codec.decode(payload);

When the hook writes a directly evolving payload with wire::evolve::encode_payload, use the registered evolving root schema itself, such as {k: 'ref', name: 'PublicTransfer'}. For an evolving body inside a fixed envelope, decode the envelope tuple first and then the body. Typed tip query · Payload descriptor registration Standalone payload codec · Installed byte round trip

Verify both surfaces

  1. Verify the exact HTTP request and response with an HTTP v2 verifier such as ic-response-verification using the expected canister, trusted root key and current time. Flip one body byte and require verification to fail.
  2. Verify the Rechain certificate signature, canister scope and freshness. Decode the CBOR witness and compare its reconstructed root with the canister's signed certified_data. Check the state and any tip index and hash against the leaves under rechain/chains/<one-byte chain id>. Recompute V3 BLAKE3 body commitments for Original records from the exact payload and opening bytes. Verify header hashes and links through the certified tip. Each event decodes as a complete IC Wire frame. The V3 header hash covers the canonical header bytes before the trailing empty extension block. Require rejection of a changed tip or witness. The installed example uses PocketIC's root key and clock. Use the expected network's trusted root key and the client's current time outside the fixture. Rechain V3 bytes · Host verifier · Installed check
  3. Compare the independently authenticated roots when both queries observe the same published state. For a local KEEP rehearsal, populate the canister, let Reactor publish its tip, drain, upgrade and verify both branches again. After an unchanged-image KEEP, compare the restored body and root with their pre-upgrade values, then mutate state and verify the new proofs. KEEP rehearsal

Run the native composition checks

From the repository root, run the maintained Publisher tests with the pinned compiler. They cover the common root, mismatched and missing application witnesses, deferred publication, and re-registration after restoring chain tips. Native certification tests

mkdir -p tmp
run_dir=$(mktemp -d "$PWD/tmp/rechain-cert.XXXXXX")
export CARGO_HOME="$run_dir/cargo-home" CARGO_TARGET_DIR="$run_dir/target" TMPDIR="$run_dir/temp"
source tools/env.sh
cargo test --manifest-path cdk-rsx/Cargo.toml --locked -p cdk-rsx-rechain --lib 'certification::tests::'

The installed Wave 3 outage-status experiment exercised the HTTP v2 verifier and Rechain certificate checks in PocketIC, including altered body and proof rejection, a populated same-image KEEP, and a subsequent write. Its loopback bridge relayed the page after verifying the raw HTTP response. Wave 3 installed results