Flexible comparator block. Compares the transaction input_amount against one or two reference values using a specified comparison operator. Supports equality, inequality, ordering, and range checks. No Tapscript equivalent exists.
PLCInvertible
Ladder Diagram
Fields
Field
Data Type
Size
Side
Description
operator
NUMERIC
1-4 B
Conditions
Comparison operator code (NUMERIC[0])
value_b
NUMERIC
1-4 B
Conditions
Primary comparison value (NUMERIC[1])
value_c
NUMERIC
1-4 B
Conditions
Upper bound for IN_RANGE operator (NUMERIC[2], optional)
value_c is only required when operator is IN_RANGE (0x07). The input_amount comes from the evaluation context.
Operator Codes
Code
Name
Operation
0x01
EQ
input_amount == value_b
0x02
NEQ
input_amount != value_b
0x03
GT
input_amount > value_b
0x04
LT
input_amount < value_b
0x05
GTE
input_amount ≥ value_b
0x06
LTE
input_amount ≤ value_b
0x07
IN_RANGE
value_b ≤ input_amount ≤ value_c
Wire Format Breakdown
Example with IN_RANGE operator (3 NUMERIC fields):
Enforce minimum or maximum transaction amounts at the covenant level. A UTXO can require that spends exceed a minimum value (GT/GTE) or stay below a ceiling (LT/LTE), creating on-chain spending policies.
Conditional Path Selection
Different covenant paths can use different COMPARE operators to create amount-based routing. Small amounts take one path (LT), large amounts take another (GTE), enabling tiered processing.
Range Validation
IN_RANGE ensures transaction amounts fall within acceptable bounds. Useful for fee enforcement, deposit limits, or ensuring outputs stay within protocol-defined value ranges.