Opcodes · apilamiento · habilitado
OP_0 (0x00)
Apila una cadena de bytes vacía, que la VM interpreta como el número 0 y como falso.
Verificado
- Pila: entrada → salida
- ∅ → 0
- Desde
- Script original de Bitcoin
- Costo
- Base instruction cost 100; pushes 0 bytes.
- Estado en Bitcoin
- Igual en Bitcoin (BTC)
- También conocido como
- OP_FALSE
Ejemplo
OP_0 OP_IF <0x01> OP_ELSE <0x02> OP_ENDIF <0x02> OP_EQUAL | Paso | Pila después (cima a la derecha) | Qué ocurre |
|---|---|---|
OP_0 | 0x | Pushes an empty item: the number 0, and false. |
OP_IF | ∅ | Pops the false item and skips to OP_ELSE; <0x01> never runs. |
<0x02> | 0x02 | The OP_ELSE branch runs. |
OP_ENDIF | 0x02 | Closes the conditional. |
<0x02> | 0x02 0x02 | |
OP_EQUAL | 1 | The ELSE branch ran, so the script ends true. |
Recórrelo opcode por opcode en Bitauth IDE, el depurador de la VM de BCH en el navegador.
Dónde se usa OP_0
- Contratos CashScript function selector : A CashScript contract with several functions picks one by an index the spender pushes. Index 0 is an empty push, which minimal encoding writes as OP_0.
- Tutorial Token Pioneers Tutorial 4: parsable NFTs : Decodes NFT commitment bytecode that starts with OP_0 OP_TOALTSTACK.
- Actualización November 2019: Schnorr multisig and MINIMALDATA : Made minimal pushes a consensus rule, so an empty or zero push must be OP_0.
- CHIP VM Limits: Targeted Virtual Machine Limits : Sets the base instruction cost of 100 that OP_0 pays.