Opcodes · arithmetic · enabled

OP_WITHIN (0xa5)

Pushes 1 if x is at least min and less than max, otherwise 0. Since May 2025 numbers may be up to 10,000 bytes long (BigInt).

Verified
Stack in → out
x min max → min<=x<max
Since
Original Bitcoin script
Cost
Base instruction cost 100 plus the byte length of the pushed result (2025 VM limits).
Bitcoin status
Same in Bitcoin (BTC)BTC limits arithmetic inputs to 4 bytes.

Example

OP_5 OP_1 OP_10 OP_WITHIN

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

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