delvingbitcoin

Op_inout_amount

Original Postby Chris_Stewart_5

Posted on: February 12, 2024 15:05 UTC

The OP_INOUT_AMOUNT is a proposed addition aimed at enhancing the functionality of Bitcoin's Script interpreter by introducing the ability to push input values and a set of output values onto the stack.

The draft for this Bitcoin Improvement Proposal (BIP) can be found here, along with its implementation in this GitHub repository. This proposal is part of an effort to explore its integration with a 64bit op code, detailed further in a pull request (PR) and discussed extensively on Delving Bitcoin.

One of the main design considerations highlighted pertains to the current limitation where only the input and output amounts at the index being verified by the Script interpreter are pushed. This approach, while straightforward to implement, raises questions about whether it would be more beneficial to verify beyond the immediate input and output at the current index, drawing parallels with the functionality of SIGHASH flags. Feedback and thoughts from the community are sought to explore potential enhancements in this area.

From an implementation standpoint, modifications were made to the BaseTransactionSignatureChecker, introducing two new methods: GetNIn(), which identifies the input index currently under verification, and GetTransactionData(), providing access to both the funding output and the set of outputs being spent. These additions, though positioned as a convenient solution, prompt a discussion around whether there might be a more suitable structural placement for these functionalities within the existing framework. The broader ambition guiding these developments is to leverage these innovations for the eventual support of [OP_TLUV](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019419.html).