Block Reference
RECURSE_MODIFIED
Recursion Family
TYPE 0x0402 · RECURSION FAMILY

RECURSE_MODIFIED

Covenant with controlled mutations. Output must match input conditions except for specified numeric parameter changes. Each mutation applies an additive delta to a targeted parameter at a specific (rung, block, param) position. No Tapscript equivalent.

Recursion Invertible
RECURSE_MODIFIED output[r][b][p] == input[r][b][p] + delta all other parameters must match exactly multi-mutation support Controlled parameter evolution — additive delta per spend
FieldData TypeSizeSideDescription
max_depthNUMERIC1-4 BConditionsMaximum recursion depth (> 0). Bounds the chain of modified spends.
block_idxNUMERIC1-4 BConditionsTarget block index within rung 0 (legacy) or per-mutation target (new format).
param_idxNUMERIC1-4 BConditionsTarget parameter index within the block.
deltaNUMERIC1-4 BConditionsAdditive delta applied to the target parameter. Can be positive or negative.

Legacy format: max_depth, block_idx, param_idx, delta (4 NUMERICs, single mutation targeting rung 0).
New format: max_depth, num_mutations, then per mutation: rung_idx, block_idx, param_idx, delta (2 + 4N NUMERICs).

0x0402 0 4 NUMERIC · max_depth NUMERIC · block_idx NUMERIC · param_idx NUMERIC · delta Conditions (legacy) = 24 bytes
0x0402 0 0 Witness = 4 bytes
Total 28 bytes (legacy, single mutation)
1.Read max_depth from first NUMERIC field
2.If max_depth ≤ 0 → UNSATISFIED
3.Parse mutation specs: detect legacy (4 fields, rung 0 implicit) or new format (2 + 4N fields)
4.For each mutation, record target position (rung_idx, block_idx, param_idx) and delta
5.Deserialize output conditions from spending output
6.Verify: all non-targeted parameters match input exactly
7.Verify: each targeted parameter equals input_value + delta
8.All checks pass → SATISFIED
9.Any mismatch → UNSATISFIED

Decrementing a counter: rung 0, block 1, param 0, delta = -1

Input has param[0][1][0] = 5. Expected output param = 5 + (-1) = 4.

max_depth = 10 > 0 → proceed
Target: rung=0, block=1, param=0, delta=-1
Output param[0][1][0] = 4 == 5 + (-1) → SATISFIED

Output tries delta = -2 instead of -1:

Output param[0][1][0] = 3 ≠ 5 + (-1) = 4 → UNSATISFIED
{
  "type": "RECURSE_MODIFIED",
  "fields": [
    { "type": "NUMERIC", "value": 10 },
    { "type": "NUMERIC", "value": 1 },
    { "type": "NUMERIC", "value": 0 },
    { "type": "NUMERIC", "value": -1 }
  ]
}

Legacy format shown: max_depth=10, target rung 0 (implicit) block 1 param 0, delta=-1 (decrement by 1 each spend).

Decrementing Counters
A covenant parameter decreases by 1 each spend. When it reaches 0, another block (e.g., a conditional check) can trigger a different execution path. Useful for countdown-gated releases.
Progressive Timelock Relaxation
Each spend reduces a CSV timelock parameter by a fixed amount, progressively shortening the required wait between spends. Creates a decaying cooldown curve over the covenant chain.
Evolving Covenant Parameters
Any numeric parameter in the covenant can be systematically evolved. Threshold values, ratios, or counts can increase or decrease with each spend according to a deterministic schedule.
← RECURSE_SAME RECURSE_UNTIL →