Expand description
§dig-social-profile — the DIG Network social-identity profile SCHEMA composite
A DIG social identity is an identity anchor (a Chia did:chia: singleton in v1) PAIRED with a
DataLayer store that holds the anchor’s profile. The profile is a sparse merkle tree of
standard SLOTS — one fixed 256-bit position per field — so any implementation reads and writes the
same bytes, and any field can be proved (or proved absent) against a single 32-byte root.
This crate is the profile SCHEMA + composite. It defines the standard slots, the deterministic
value encoding, the DID anchoring/pairing predicate, the chain-independent resolve seam, and
the DID->store IdentityProfile::mint_from_did launch driver — and it CONSUMES the lower
layers:
dig_smt— the generic sparse-merkle-tree MECHANISM (tree, proof, sha256 hasher). The profile root is byte-identical to what dig-identity historically produced (§5.1 / NC-9), proven by the golden vectors intests/golden_vectors.rs.dig_did— thedid:chia:1…string codec (didparses through it).dig_store— the DataLayer store lifecycle (IdentityProfile::mint_from_didbuilds the UNSIGNED launch spend through it; this crate never holds a key, never signs, never broadcasts).dig_identity— the BLS identity-KEY primitive (slotderives slot keys with its canonicalsha256so the derivation shares one hash source with the key layer).
The schema core is CHAIN-INDEPENDENT (no chain calls in slot/value/profile/proof/
pairing/verify): on-chain DID resolution is a caller-supplied resolve::ChainSource
TRAIT seam, so the schema layer still builds for wasm / no-network targets. Only
IdentityProfile::mint_from_did reaches into dig-store to build the on-chain launch spend.
§What lives here
| Concern | Module |
|---|---|
| Slot ids, the v2 slot map, slot-key derivation | slot |
The tag ‖ len ‖ bytes value encoding | value |
The portable DPB profile body (bytes <-> root) | body |
The mutable tree (over dig_smt): set/get/root/prove | tree |
Serializable proofs + root-only verification (over dig_smt) | proof |
| The profile reader/writer + key resolution | profile / keys |
The identity anchor (DID) + discovery parse (via dig_did) | did |
| The canonical XCH receive-address field codec | xch |
| The DID<->store bidirectional-pairing predicate + ownership proof | pairing |
| Composed “this datum belongs to this DID” verification | verify |
On-chain DID->profile resolution over a caller resolve::ChainSource | resolve |
| The managed profile object + DID->store minting | identity_profile |
§Cargo features
chia(default) — the chia-anchored half: DID parsing/anchoring, the DID<->store pairing predicate, the on-chainresolveseam,IdentityProfileminting, store updateauthority, composedverifyication,xchaddress validation, and theBytes32/Coinre-exports.- no default features — the pure BYTE CORE:
slot,value,tree,proof,profileand the portablebodyformat, whose entire dependency set isdig-smt,sha2andthiserror. A host riding a DIFFERENT chia-protocol line (dig-node patches it to dig-gossip’s vendored 0.26 fork, while this crate pins 0.36.1) can read and write profile bytes without a second chia line in its build.
Both surfaces compute byte-identical slot keys, values and roots — that is what the frozen golden
vectors in tests/golden_vectors.rs assert.
§Proving a field against a root
use dig_social_profile::{Profile, Value, slot::standard, proof};
let mut profile = Profile::with_schema_v2();
profile.set(standard::DISPLAY_NAME, Value::Utf8("Ada".into()));
let tree = profile.build_tree().unwrap();
let root = tree.root();
// Prove the display name equals "Ada" using only (root, proof).
let membership = tree.prove_membership(standard::DISPLAY_NAME).unwrap();
let claim = Value::Utf8("Ada".into());
assert!(proof::verify_membership(&root, standard::DISPLAY_NAME, &claim, &membership).unwrap());
// Prove no peer id is present.
let absent = tree.prove_non_membership(standard::PEER_ID).unwrap();
assert!(proof::verify_non_membership(&root, standard::PEER_ID, &absent).unwrap());Re-exports§
pub use authority::ProfileUpdate;pub use authority::StoreAuthoritySource;pub use body::AnchoredRoot;pub use body::VerifiedBody;pub use did::parse_did_from_description;pub use did::Did;pub use error::Error;pub use error::Result;pub use identity_profile::IdentityProfile;pub use identity_profile::IdentityProfileMint;pub use keys::DidKeys;pub use pairing::evaluate_pairing;pub use pairing::store_belongs_to_did;pub use pairing::IdentitySingleton;pub use pairing::PairingOutcome;pub use pairing::SingletonLineage;pub use pairing::StoreOwnershipProof;pub use pairing::StoreRecord;pub use profile::resolve_did_keys;pub use profile::Profile;pub use profile::SlotEdit;pub use proof::verify_membership;pub use proof::verify_non_membership;pub use proof::ProfileProof;pub use resolve::resolve_bls_public_key;pub use resolve::resolve_identity_profile;pub use resolve::ChainSource;pub use resolve::ChainStoreState;pub use resolve::ResolveError;pub use slot::SlotId;pub use tree::ProfileTree;pub use value::Value;pub use value::ValueTag;pub use verify::verify_profile_field_absent_for_did;pub use verify::verify_profile_field_for_did;pub use xch::is_valid_xch_address;pub use xch::parse_xch_address;
Modules§
- authority
- The chain-reading seam and the spend output for a profile’s DataLayer store update path (#1361 / #908).
- body
DPB— the portable on-disk/on-wire profile BODY: the slot bytes a profile root commits to.- did
- The identity-anchor identifier (a DID) and how it is discovered from a store description.
- error
- The crate’s single error type.
- identity_
profile - The
IdentityProfileprimitive — the managed DIG Network “Profile” object — and the DID->storeIdentityProfile::mint_from_didlaunch driver. - keys
- The cryptographic-key view of a profile — the dig-message / dig-chat / dig-node resolution seam.
- pairing
- The DID<->store bidirectional-pairing predicate, as pure types over supplied Chia records.
- profile
- The
Profilereader/writer — a slot map that materializes into aProfileTree. - proof
- The serializable profile proof and the root-only verification functions.
- resolve
- On-chain DID resolution: from a
did:chia:string to its chain-authenticated profile. - slot
- Slot identifiers, the v2 standard slot map, and the deterministic slot-key derivation.
- tree
- The mutable profile tree: set/get slots, compute the root, and produce proofs.
- value
- The deterministic
tag ‖ len ‖ bytesslot-value encoding. - verify
- Composed “this profile datum belongs to this DID” verification — THE consumer seam.
- xch
- The canonical mainnet XCH receive-address profile field (slot
0x0008).
Structs§
- Coin
- Datastore
- Everything that is required to spend a
Datastorecoin. - DigData
Store Metadata - The DIG DataLayer metadata: the SDK’s
DatastoreMetadatashape with the exact byte count ("b") REPLACED by a power-of-2size_bucket("sz"), plus the additiveprogram_hash("p"). - Merkle
Coin Spend - The result of building a DataLayer-coin operation: the unsigned coin spends plus the recreated child Datastore.
- Size
Bucket - A
.digstore size quantised to a power-of-2 bucket: exponentk ∈ 0..=10↔2^k MiB(1 MB..1 GB). See the module docs for the full ladder and the canonical unit (1 MB = 1 MiB). - Store
Update Authority - The store singleton’s CURRENT on-chain update authority — everything needed to DECIDE whether a caller may advance the store root, as resolved from chain by a higher-level chain source.
- Writer
Delegation - A CHIP-0035 delegation recorded on the store singleton, as read from current chain state.
Enums§
- Delegation
Kind - The kind of a CHIP-0035 delegation, which determines whether it grants WRITE authority.
- Store
Owner - Who is authorized to spend a store coin — the p2 (“inner”) puzzle that guards it.
Constants§
- DID_
CHIA_ PREFIX - The bech32m human-readable prefix of a v1 Chia DID (
did:chia:1...). The bech32m human-readable prefix of a v1 Chia DID (did:chia:1...).