Skip to main content

Module allocation

Module allocation 

Source
Expand description

ai.hyprstream.ledger.allocation — an issuer-signed grant record (the held entitlement / inventory line).

{
  "lexicon": 1,
  "id": "ai.hyprstream.ledger.allocation",
  "defs": { "main": { "type": "record", "key": "tid", "record": {
    "type": "object",
    "required": ["grant", "unit", "amount", "epoch", "issuer", "holder", "class"],
    "properties": {
      "grant":  { "type": "string", "format": "cid" },
      "unit":   { "type": "object",
                  "required": ["code", "issuer"], "properties": {
                    "code":   { "type": "string" },
                    "issuer": { "type": "string", "format": "did" } } },
      "amount": { "type": "integer", "minimum": 0 },
      "epoch":  { "type": "integer", "minimum": 0 },
      "issuer": { "type": "string", "format": "did" },
      "holder": { "type": "string" },
      "class":  { "type": "string", "enum": ["prepaid", "underwritten"] }
    }
}}}
  • grant — the CID of the UCAN grant this allocation realizes (format: "cid" string; the UCAN lives outside this repo’s MST).
  • unit — the credit unit, which names its issuer (Unit): credits are issuer liabilities (D8-1), never bearer tokens. There is no bare unit.
  • amount — the granted amount, in the unit’s smallest quantum (u64).
  • epoch — the issuance epoch (u64).
  • issuer — the issuing DID. Must equal unit.issuer (an allocation is only ever the unit-issuer’s own liability).
  • holder — the subject: a pseudonymous did:key/did:at9p or a pairwise per-cell identifier (#928 rule 3). Never forced to a root/did:web identity.
  • class — the grant GrantClass: prepaid (bearer-like, lease-mode-only, issuable to a bare did:key, needs no identity) vs underwritten (issuer-relationship, the only detect-mode-eligible class). The class↔mode coupling is a protocol rule (#928 rule 4).

Structs§

AllocationRecord
An ai.hyprstream.ledger.allocation record.
Unit
A credit unit that names its issuer.

Enums§

GrantClass
The grant class — couples anonymity to spend mode (#928 rule 4).

Constants§

COLLECTION_NSID
The NSID of this record type.