Opcodes · empalme · habilitado
OP_CAT (0x7e)
Concatena los dos elementos superiores. Deshabilitado en Bitcoin desde 2010 y rehabilitado en BCH en mayo de 2018. Los covenants lo usan para construir scripts de salida en la pila.
Verificado
- Pila: entrada → salida
- a b → a‖b
- Costo
- Base instruction cost 100 plus result length. The result may be up to 10,000 bytes since 2025 (was 520).
- Estado en Bitcoin
- Propuesto para Bitcoin (BTC)Disabled in BTC since 2010. BIP-347 proposes re-adding it in Tapscript via OP_SUCCESS126 (same byte, 0x7e); not activated.
Ejemplo
<0x76a914> <pkh> OP_CAT <0x88ac> OP_CAT OP_0 OP_OUTPUTBYTECODE OP_EQUAL | Paso | Pila después (cima a la derecha) | Qué ocurre |
|---|---|---|
<0x76a914> | 76a914 | P2PKH prefix: OP_DUP OP_HASH160, push 20 bytes. |
<pkh> | 76a914 pkh | A 20-byte public key hash, from the contract or the spender. |
OP_CAT | 76a914‖pkh | |
<0x88ac> | 76a914‖pkh 88ac | P2PKH suffix: OP_EQUALVERIFY OP_CHECKSIG. |
OP_CAT | 76a914‖pkh‖88ac | A complete 25-byte P2PKH locking script. |
OP_0 | 76a914‖pkh‖88ac 0 | |
OP_OUTPUTBYTECODE | 76a914‖pkh‖88ac out0 | The locking script of output 0. |
OP_EQUAL | 1 | True only if output 0 pays that address. This is a covenant. |
Recórrelo opcode por opcode en Bitauth IDE, el depurador de la VM de BCH en el navegador.
Dónde se usa OP_CAT
- Actualización May 2018: 32 MB blocks and restored opcodes : Re-enabled OP_CAT on BCH, with OP_SPLIT as its inverse.
- CHIP Native Introspection Opcodes : Introspection opcodes such as OP_OUTPUTBYTECODE read the spending transaction. OP_CAT builds the bytes to compare them with.
- CHIP VM Limits: Targeted Virtual Machine Limits : Raised the largest OP_CAT result from 520 to 10,000 bytes in May 2025.
- Contratos CashScript bytes concatenation : The + operator on bytes compiles to OP_CAT, so every CashScript covenant that assembles an output script uses it.
- Actualización May 2020: SigChecks and OP_REVERSEBYTES : Before OP_REVERSEBYTES, contracts reversed byte order with chains of OP_SPLIT, OP_SWAP and OP_CAT.