Speedy covenants (OP_CAT2)



Summary:

In a discussion on the bitcoin-dev mailing list, ZmnSCPxj proposed using `OP_SUBSTR` or `OP_SPLIT` instead of `OP_CAT` for script covenant operations. He suggested that with `OP_SPLIT`, a string can be split into N pieces, while `OP_SUBSTR` can be used to generate smaller parts of strings. ZmnSCPxj argued that these opcodes are better than `OP_CAT` because they ensure that the script always gets smaller and only one byte is the smallest unit in the script.In the same conversation, ZmnSCPxj clarified that `OP_CAT` does not make all covenant opcodes recursive by itself, but it can make any opcode recursive. In response to a question about why `OP_CSFS+CAT` enables recursive covenants while `CTV+CAT` does not, ZmnSCPxj explained that in `CTV`, the input's `prevout scriptPubKey` cannot be verified on the stack, whereas it can be verified with `OP_CSFS`. However, he also noted that recursion can be achieved even without verifying the `prevout scriptPubKey` by including a copy of the script as an initial push, which can then be reconstructed using `OP_CAT` followed by `PUSH()`. Finally, ZmnSCPxj pointed out that `OP_CAT` is not enabled until after it is confirmed that recursive covenants are not unsafe.


Updated on: 2023-06-15T20:34:19.979094+00:00