delvingbitcoin
CTV++ OP_TEMPLATEHASH and OP_INPUTAMOUNTS
Posted on: January 3, 2025 15:39 UTC
The discussion revolves around the functionality and potential applications of OP_TEMPLATEHASH, highlighting its advantages and possible enhancements for efficiency.
The person acknowledges the utility of OP_TEMPLATEHASH in comparison to other options like TXHASH or OP_CAT, noting its ergonomic design which makes it appealing for use. There's an appreciation for the way OP_TEMPLATEHASH operates, suggesting it offers benefits similar to what one might achieve with OP_PAIRCOMMIT, particularly when considering unconventional uses such as manipulating the outputs field.
There's a suggestion to improve the functionality of OP_TEMPLATEHASH by enabling the passing of a sha256 midstate for sequences and outputs, introducing the idea of using a negative index to indicate additional elements following the midstate. This proposal aims at making data handling more compact, potentially enhancing the overall efficiency of operations involving OP_TEMPLATEHASH.
Additionally, the introduction of new operation codes, OP_PUSHTEMPLATE and OP_TEMPLATEHASH, is proposed as a means to reduce transaction sizes. By avoiding the replication of the entire transaction on the witness stack, these new opcodes could offer a more streamlined approach to handling transactions. However, there is some reservation expressed about the implementation of an opcode for input amounts, indicating that further consideration and discussion are necessary before moving forward with this aspect.