Opcodes · aritmética · habilitado
OP_MIN (0xa3)
Apila el menor de dos números. Desde mayo de 2025, los números pueden tener hasta 10.000 bytes de longitud (BigInt).
Verificado
- Pila: entrada → salida
- a b → min(a,b)
- Desde
- Script original de Bitcoin
- Costo
- Base instruction cost 100, plus the result length, plus the result length again to cover number encoding (2025 VM limits).
- Estado en Bitcoin
- Igual en Bitcoin (BTC)BTC limits arithmetic inputs to 4 bytes.
Ejemplo
<fee> <1000> OP_MIN | Paso | Pila después (cima a la derecha) | Qué ocurre |
|---|---|---|
<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. |
Recórrelo opcode por opcode en Bitauth IDE, el depurador de la VM de BCH en el navegador.
Dónde se usa OP_MIN
- Contratos CashScript min() : The built-in min(a, b) compiles to OP_MIN. Contracts use it to cap fees, payouts and withdrawals.
- CHIP BigInt: High-Precision Arithmetic for Bitcoin Cash : Lets OP_MIN compare numbers up to 10,000 bytes long since May 2025.
- Actualización May 2022: native introspection and 64-bit math : Widened script numbers to 64 bits, enough to compare satoshi amounts directly.