Skip to main content

create_store

Function create_store 

Source
pub fn create_store(
    parent_coin: Coin,
    owner: StoreOwner,
    owner_puzzle_hash: Bytes32,
    params: CreateStoreParams,
) -> DigStoreResult<MerkleCoinSpend>
Expand description

Launches a new store coin from a funding parent, anchoring the first root (SPEC §3.1).

parent_coin funds + parents the launcher, so launcher_id == store_id derives from its coin_id. owner authorizes the parent spend; owner_puzzle_hash is the store owner recorded in the singleton (and the target of the owner-discovery hint + any change). params carries the first root, the required size bucket, and optional metadata. The store is minted with the file launcher discriminator (StoreKind::File), byte-identical to existing on-chain DIG stores.

To root a store in a DID, pass the DID-authorized coin as parent_coin with a StoreOwner::Custom inner spend satisfying the DID puzzle — owner discovery (crate::get_store_did_owner) then resolves the DID via dig-merkle. Returns the UNSIGNED launch spend.

§Errors

Returns a DigStoreResult error if the spend cannot be constructed (invalid metadata / size / fee overflow).