Subject: Re: [bitcoindev] [4/4] New Opcodes for Tapscript v2

From: Brandon Black <[email-masked]>
Date: Mon, 29 Sep 2025 15:55:01 -0700

Hi Rusty and Julian,

Thrilled to see the progress towards a greater script for all!

Scoping this work to a new Tapscript version that can be made available
both for SegWit v1 32-byte witness programs and potentially in BIP360
scripts makes good sense to me.

> ;OP_SEGMENT

In Tapscript 0xc2, should SEGMENT replace CODESEPARATOR rather than being
an additional opcode? The Tapscript 0xc0 CODESEPARATOR merely adds the
last position of the opcode to the sighash. With SEGMENT already
requiring the script to be split into execution chunks, it might make
sense for the positions of the current segment to be included in the
sighash as well which would make CODESEPARATOR redundant.

> ;OP_MULTI

Clever.

  TX_SELECT_INPUT_AMOUNT|TX_INPUTSELECT_ALL OP_TX \
    TXSELECT_NUM_INPUTS OP_TX OP_MULTI OP_ADD

Gets the sum of all input amounts.

> Bitcoin script was developed long before Taproot: OP_ECPOINTADD and OP_BYTEREV are the minimal missing opcodes required for creating Taproot trees in script.

You also need either SECP256K1_PRIVATE_TO_PUBLIC or OP_ECSCALARMUL to
convert the Taptweak to a point to be added to the internal key.

Still digesting the whole package, but these are my initial thoughts.

Best,

--Brandon

-- 
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email-masked].
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/aNsORZGVc-1_-z1W%40console.