bitcoin-dev

CTV++ OP_TEMPLATEHASH & OP_INPUTAMOUNTS

CTV++ OP_TEMPLATEHASH & OP_INPUTAMOUNTS

Original Postby moonsettler

Posted on: December 25, 2024 20:57 UTC

In the ongoing discussions within the Bitcoin development community, there has been a notable emphasis on addressing challenges associated with working with CTV (CheckTemplateVerify), particularly in the realm of vaults.

Developers have been exploring solutions to circumvent these issues, leading to propositions such as OP_TX and OP_TXHASH/VERIFY. These proposals aim to expand functionality but also introduce complexities such as the reliance on 64-bit integer arithmetic for handling transaction amounts.

An alternative approach has been suggested that seeks to bridge gaps without resorting to state-carrying covenants or intricate introspection. This proposal introduces two new opcodes - OP_TEMPLATEHASH and OP_INPUTAMOUNTS - to enhance the utility of CTV. OP_TEMPLATEHASH is designed to construct a template hash from the stack, facilitating a more flexible interaction with transaction elements. The use of OP_INPUTAMOUNTS, exclusive to Taproot transactions, allows for the aggregation of input amounts based on specific criteria, thereby enabling a variety of transactional structures including those beneficial for vault withdrawals. This opcode supports various operations by calculating the sum of input amounts either in totality, from the last abs(n) inputs including the current one, or from the first n inputs of a transaction, with certain conditions applied to ensure operational integrity.

The significance of these additions lies in their potential to support complex contract structures, such as combining UTXOs locked by the same script for purposes like vault withdrawals to a staging address. This capability is particularly useful as it accommodates any amount of UTXOs, contrary to the limitations present in basic CTV vaults, and includes provisions for fee payments and change address registration within the contract itself.

The conceptual groundwork for these proposals owes much to the contributions of several key figures within the cryptocurrency development sphere. Jeremy Rubin's earlier work laid the foundational ideas that these opcodes build upon, while James O'Beirne and Salvatore Ingala have been instrumental in advancing the understanding and application of vaults and covenant designs respectively. Their collective efforts underscore a collaborative push towards refining Bitcoin's programmability and security features.

For further details on the technical implementation and examples of these proposed opcodes, refer to the comprehensive guide available at this link.

Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from authoritative bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiBitcoin Transcripts Review
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project?

Give Feedback