Opcodes · arithmetic · enabled

OP_MIN (0xa3)

Pushes the smaller of two numbers. Since May 2025 numbers may be up to 10,000 bytes long (BigInt).

Verified
Stack in → out
a b → min(a,b)
Since
Original Bitcoin script
Cost
Base instruction cost 100, plus the result length, plus the result length again to cover number encoding (2025 VM limits).
Bitcoin status
Same in Bitcoin (BTC)BTC limits arithmetic inputs to 4 bytes.

Example

<fee> <1000> OP_MIN
Step Stack after (top on the right) What happens
<fee> 1500 Say the spender asks for a 1,500-satoshi fee.
<1000> 1500 1000 The contract's cap.
OP_MIN 1000 The smaller number wins: the fee is capped at 1,000.

Step through it opcode by opcode in Bitauth IDE, the in-browser BCH VM debugger.

Where OP_MIN is used

Sources

  1. Libauth BCH_2023_05 opcodes (bch-2023-opcodes.ts)
  2. CHIP-2021-05 VM Limits: Targeted Virtual Machine Limits
  3. CHIP-2024-07 BigInt: High-Precision Arithmetic