Op_inout_amount

Feb 12 - May 8, 2025

  • The conversation revolves around the development and testing of new Script opcodes designed to enhance Bitcoin's scripting capabilities, specifically concerning the implementation of amount locks in transactions.

This discourse is rooted in the exploration of OP_CHECKCONTRACTVERIFY (CCV) and a proposed new opcode, OP_INOUT_AMOUNT, which aims to directly manage transaction input and output values within the Script. The introduction of 64-bit arithmetic in Script and these opcodes is intended to streamline the enforcement of transaction conditions, particularly those not targeting destination locks but focusing on the value constraints of inputs and outputs.

The discussion touches upon the technical intricacies involved in implementing these proposals, highlighting how they could significantly simplify and expand the flexibility and applicability of amount locks within scripts. It delves into the details of the witness stack for OP_CCV, discussing the management of transaction elements such as indices and modes to implement amount locks efficiently. The original OP_CHECKCONTRACTVERIFY proposal suggested mode-based amount locks, but the case study proposes a more direct implementation using OP_IN_AMOUNT and OP_OUT_AMOUNT. This approach simplifies execution and allows for dynamic selection of modes based on the transaction's requirements, demonstrating the adaptability of this method through Python implementations and test cases.

In the discourse, there is also mention of a separate but related case study titled OP_VAULT, which investigates the use of Script opcodes for creating amount locks. This study emphasizes the need for enhancements that allow for more direct support of amount locks within Script, moving away from deferred validations. The proposal showcases OP_VAULT and OP_VAULT_RECOVER opcodes, focusing on verifying transaction amounts directly within Script and streamlining the recovery transaction process.

Furthermore, the conversation introduces OP_INOUT_AMOUNT, inspired by Elements' opcodes, as a means to handle variable size input and output sets in Bitcoin transactions. This opcode interprets stack parameters as bitmaps to guide the summation of specified outputs and inputs, illustrating its utility in scenarios like CoinJoin transactions. However, it acknowledges potential design challenges, such as ensuring comprehensive input-output value awareness and adaptability to varied transaction designs.

Lastly, the email hints at broader ambitions to leverage these innovations for supporting [OP_TLUV], suggesting ongoing efforts to optimize transaction verification processes. It calls for community feedback on enhancing Script's functionality, indicating a collaborative approach to refining Bitcoin's scripting capabilities.

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