Skip to main content

ChainSource

Trait ChainSource 

Source
pub trait ChainSource {
    type Error: Display;

    // Required methods
    fn resolve_singleton_lineage(
        &self,
        launcher_id: Bytes32,
    ) -> Result<Option<SingletonLineage>, Self::Error>;
    fn parent_spend(
        &self,
        coin_id: Bytes32,
    ) -> Result<Option<CoinSpend>, Self::Error>;
}
Expand description

A caller-supplied, honest READER of Chia chain state — the seam that keeps dig-did network-free (INV-1) while still authenticating on-chain lineage.

A consumer (dig-node, dig-chat, the extension, hub) implements this over its own chain backend (coinset.org, a local full node, chia-query). dig-did supplies all the trust logic on top; the source only fetches. See the module trust model — the source MUST be honest chain data and is never treated as a source of authority claims.

Required Associated Types§

Source

type Error: Display

The source’s own fetch/transport error, surfaced verbatim through DidError::Chain.

Required Methods§

Source

fn resolve_singleton_lineage( &self, launcher_id: Bytes32, ) -> Result<Option<SingletonLineage>, Self::Error>

Walks the singleton lineage from launcher_id to its current unspent tip, returning EVERY coin id on that walk as a SingletonLineage.

Returns None when the launcher never existed or the singleton has been fully spent (melted). The returned lineage is trusted as the DID singleton’s authentic lineage — so this MUST be a genuine forward walk from the DID launcher to its tip (each coin the singleton recreation of the previous), NEVER an echo of a caller-supplied coin. The caller implements the walk against its own chain backend.

Source

fn parent_spend( &self, coin_id: Bytes32, ) -> Result<Option<CoinSpend>, Self::Error>

Returns the coin spend that CREATED coin_id — i.e. the spend of coin_id’s parent coin — or None when no such spend is known (an unspent-parent / coinbase / genesis edge).

This is the single primitive the singleton-authentication walk consumes: given a coin, it reads the parent’s puzzle reveal + solution, proves the parent is a singleton (or the launcher), and derives the successor the parent created. The source only fetches; it performs NO authentication.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§