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 find_stores_for_did(
        &self,
        did: &Did,
    ) -> Result<Vec<ChainStoreState>, Self::Error>;
    fn fetch_profile(
        &self,
        store: &StoreRecord,
        root_hash: Bytes32,
    ) -> Result<Profile, Self::Error>;
}
Expand description

A caller-supplied, honest READER of Chia chain state — the seam that keeps dig-identity chain- and network-independent (so it still builds for wasm / no-network targets).

A consumer (dig-node, dig-chat, the extension, hub) implements this over its own chain backend (coinset.org, a local full node, chia-query). WU3 supplies ALL the trust logic on top; the source only fetches. See the module trust model: the source MUST be honest chain data — it 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 ResolveError::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 the value WU3 trusts as the identity 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. WU3 accepts a store whose launcher parent is ANY member of this lineage (a store launched from the DID parents to the DID coin at spend time, which the same spend advances past — so the parent is a past lineage coin, not the tip). The caller implements the walk against its own chain backend (coinset / full node).

Source

fn find_stores_for_did( &self, did: &Did, ) -> Result<Vec<ChainStoreState>, Self::Error>

Returns every store whose CURRENT on-chain description names did (the discovery scan).

Over-returning is safe: WU3 re-checks the full pairing predicate (description AND launcher parent is a member of the chain-resolved singleton lineage), so non-authoritative candidates are discarded. The source need not itself enforce authority.

Source

fn fetch_profile( &self, store: &StoreRecord, root_hash: Bytes32, ) -> Result<Profile, Self::Error>

Fetches the profile SMT content a store committed under root_hash.

The returned Profile is UNTRUSTED until WU3 confirms it hashes to root_hash; the source only needs to return the store’s current profile body (e.g. from the DataLayer store content).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§