Proposed BIP for OP_CAT

Posted by Rusty Russell

Oct 23, 2023/02:13 UTC

In an email exchange on the Bitcoin development mailing list, Ethan Heilman expresses his appreciation for a recent implementation related to script templates. He raises a query regarding the order of concatenation, suggesting that if A is at the top of the stack, the resulting concatenation should be BA instead of AB. He also mentions that the current limit of 520 bytes for script templates feels somewhat small, particularly due to the use of OP_CAT, which makes the Script more interesting. He provides an example where enforcing two input amounts equal to one output amount using OP_TXHASH and OP_CAT requires about 250 bytes of Script.

Ethan poses three questions for further consideration:

  1. Do other users find the limit of 520 bytes too restrictive?
  2. Was there a specific rationale behind maintaining this limit? Considering that the current script limit is 10k, could they move closer to that limit?
  3. Should they consider restricting elsewhere instead? Ethan suggests that the total stack size, rather than the byte limit, might be a more appropriate constraint.

Rusty, another participant in the discussion, acknowledges Ethan's points and clarifies that the implementation is not as straightforward as initially indicated. Rusty also mentions that the line of code "vch3.reserve(vch1.size() + vch2.size());" was just a peculiar detail.

Link to Raw Post
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