Opcodes · introspección · habilitado

OP_UTXOVALUE (0xc6)

Apila el valor en satoshis del UTXO gastado por la entrada i. Falla si el índice está fuera de rango.

Verificado
Pila: entrada → salida
i → sats
Costo
Base instruction cost 100 plus the byte length of the pushed result (2025 VM limits).
Estado en Bitcoin
No existe en Bitcoin (BTC)BTC has no native introspection opcodes. In Tapscript (BIP-342) this byte is an OP_SUCCESSx code reserved for future soft forks.

Ejemplo

OP_INPUTINDEX OP_UTXOVALUE <1000> OP_SUB OP_0 OP_OUTPUTVALUE OP_LESSTHANOREQUAL
Paso Pila después (cima a la derecha) Qué ocurre
OP_INPUTINDEX 0 This input's index, here 0.
OP_UTXOVALUE 100000 Say the coin it spends holds 100,000 satoshis.
<1000> 100000 1000 The most the spender may take as a fee.
OP_SUB 99000
OP_0 99000 0
OP_OUTPUTVALUE 99000 99500 Output 0 pays 99,500 satoshis.
OP_LESSTHANOREQUAL 1 Output 0 keeps all but at most 1,000 satoshis of the input, so the covenant passes.

Recórrelo opcode por opcode en Bitauth IDE, el depurador de la VM de BCH en el navegador.

Dónde se usa OP_UTXOVALUE

Fuentes

  1. CHIP-2021-02 Native Introspection Opcodes
  2. Libauth BCH_2023_05 opcodes (bch-2023-opcodes.ts)
  3. CHIP-2021-05 VM Limits: Targeted Virtual Machine Limits