Block Reference
RECURSE_COUNT
Recursion Family
TYPE 0x0404 · RECURSION FAMILY

RECURSE_COUNT

Countdown covenant. Each spend decrements the count parameter by one. When count reaches zero the covenant terminates and the UTXO is free. Provides a finite-hop covenant chain with deterministic termination. No Tapscript equivalent.

Recursion Invertible
RECURSE_COUNT count == 0 ? free : output(count - 1) decrement on each spend — terminates at zero finite hop chain Countdown covenant — exactly N spends before termination
FieldData TypeSizeSideDescription
countNUMERIC1-4 BConditionsRemaining hop count (≥ 0). Decremented by 1 on each spend. Covenant terminates when count reaches 0.
0x0404 0 1 NUMERIC · count Conditions = 9 bytes
0x0404 0 0 Witness = 4 bytes
Total 15 bytes
1.Read count from NUMERIC field
2.If count < 0 → ERROR
3.If count == 0 → SATISFIED (covenant terminates, no re-encumbrance required)
4.If count > 0: verify output carries RECURSE_COUNT with count = count - 1
5.Output verified → SATISFIED
6.Output missing or count mismatch → UNSATISFIED

3-hop payment channel: count = 3

Spend 1: count=3 > 0, output must have RECURSE_COUNT(2) → SATISFIED
Spend 2: count=2 > 0, output must have RECURSE_COUNT(1) → SATISFIED
Spend 3: count=1 > 0, output must have RECURSE_COUNT(0) → SATISFIED
Spend 4: count=0 → SATISFIED (covenant done, output is free)
{
  "type": "RECURSE_COUNT",
  "fields": [
    { "type": "NUMERIC", "value": 3 }
  ]
}

Count value determines the exact number of covenanted hops remaining. A count of 0 means the covenant is already satisfied.

N-Hop Payment Channels
A payment channel that allows exactly N intermediate hops before the funds become unencumbered. Each routing hop decrements the counter, ensuring the payment reaches its destination within a bounded number of steps.
Finite State Machines
Combined with other blocks, implements a state machine with a known maximum number of transitions. The count acts as a fuel meter, guaranteeing termination after N state changes.
Countdown Triggers
A multi-party protocol where N participants must each sign and forward the UTXO. After all N parties have acted (count reaches 0), the final output is free to be spent without restrictions.
← RECURSE_UNTIL RECURSE_SPLIT →