Core Primitives
CashScript Covenants
P2SH32 contracts that enforce exactly what outputs a transaction must produce
CashTokens NFTs
40-byte NFT commitments carry all mutable state for each covenant UTXO
Product Architecture
Every FlowGuard product follows the same pattern:- Deploy — A covenant UTXO is created with parameters compiled into bytecode (immutable) and initial state in the NFT commitment (mutable).
- State Transitions — Each function call consumes the input UTXO, validates the transition, and produces a new UTXO with updated NFT state.
- Settlement — When the covenant reaches a terminal state (COMPLETED or CANCELLED), funds are distributed and the UTXO is consumed without replacement.
State Machine
All covenants share a common status field in their NFT commitment:| Status | Value | Description |
|---|---|---|
ACTIVE | 0 | Normal operating state |
PAUSED | 1 | Temporarily frozen by authority |
CANCELLED | 2 | Terminated early, funds returned |
COMPLETED | 3 | All obligations fulfilled |
The
CANCELLED status byte is 0x02 in the on-chain NFT commitment. Terminal states consume the covenant UTXO without producing a replacement NFT output.Flags Bitmap
Every covenant has aflags byte in its NFT commitment at position [1]:
| Bit | Mask | Meaning |
|---|---|---|
| 0 | 0x01 | FLAG_CANCELABLE — sender can cancel |
| 1 | 0x02 | FLAG_TRANSFERABLE — recipient can transfer |
| 2 | 0x04 | FLAG_USES_TOKENS — covenant holds CashToken FTs (not BCH) |
Vault-Covenant Relationship
Covenants are linked to a Vault viavaultId compiled into the bytecode. This ties each streaming or distribution contract back to its treasury source for accounting and access control.

