Skip to main content

Module receipt

Module receipt 

Source
Expand description

ai.hyprstream.ledger.receipt — a dual-signed usage record.

{
  "lexicon": 1,
  "id": "ai.hyprstream.ledger.receipt",
  "defs": { "main": { "type": "record", "key": "tid", "record": {
    "type": "object",
    "required": ["allocation", "spender", "host", "transferId", "quantum"],
    "properties": {
      "allocation": { "type": "string", "format": "cid" },
      "spender":    { "type": "string" },
      "host":       { "type": "string" },
      "transferId": { "type": "string" },
      "quantum":    { "type": "integer", "minimum": 0 }
    }
}}}

A receipt records one spend against a held crate::ledger::AllocationRecord. It binds both principals — the #681 two-principal vocabulary — so the record attests who spent and who served:

  • allocation — CID of the allocation/grant the spend draws down (format: "cid" string).
  • spender — the spending principal. For a pseudonymous-tier service this is the subject’s pairwise per-cell identifier (#928 rule 7), never a root DID — a cell sees only the identifier the subject presents to it.
  • host — the serving principal (the second of the two principals; the party on whose infrastructure the spend occurred).
  • transferId — the spend’s idempotency key. The write path derives the receipt’s rkey from it, giving at-least-once (idempotent) receipt delivery: re-publishing the same transferId advances the same record.
  • quantum — the amount spent, in the allocation unit’s smallest quantum.

Structs§

ReceiptRecord
An ai.hyprstream.ledger.receipt record.

Constants§

COLLECTION_NSID
The NSID of this record type.