Opcodes · splice · enabled
OP_CAT (0x7e)
Concatenates the top two items. Disabled in Bitcoin since 2010 and re-enabled on BCH in May 2018. Covenants use it to build output scripts on the stack.
Verified
- Stack in → out
- a b → a‖b
- Cost
- Base instruction cost 100 plus result length. The result may be up to 10,000 bytes since 2025 (was 520).
- Bitcoin status
- Proposed for Bitcoin (BTC)Disabled in BTC since 2010. BIP-347 proposes re-adding it in Tapscript via OP_SUCCESS126 (same byte, 0x7e); not activated.
Example
<0x76a914> <pkh> OP_CAT <0x88ac> OP_CAT OP_0 OP_OUTPUTBYTECODE OP_EQUAL | Step | Stack after (top on the right) | What happens |
|---|---|---|
<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. |
Step through it opcode by opcode in Bitauth IDE, the in-browser BCH VM debugger.
Where OP_CAT is used
- Upgrade 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.
- Contracts CashScript bytes concatenation : The + operator on bytes compiles to OP_CAT, so every CashScript covenant that assembles an output script uses it.
- Upgrade May 2020: SigChecks and OP_REVERSEBYTES : Before OP_REVERSEBYTES, contracts reversed byte order with chains of OP_SPLIT, OP_SWAP and OP_CAT.