prepare_document_proof
Prepares a structured document for blockchain attestation by computing canonical JSON, payload hash, Merkle root, and per-field inclusion proofs.
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 32 proof fields (16 on a 16-slot attestation-vault), and per-field inclusion paths ready for the proveField* calls of submit_vault_call. kind "uint" (default) scales a numeric value; kind "bytes" 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 + every slot, 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"document": "<document>",
"proofFields": "<proofFields>"
},
"name": "prepare_document_proof"
}
}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 32 on the default attestation-vault-32, up to 16 with compiledArtifactRef attestation-vault | |
| compiledArtifactRef | No | Contract artifact ref, defaults to 'attestation-vault-32'; 'attestation-vault' for a 16-slot vault |