TYPE 0x0631 · PLC FAMILY
COUNTER_DOWN
Down counter. SATISFIED while the count is greater than zero (can still decrement). Paired with RECURSE_MODIFIED to decrement each covenant spend. Once count reaches zero, the block becomes UNSATISFIED.
PLC Non-InvertibleLadder Diagram
Fields
| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| count | NUMERIC | 1-4 B | Conditions | Current counter value (decremented by RECURSE_MODIFIED each spend). Must be ≥ 0; count == 0 → UNSATISFIED. |
| event_pubkey | PUBKEY | 32-33 B | Witness | Event signer key (folded out of conditions via merkle_pub_key; revealed at spend time and bound by Merkle proof). Required by HasRequiredPubkeys(block, 1) at consensus. |
Public key folded into Merkle leaf via merkle_pub_key (PubkeyCountForBlock = 1). No key field in conditions.
Wire Format Breakdown
0x0631
0
1
NUMERIC · 3B
Conditions ≈ 9 bytes
0x0631
0
1
PUBKEY · 35B
Witness ≈ 39 bytes
Total
≈ 48 bytes
Evaluation Logic
1.HasRequiredPubkeys(block, 1): at least one PUBKEY (the event-signer key) must be present in the merged block; else → ERROR. Identity is bound at MLSC-proof level via merkle_pub_key.
2.Collect NUMERICs. None present → ERROR. ReadNumeric the first as
count; undecodable → ERROR3.If
count < 0 → ERROR4.If
count > 0 → SATISFIED (counter active; pair with RECURSE_MODIFIED to decrement in the output); else (== 0) → UNSATISFIEDReturn Values
| Condition | Result |
|---|---|
| No PUBKEY in the merged block | ERROR |
No NUMERIC field, or undecodable, or count < 0 | ERROR |
count == 0 (countdown done) | UNSATISFIED |
count > 0 (counter active) | SATISFIED |
JSON Wire Format
Conditions (counter at 5, counting down)
{
"type": "COUNTER_DOWN",
"inverted": false,
"fields": [
{ "type": "NUMERIC", "value": 5 }
]
}This counter has 5 remaining uses. Each spend authorized by the event signer with RECURSE_MODIFIED decrements the count. After 5 spends, count reaches 0 and the block becomes UNSATISFIED.
Use Cases
Limited-Use Spending Authorization
A covenant that permits exactly N spends before the authorization expires. Each spend decrements the counter. Once exhausted, the spending path is permanently closed within the covenant chain.
Ticket Systems
Digital tickets represented as counter-gated covenants. Each use (spend + recurse) consumes one ticket. When all tickets are used, the covenant transitions to a terminal state.
Finite Resource Allocation
Allocate a fixed number of operations to a key holder. The counter tracks remaining allocations, ensuring the resource budget cannot be exceeded regardless of how the covenant is spent.