anchor_document
Anchors a document's SHA-256 hash on the Midnight blockchain in one call, with a sponsor paying the fee and a check that the attestation record landed on-chain.
Instructions
Anchor a document hash on Midnight in one call: builds the attest transaction here with the caller seed, a sponsor pays the fee, and the tool waits until it landed (about 1 to 2 minutes; the first call also downloads the prover keys). The record belongs to this seed (attesterId). Only the hash and the hash of the metadata go on-chain; keep the document yourself. With contentRoot and schemaId from prepare_document_proof it also anchors the content root, which the field claims of submit_vault_call need. Returns { status, attesterId, payloadHash, contractAddress, metadataJson, txHash, transactionHash, timings, check }; check is the verify_attestation call that shows the record on-chain. If the call was cut off or came back pending, run it again with the same arguments: it picks up the job it started and submits nothing new (the answer says deduplicated). A second, separate call with the same arguments needs a new idempotencyKey.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha256 | Yes | sha256 of the document (64 hex); it becomes the payloadHash | |
| metadata | No | Public metadata; its sha256 is anchored with the hash. Default none | |
| schemaId | No | Schema id from prepare_document_proof (64 hex); needs contentRoot | |
| contentRoot | No | Content root from prepare_document_proof (64 hex); needs schemaId | |
| idempotencyKey | No | Dedupes retries of the same anchor | |
| contractAddress | No | AttestationVault address (64 hex); default the shared sandbox vault of the network (preprod, preview) | |
| compiledArtifactRef | No | Vault lineage, default 'attestation-vault-32' (the sandbox vaults); 'attestation-vault' for a 16-slot vault |