TYPE 0x0805 · GOVERNANCE FAMILY
RELATIVE_VALUE
Anti-siphon ratio enforcement. Ensures the output value maintains a minimum ratio relative to the input value. Uses integer ratio arithmetic with 128-bit overflow protection. No Tapscript equivalent.
Governance Non-InvertibleLadder Diagram
Fields
| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| numerator | NUMERIC | 1-4 B | Conditions | Ratio numerator (≥ 0). The minimum fraction of input that must appear in output. |
| denominator | NUMERIC | 1-4 B | Conditions | Ratio denominator (> 0). Divides the numerator to form the ratio. |
Wire Format Breakdown
0x0805
0
2
NUMERIC · numerator
NUMERIC · denominator
Conditions = 14 bytes
0x0805
0
0
Witness = 4 bytes
Total
20 bytes
Evaluation Logic
1.Collect conditions NUMERICs. Fewer than 2 → ERROR. ReadNumeric the first as
numerator and the second as denominator; either undecodable → ERROR2.Validate:
numerator < 0 or denominator ≤ 0 → ERROR. Defence-in-depth uint32 range check: numerator > 0xFFFFFFFF or denominator > 0xFFFFFFFF → ERROR (overflow guard for the cross-multiply).3.Special case:
numerator == 0 → SATISFIED immediately (the inequality 0 ≥ output * 0 trivially holds).4.Cross-multiply via
__int128: lhs = (__int128)output_amount * denominator, rhs = (__int128)input_amount * numerator. v0.12 audit-8b F3 fix — pre-v0.12 the comparison used a quotient/remainder decomposition that could overflow int64 (UB → consensus split between compilers). Both products fit in 128 bits because amounts are bounded by MAX_MONEY and num/denom by 2³².5.If
lhs ≥ rhs → SATISFIED; else → UNSATISFIEDWorked Example
Ratio: 9/10 (90% minimum retention)
Input: 10,000 sats. Output: 9,000 sats.
lhs = 9,000 × 10 = 90,000
rhs = 10,000 × 9 = 90,000
90,000 ≥ 90,000 → SATISFIED
Same ratio, output: 8,999 sats.
lhs = 8,999 × 10 = 89,990
rhs = 10,000 × 9 = 90,000
89,990 < 90,000 → UNSATISFIED (1 sat short)
JSON Wire Format
{
"type": "RELATIVE_VALUE",
"fields": [
{ "type": "NUMERIC", "value": 9 },
{ "type": "NUMERIC", "value": 10 }
]
}Common ratios: 9/10 (90%), 99/100 (99%), 1/1 (100% — no value loss allowed), 19/20 (95%).
Use Cases
Anti-Fee-Siphon
Prevents a compromised hot key from draining value through excessive fees. A 99/100 ratio caps fee extraction to 1% of the UTXO value per spend, regardless of fee rate.
Recursive Covenant Value Preservation
Combined with RECURSE_SAME, ensures each recursive spend preserves at least N% of value in the covenant output. Creates a decay curve that protects against value extraction over multiple hops.
Treasury Guard
DAO treasury UTXOs with 95/100 ensure no single spend can extract more than 5% of treasury value. Combined with EPOCH_GATE, creates rate-limited treasury disbursement.