Skip to main content

Crate dig_did

Crate dig_did 

Source
Expand description

§dig-did — the DIG Network canonical Chia DID expert crate

dig-did is a pure, key-free, network-free SpendBundle-builder for Chia Decentralized Identifiers (DIDs). It constructs the exact CoinSpends for every DID lifecycle operation and reports — via required_signatures — the exact signatures a caller must produce. It never holds a secret key, never signs, and never touches the network. The consumer signs the reported messages, assembles the SpendBundle, and broadcasts.

§Invariants

These four invariants hold across the entire crate and are the contract every unit is built to (SPEC §1):

  • INV-1 — No network. dig-did performs NO network or chain I/O. Every function is a pure transform of its inputs; the caller fetches coins and broadcasts bundles.
  • INV-2 — No keys. dig-did never accepts, holds, derives, or logs a secret key. It computes what must be signed (required_signatures); the caller’s signer produces the signatures.
  • INV-3 — Unsigned output. Every operation returns an unsigned DidSpend — coin spends plus the recreated child DID. Signatures are always the caller’s responsibility.
  • INV-4 — SDK byte-source-of-truth. Every puzzle, layer, and coin-spend byte is produced by chia-wallet-sdk (pinned to the 0.30 / chia-protocol 0.26 family). dig-did adds DID-workflow ergonomics on top; it never re-implements a puzzle or hand-rolls a spend bundle.

§Consumer pattern

build an unsigned DidSpend  ->  required_signatures(&spend.coin_spends, &constants)
  ->  caller signs each reported message  ->  assemble SpendBundle  ->  broadcast

§Status

The foundation (type surface, error taxonomy, inner-spend helpers, signing boundary) ships alongside create (create_did, create_simple_did, create_eve_did_only), hydrate (hydrate_did_from_parent_spend, parse_did_coin_spend, did_info_from_puzzle), the did:chia: string codec (did_string_from_launcher_id, launcher_id_from_did_string), and the lineage-proof spine — the resolve::ChainSource chain-reading seam (the ONE canonical dig-chainsource-interface trait, re-exported), prove_lineage + AncestryProof, and walk_did_lineage_to_tip — and the DID→XCH address resolver (resolve_xch_address, resolve_xch_address_from_did_string), which authenticates a DID’s current tip to its genuine launcher before returning the owner’s payment Address. The remaining DID operations (update, recovery, transfer, launch, melt, attest, resolve-document) land in their own units against this foundation; their modules are declared below as doc-only stubs so the layout is final.

Re-exports§

pub use create::create_did;
pub use create::create_eve_did_only;
pub use create::create_simple_did;
pub use did_string::did_string_from_launcher_id;
pub use did_string::launcher_id_from_did_string;
pub use did_string::DID_CHIA_PREFIX;
pub use error::DidError;
pub use error::DidResult;
pub use hydrate::did_info_from_puzzle;
pub use hydrate::hydrate_did_from_parent_spend;
pub use hydrate::parse_did_coin_spend;
pub use lineage::prove_lineage;
pub use lineage::AncestryProof;
pub use lineage::LineageModel;
pub use resolve::resolve_xch_address;
pub use resolve::resolve_xch_address_from_did_string;
pub use resolve::walk_did_lineage_to_tip;
pub use resolve::DidTip;
pub use resolve::MAX_LINEAGE_DEPTH;
pub use sign::required_signatures;
pub use types::DidSpend;
pub use types::Owner;

Modules§

attest
Announce-as-DID / attestation (SPEC §3, unit U8).
create
DID creation (SPEC §3 “Create”).
did_string
The did:chia:1… string codec (SPEC §2.3 & §9).
error
The dig-did error taxonomy (SPEC §6).
hydrate
DID hydration from chain data (SPEC §3 & §5).
launch
Launching other singletons authorized BY a DID (SPEC §3, unit U6).
lineage
Lineage proof: authenticating that a coin belongs to a DID’s identity (SPEC §5).
melt
DID melt / termination (SPEC §3, unit U7).
recovery
DID recovery configuration & recovery spends (SPEC §3, unit U4).
resolve
The chain-reading seam and the singleton lineage-authentication core (SPEC §5 & §10).
sign
The signing boundary (SPEC §4) — the load-bearing custody guarantee of dig-did.
transfer
DID ownership transfer (SPEC §3, unit U5).
types
The public type surface of dig-did (SPEC §2).
update
DID metadata update & settle (SPEC §3, unit U3).

Structs§

Address
AggSigConstants
Coin
CoinSpend
DidInfo
Information needed to construct the outer puzzle of a DID. It does not include the inner puzzle, which must be stored separately.
LineageProof
SingletonLineage
The lineage of a Chia singleton: every coin id from the launcher spend forward to the current unspent tip.

Enums§

Proof
RequiredSignature

Traits§

ChainSource
A reads-only view of Chia chain state — the single canonical contract every provider implements and every consumer depends on.

Type Aliases§

Bytes32
Did
Contains all information needed to spend the outer puzzles of DID coins. The DidInfo is used to construct the puzzle, but the Proof is needed for the solution.