prepare_document_proof
Computes canonical JSON, payloadHash, Merkle contentRoot, and per-field inclusion paths from a structured document, so you can anchor it and generate field proofs without storing data server-side.
Instructions
Turn a structured document into everything the proof tools need: canonical JSON and its payloadHash (what anchor_document anchors), a Merkle contentRoot over an ORDERED list of up to 16 proof fields, and per-field inclusion paths ready for the proveField* calls of submit_vault_call. kind "uint" (default) scales a numeric value; kind "bytes" (NIGHTGATE >= 0.16.0) enters a STRING field as the digest of the exact string, feeding the equality/membership proofs. Keep the field order stable across anchor and proof: it is part of the tree identity. Compute-only and synchronous, nothing is stored server-side. Leaves are SALTED: the response carries a per-field salt (feed it back as fieldSalt / claim salt), the full opening (salt seed + all 16 slots, needed for the cross-root proofs) and schemaId (anchor it alongside the root). STORE the opening with the document: losing the salt seed makes the anchored root unprovable, publishing it makes leaf hashes guessable. Pass saltSeed to reproduce an EXISTING anchored root byte-for-byte; omit it for a fresh document. The returned fields carry witness material (scaled values / digests / salts): treat as sensitive. Store canonicalDocument at your storageRef; re-serializing with different key order will not re-hash equal.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document | Yes | The full document as a JSON object; all of it goes into payloadHash | |
| saltSeed | No | Reuse a stored salt seed to reproduce an already-anchored root; omit for a fresh document (random seed) | |
| proofFields | Yes | ORDERED list of fields to make provable (leaf index = position). Up to 16 on the default vault, up to 32 with compiledArtifactRef attestation-vault-32 | |
| compiledArtifactRef | No | Contract artifact ref, defaults to 'attestation-vault-32'; 'attestation-vault' for a 16-slot vault |