Expand description
§chip35-dl-coin
Isolated CHIP-0035 Chia DataLayer store coin driver. Provides the offline spend builders to mint, update, and burn (melt) DataLayer stores, plus keyless spend-bundle serialization helpers. No networking, no signing, no key derivation — those are the caller’s responsibility.
Structs§
- Attribute
- A single CHIP-0007 attribute (trait) on an NFT item.
- Bulk
Mint Response - The result of a bulk mint: the coin spends + the launcher id of every minted NFT (in order).
- Bytes
- Cat
- Contains all information needed to spend the outer puzzles of CAT coins.
The
CatInfois used to construct the puzzle, but theLineageProofis needed for the solution. - CatInfo
- Information needed to construct the outer puzzle of a CAT.
This includes the
CatLayerandRevocationLayerif present. However, it does not include the inner puzzle, which must be stored separately. - Chip0007
Metadata - A CHIP-0007 metadata document (the off-chain JSON an NFT’s
metadata_urispoint at). - Coin
- Coin
Selection - A successful selection: the chosen coins (descending by amount, tie-broken by coin id) plus the
selected total and the change over
target.coins[0]is the largest — the natural lead coin for the builders, which spend element 0 as the lead. - Coin
Spend - Collection
- A CHIP-0007 collection definition: the shared identity + economics across every item.
- Collection
Attribute - A single CHIP-0007 collection-level attribute (icon/banner/website/twitter/etc).
- Collection
Ref - The collection block embedded in a CHIP-0007 item, linking the item to its
Collection. - Create
DidResponse - The result of creating a DID: the coin spends + the new DID’s identifiers for storage/attribution.
- Data
Store - Everything that is required to spend a
Datastorecoin. - Data
Store Info - Data
Store Metadata - DidAttribution
- DID attribution for a mint: ties the NFT to a creator-identity DID so collectors can verify who
minted it (roadmap #38’s building block). The DID owner must authorize the mint elsewhere in the
bundle (the DID spend); here it only supplies the on-chain
TransferNftcondition. - DidInfo
- Information needed to construct the outer puzzle of a DID. It does not include the inner puzzle, which must be stored separately.
- EveProof
- Hashed
Ptr - Issue
CatResponse - The result of issuing a CAT: the coin spends + the permanent asset id + the issued CAT coins.
- Lazy
Mint Claim Response - The result of a claim: the unroll+mint coin spends + the minted NFT identifiers.
- Lazy
Mint Commit Response - The result of a commit: the single DID spend + the precomputed per-item identifiers.
- Lazy
Mint Item - One precommitted item: its on-chain media metadata (URN + https fallback URIs + hashes) and its
royalty. The recipient/royalty puzzle hash come from the
Collection(shared across items). - Lazy
Mint Tree Descriptor - A keyless, serializable handle a caller PERSISTS after a commit so a claimer — who never saw the
commit call — can rebuild the exact item
iclaim spend. It captures everything the claim needs: the creator DID coin id (the commitment coins’ parent), the committed collection + items + policy + optional allowlist root, and the precomputed per-item commitment coins + launcher ids. - Lineage
Proof - Manifest
Item - One item in a parsed traits manifest. The toolkit produces this from a CSV/JSON manifest + the per-item capsule hashes; this crate consumes the parsed form only (no file IO).
- Manifest
Media - The on-chain media fields for a manifest item (mirrors
NftMediaMetadatain a serde-friendly, hex-hash shape for the parsed manifest). - Merkle
Membership Proof - A merkle membership proof for an allowlist-gated claim. The shape mirrors
chia_sdk_types::MerkleProof(and the on-chainmerkle_utils.clibproof shape): apathof direction bits and theproofsibling hashes along the path. - NftMedia
Metadata - The on-chain NFT metadata fields, with hashes already computed from the real bytes (#36).
- NftMint
Params - Everything needed to mint one NFT (a single-item mint; bulk mint is in [
crate::collection]). - NftMint
Response - The result of a mint: the coin spends to sign + a summary of the minted NFT for chaining/storage.
- NftOwnership
Proof - The facts a successful proof establishes about an NFT (all read from the chain, none asserted).
- Observed
Payment - What an observed payment looks like to the verifier (the paywall) once it has read the chain.
- Payment
Receipt - A verifiable description of the on-chain commitment a payment makes. The dapp/SDK keeps this and,
once the spend confirms, checks the owner actually received a coin matching it (see
verify_payment_receipt). It is the receipt a paywall verifies — it pins WHO is paid (owner puzzle hash), HOW MUCH, in WHICH asset, and the unlock NONCE. - Payment
Response - The result of building a payment: the coin spends to sign + the receipt to verify after confirm.
- Program
- Public
Key - Secret
Key - Signature
- Spend
Bundle - Subscription
Terms - The terms of a subscription a buyer authorizes once: pay
amount_per_periodofassettopayee_puzzle_hasheveryperiod_seconds, for at mostmax_periods. - Success
Response - Result of a store-creating/updating spend: the coin spends plus the resulting on-chain store state to feed into the next update.
Enums§
- Data
Store Inner Spend - Which delegated role authorizes a store update, carrying that role’s public key.
- Delegated
Puzzle - Error
- Errors produced by the DataLayer store spend builders.
- Gating
Error - The reasons an NFT gate can fail — actionable so a dapp can tell the user why access was denied.
- Lazy
Mint Policy - Who a claim mints to, and whether a claim must pay.
- Metadata
Error - Errors from CHIP-0007 metadata building/validation. Distinct from the spend-builder
Errorso JS gets actionable, metadata-specific messages. - Payment
Asset - Which asset a payment settles in.
- Paywall
Error - The reasons a paywall check can fail — actionable so the dapp/SDK can tell the user precisely what is wrong rather than a generic “access denied”.
- Proof
- Select
Coins Result - The discriminated outcome of
select_coins.NeedsConsolidationis deliberately distinct fromInsufficientFunds: the former means “the money is here but too fragmented”, the latter means “not enough money”. Every failure carries the counts the caller needs to drive a consolidation loop or an honest error.
Constants§
- CHIP0007_
FORMAT - The canonical CHIP-0007
formatdiscriminator value. - DATASTORE_
LAUNCHER_ HINT - DEFAULT_
COIN_ CAP - The default maximum number of coins a single selection (and thus a single spend bundle) will use. Chosen to keep a spend bundle comfortably within block/mempool cost limits; a caller may override it per selection.
- DIGSTORE_
OWNER_ HINT_ DOMAIN - Domain tag for the digstore-scoped owner DISCOVERY hint. Scoping the hint to digstores
(rather than hinting the raw owner puzzle hash) means a coinset
get_coin_records_by_hint(digstore_owner_hint(owner_ph))query returns ONLY the owner’s DataLayer store launcher coins — never their ordinary XCH coins, which are hinted with the raw puzzle hash. Versioned so the derivation can evolve without ambiguity. - DIG_
ASSET_ ID - DIG CAT asset id (TAIL hash) on Chia mainnet. The single token a capsule (commit) is paid in.
- DIG_
TREASURY_ INNER_ PUZZLE_ HASH - The DIG treasury’s INNER (standard) puzzle hash — the recipient of every per-capsule DIG payment.
Functions§
- add_fee
- Build coin spends that reserve
feemojos from the spender’s own XCH coins, asserting concurrent spend ofcoin_ids(e.g. the singleton being updated/melted), returning change to the spender. Lets a singleton-only op (update/melt) carry a fee. - admin_
delegated_ puzzle_ from_ key - Build the Admin delegated puzzle for a synthetic key (hub Teams #43 — a team admin).
- build_
bulk_ mint - Build the spend bundle that bulk-mints every item in
itemsintocollection, attributed todid, authorized by a single DID spend. - build_
bulk_ mint_ funded - Build a MULTI-item DID-attributed bulk mint FUNDED by a separate XCH coin (#221).
- build_
bulk_ mint_ funded_ no_ did - Build a NON-DID MULTI-item (N>=1) bulk mint FUNDED by a COIN SET with a SINGLE network fee (#1132).
- build_
cat_ consolidation - Build the keyless spends that merge up to
capof the smallest CATcats(all of ONE asset id) into ONE output CAT coin oftotalback to the owner (self-send) (epic #410). - build_
cat_ payment - Build the spends for a buyer to pay the dapp owner
amountbase units of a CAT (incl. DIG) (roadmap #46). - build_
coin_ consolidation - Build the keyless spends that merge up to
capof the smallest XCHcoinsinto ONE output coin back to the owner (self-send oftotal - fee), reserving an optional networkfee(epic #410). - build_
dig_ store_ payment - Build the (UNSIGNED) DIG-CAT coin spends that pay
amountbase units of $DIG to the DIG treasury for a capsule (commit) — the canonical per-capsule store payment. - build_
lazy_ mint_ claim - A NON-owner unrolls + mints item
indexon demand, funding the 1-mojo launcher (+fee) fromclaimer_coins. No DID involvement — the claim is authorized by the precommit alone. - build_
lazy_ mint_ commit - The creator DID spends ONCE to precommit
itemsintocollection, attributed by lineage todid. - build_
subscription_ authorization - TODO(#46 subscriptions): build the one-time spend that FUNDS a subscription — locking
terms.amount_per_period * terms.max_periodsinto a time-locked / pre-authorized puzzle the dapp can claim one period at a time, with a buyer clawback path. Requires the recurring puzzle (see the module docs); NOT yet implemented. ReturnsWalletError::Parseuntil the puzzle ships. - build_
subscription_ claim - TODO(#46 subscriptions): build the spend the DAPP runs each period to CLAIM that period’s
amount_per_periodfrom a funded subscription (afterperiod_secondselapsed). Requires the recurring puzzle; NOT yet implemented. - build_
xch_ payment - Build the spends for a buyer to pay the dapp owner
amountmojos of XCH (roadmap #46). - create_
did - Build the spend bundle that creates a simple DID (one verification, no recovery list) owned by the minter.
- datastore_
from_ spend - Reconstruct a DataStore from the coin spend that CREATED its current coin. For an eve
store (no updates) this is the launcher coin’s spend; for an updated store it is the
latest update spend. Lets a client MELT a store it did not mint in-session (it fetches
the creating spend from a full node, then rebuilds the DataStore here).
prev_delegatedis the parent’s delegated-puzzle set ([] for an eve/owner-only store). Returns the reconstructed DataStore, or a Parse error if the spend is not a DataStore spend. - decode_
offer - Decode canonical offer text (
offer1...) into its spend bundle. - dig_
treasury_ payment_ coin - The DIG CAT payment coin a capsule (commit) pays to the treasury — what
build_dig_store_paymentemits. - digstore_
owner_ hint - Derive the digstore-scoped owner discovery hint =
sha256(DOMAIN || owner_puzzle_hash). It is emitted as the FIRST (indexed) memo on the launch CREATE_COIN so the store is discoverable on-chain by owner. The client (JS) and thedigstoreCLI MUST compute this identically (same domain tag, same byte order) or detection misses stores. - encode_
offer - Encode a spend bundle into canonical offer text (
offer1...). - generate_
item_ metadata - Generate the per-item CHIP-0007 metadata documents for a collection from a parsed manifest.
- hex_
spend_ bundle_ to_ coin_ spends - Decode a hex-encoded spend bundle into its coin spends (keyless).
- issue_
cat - Build the spend bundle that issues a single-issuance (fixed-supply) CAT.
- master_
to_ wallet_ unhardened - melt_
store - Build the spend that BURNS (melts) a store singleton, removing it from the chain.
- merkle_
membership_ root - Recompute the merkle root implied by a
leaf+ its membershipproof, using the EXACT algorithm ofchia_sdk_types::MerkleTreeand the on-chaininclude/merkle_utils.clib: leaves are hashedsha256(0x01 || leaf), internal nodessha256(0x02 || left || right), and at each step the path’s low bit selects whether the running hash is the right child (1) or the left child (0). A caller can compare the result against a known allowlist root to verify membership. - mint_
nft - Build the spend bundle that mints a single NFT whose media lives in a DIG capsule.
- mint_
nft_ with_ did - Mint a single NFT authorized by + attributed to a creator DID (roadmap #38).
- mint_
store - Build the spend bundle that LAUNCHES a new DataLayer store singleton.
- oracle_
delegated_ puzzle - Build the Oracle delegated puzzle: anyone may spend the store for the fixed
oracle_fee, paid tooracle_puzzle_hash. Unlike admin/writer it is keyed by a payment puzzle hash, not a public key — there is no signer; the fee is the gate. - oracle_
spend - Build the spend that exercises a store’s ORACLE delegated puzzle.
- payment_
nonce - Derive a 32-byte unlock nonce from arbitrary request bytes (e.g.
dapp_id || resource || user). - prove_
collection_ membership - Prove an NFT held by
claimed_owner_puzzle_hashis a member of the collection/creator identified byrequired_did(roadmap #46 collection-gating). - prove_
nft_ ownership - Prove an NFT is owned by
claimed_owner_puzzle_hash(roadmap #46 NFT-gating). - read_
nft_ ownership - Reconstruct the CURRENT
NftOwnershipProoffor an NFT from the coin spend that created its latest coin. - select_
coins - Select coins high-value-first to cover
target, using at mostcapcoins. - sha256
- SHA-256 of arbitrary bytes → the 32-byte hash pinned on-chain. The one true hash primitive for
data_hash,metadata_hash, andlicense_hash. - spend_
bundle_ to_ hex - Serialize a spend bundle to hex (keyless).
- synthetic_
puzzle_ hash - Compute the standard puzzle hash for a synthetic key — the convenience used to default the bulk-mint recipient to the minter’s own wallet.
- update_
store_ metadata - Build the spend that updates a store’s metadata (root hash, label, description, size, and
optional size-proof
program_hash). - update_
store_ ownership - Build the spend that transfers store ownership and/or replaces its delegated-puzzle set.
- validate_
uri_ hash - Validate URI↔hash agreement for one asset: the on-chain
expectedhash MUST equalsha256(bytes)of what the URI actually serves.whichis “data” | “metadata” | “license” for error reporting. This is the footgun-closing check roadmap #36 calls for — the on-chain hash must match the served bytes, or every verifying client rejects the NFT. - verify_
merkle_ membership - Verify that
leafis a member of the merkle tree whose root isroot, given a membershipproof. Returnstrueiffmerkle_membership_root(leaf, proof) == root. Constant in the proof length; does no allocation beyond the running hash. - verify_
payment_ receipt - Verify an observed payment unlocks a paywall: it must pay the required
owner_puzzle_hash, in the requiredasset, at leastmin_amount, and (whenrequire_nonceis set) carry that nonce (roadmap #46, pay-to-unlock). - writer_
delegated_ puzzle_ from_ key - Build the Writer delegated puzzle for a synthetic key (a revocable deploy token #17 / a hub Teams writer #43).
Type Aliases§
- Bytes32
- Did
- Contains all information needed to spend the outer puzzles of DID coins.
The
DidInfois used to construct the puzzle, but theProofis needed for the solution. - Wallet
Error - Alias so the copied driver bodies (which reference
WalletError) compile unchanged.