Expand description
§dig-evidence — the DIG Network’s library of ACTIVE on-chain evidence types
One home for the evidence/proof TYPES the ecosystem produces and verifies. Every type here is an
ACTIVE piece of evidence: it (a) knows what it proves, (b) GATHERS the specific on-chain
information its proof needs through an INJECTED ChainSource reader (never taking an upward
dependency on a node or transport), and (c) re-verifies offline from its own gathered contents.
§The pattern (modeled on dig-did::prove_lineage)
Each type implements the Evidence trait and follows the same unforgeable-by-construction
discipline as dig-did’s AncestryProof:
- Private fields. A value cannot be forged by a struct literal — the only way to obtain one is
Evidence::gather, which authenticates every field against the injected reader (or, for a self-contained offline proof, against the supplied inputs). Holding a value witnesses the proof. - Gather-only construction. Construction reads chain state through the injected
ChainSourceand authenticates it; it holds NO key, signs nothing, and does its own no network I/O. - Fail-closed. An unreadable chain, a missing/forged anchor, or a proof that does not fold is
an
EvidenceError, never a silently-accepted absence.
§Phase 1 evidence types (the MVP flywheel read→verify→cache→reshare integrity gate)
| Type | Proves | Class |
|---|---|---|
RangeInclusionEvidence | a content range’s leaf is included under a generation root | self-authenticating (offline) |
RootAnchorEvidence | a generation root is committed on-chain by the store’s launcher-anchored lineage | locally-observable (chain read) |
ReadIntegrityEvidence | both of the above, bound to the same root — the read→cache→reshare gate | composite |
See SPEC.md for the full evidence taxonomy and the self-authenticating (broadcastable) vs
locally-observable (NEVER broadcastable, #1438 anti-censorship) classification table.
§Reused primitives
The merkle inclusion machinery is REUSED verbatim from dig-capsule (MerkleProof /
ProofStep, with the digstore:leaf:v1 / digstore:node:v1 domain-separation tags), the
DataStore on-chain parse from dig-merkle, and the injected reader from
dig-chainsource-interface — this crate reinvents no crypto and cannot skew from the canonical
read-crypto.
Structs§
- Capsule
Bytes32 - The merkle inclusion-proof shapes and domain-separation tags, REUSED verbatim from
dig-capsule. ARangeInclusionClaimis built from aProofSteppath; the tags are the byte-for-byte producer contract. Fixed-width byte container (raw bytes on the wire, no length prefix). - Coin
Record - The injected reads-only chain seam every active evidence type gathers through, plus the coin/lineage
shapes it reads. Re-exported so consumers construct claims without a direct
dig-chainsource-interfacedependency. A coin together with its on-chain lifecycle metadata, as read from aChainSource. - Folded
Proof - The canonical URN content-verification contract (
FoldedProof+ the gate-then-decryptverify_inclusion/verify_and_decryptover injected crypto), re-exported so a consumer reaches the blind-client read-verification surface throughdig-evidencealongside the on-chain evidence types. This is the URN-level counterpart toRangeInclusionEvidence. A decoded, folded inclusion proof: its declared leaf and the root its merkle path folds to. - Merkle
Proof - A complete inclusion proof from a leaf up to the generation root.
- Proof
Step - One step on a bottom-up inclusion path: the sibling hash and whether that sibling sits on the LEFT of the current node.
- Range
Inclusion Claim - What a range-inclusion proof claims: that
leaffolds, viapath, togeneration_root. - Range
Inclusion Evidence - Authenticated evidence that a range leaf is included under a generation root.
- Read
Integrity Claim - What a read-integrity proof claims: that
range_leaf(viarange_path) is included undergeneration_root, AND thatgeneration_rootis committed on-chain by the storestore_id. - Read
Integrity Evidence - Authenticated composite evidence that a served range is both included under a generation root and that the root is genuinely anchored on-chain — the single assurance a reader needs to cache + reshare.
- Root
Anchor Claim - What a root-anchor proof claims: that
generation_rootis committed on-chain by the store whose launcher coin id isstore_id. - Root
Anchor Evidence - Authenticated evidence that a generation root is committed by the store’s on-chain lineage.
- Singleton
Lineage - The injected reads-only chain seam every active evidence type gathers through, plus the coin/lineage
shapes it reads. Re-exported so consumers construct claims without a direct
dig-chainsource-interfacedependency. The lineage of a Chia singleton: every coin id from the launcher spend forward to the current unspent tip.
Enums§
- Evidence
Error - The single error type every
Evidencegather/verify returns. Each variant is a stable, catalogued failure reason (§6.2) so a consumer can branch on WHY a proof could not be established without parsing prose.
Constants§
- LEAF_
TAG - Domain-separation prefix for a merkle LEAF (
leaf = SHA-256(LEAF_TAG || chunk)). Distinct fromNODE_TAGso a leaf and an internal node can never collide. - MAX_
LINEAGE_ DEPTH - The maximum number of lineage coins the backward walk will visit before failing closed with
EvidenceError::LineageTooDeep. Bounds the work an adversarial (deep) lineage can force. - NODE_
TAG - Domain-separation prefix for an internal merkle NODE
(
node = SHA-256(NODE_TAG || left || right)). Applied on both the build and the verify paths so a proof folds up to the same domain-separated root.
Traits§
- Chain
Source - The injected reads-only chain seam every active evidence type gathers through, plus the coin/lineage
shapes it reads. Re-exported so consumers construct claims without a direct
dig-chainsource-interfacedependency. A reads-only view of Chia chain state — the single canonical contract every provider implements and every consumer depends on. - Content
Crypto - The canonical URN content-verification contract (
FoldedProof+ the gate-then-decryptverify_inclusion/verify_and_decryptover injected crypto), re-exported so a consumer reaches the blind-client read-verification surface throughdig-evidencealongside the on-chain evidence types. This is the URN-level counterpart toRangeInclusionEvidence. The crypto primitives this contract INJECTS fromdigstore_core(never reimplemented here). - Evidence
- An active piece of on-chain evidence: a type that knows what it proves, gathers the on-chain information its proof needs, and re-verifies offline from its own gathered contents.
Functions§
- verify_
and_ decrypt - The canonical URN content-verification contract (
FoldedProof+ the gate-then-decryptverify_inclusion/verify_and_decryptover injected crypto), re-exported so a consumer reaches the blind-client read-verification surface throughdig-evidencealongside the on-chain evidence types. This is the URN-level counterpart toRangeInclusionEvidence. The full blind-tier pipeline: gate-then-decrypt (rules 1–6). Rejects a rootless URN, verifies inclusion againsttrusted_root, then decrypts — decryption is reached ONLY after verification passes. - verify_
inclusion - The canonical URN content-verification contract (
FoldedProof+ the gate-then-decryptverify_inclusion/verify_and_decryptover injected crypto), re-exported so a consumer reaches the blind-client read-verification surface throughdig-evidencealongside the on-chain evidence types. This is the URN-level counterpart toRangeInclusionEvidence. Rules 2–4: the integrity gate. The servedciphertextmust be the proof’s leaf, the path must fold to a root (via the injected decoder), and that root must equaltrusted_root. Any failure is a hard fail-closedResolveError::VerifyFailed.
Type Aliases§
- Evidence
Result - A convenience result alias for evidence gather/verify.