Skip to content

BIP draft: CISA for taproot key path spends - #6

Closed
fjahr wants to merge 2 commits into
masterfrom
cisa
Closed

fjahr wants to merge 2 commits into
masterfrom
cisa

Conversation

@fjahr

@fjahr fjahr commented Jul 17, 2026

Copy link
Copy Markdown
Owner

No description provided.

Add a vendored copy of the secp256k1lab library (master branch, commit
a265da139aea27386085a2a8760f8698e1bda64e) that the full-aggregation
reference implementation and test vector scripts depend on.
Comment thread bip-XXXX.mediawiki

== Design ==

This BIP introduces a new witness version (v2) that enables signature aggregation for Taproot-style key path spends.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIP-360 already called dibs on SegWit v2. Granted, it's probably not going to even attempt activation anytime soon, but you still might want to pick a different version.

@fjahr fjahr Jul 18, 2026 •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct and I noticed this at some point but decided to keep this BIP with v2 as well for now. I am curious what BIP editors will have to say about this and I am happy to make a change here if they request it but I couldn't find any rules assigning witness numbers in BIPs or anything that seemed close enough. Since witness versions are a scarce resource and not assigning them sequential would be kind of confusing, I think whatever soft fork goes in next that requires a new witness version should get "dibs" on v2. Since both this one and BIP360 aren't close to activation I am happy with whatever we decide to write into the specs in the meantime. Maybe we'll want to move to a more generic language for the version instead of prescribing it explicitly until activation comes close. No idea, I am happy to adapt what reviewers think is best. Maybe avoiding collisions makes sense for Bitcoin Inquisition at least. Either way it seems like there is a chance a "final" BIP might need a change if it gets deployed but would mess up the sequence.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it should be fine for unrelated BIPs to conflict on something like this. If one BIP is deployed first, the other would just have to nudge their version number up in the spec, which is easy. The harder part would be updating test vectors 🫠

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note on this to the Deployment section, keeping v2 itself for now as discussed.

Comment thread bip-XXXX.mediawiki Outdated
* Lets each input specify its own sighash type
* Allows mixing aggregated, opted-out, and non-aggregated inputs in the same transaction
* Commits to the aggregation mode in the signature message, protecting opted-out inputs from non-consensual aggregation by third parties (even potential future block-wide aggregation)
* Supports up to two aggregation groups per transaction (one half-agg, one full-agg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If two separate aggregation groups is sold as a benefit here, why not allow even more? The marker currently uses only 3 values out of possible 254, and even if you keep the current range restriction you can still accomodate at least 32 groups.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this as mentioned in the rationale section. First, I have a really hard time thinking of any use-cases/protocols for this where it would not just be multiple transactions with one group each. And the cost would be significant added complexity in validation. If there is a concrete use-case that is feasible I am open to think about adopting more flexibility.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't see the benefit of allowing multiple groups, but the way this bullet point is written implies there is one. Maybe rewrite it with more ephasis on the fact that both full-aggregated and half-aggregated signatures are supported within the same transaction, and move the "separate groups" fact into the parentheses.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the bullet as you suggested.

Comment thread bip-XXXX.mediawiki
Comment on lines +124 to +126
* '''Marker''': First byte (<code>0xbb</code>, <code>0xbc</code>, or <code>0xbd</code>)
* '''Sighash type''': Optional second byte. If absent, <code>SIGHASH_DEFAULT</code> (<code>0x00</code>) is used
* '''Signature''': For opted-out inputs or the final input of an aggregation group

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sighash type is traditionally appended at the end of the signature. I don't see a reason to change it here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this is certainly possible, there is no ambiguity. But I like it more this way for a few (maybe minor) reasons: If the sighash is traditionally appended to the signature, this wouldn't be the case here either way. In the witnesses without a signature the sighash byte would follow the marker anyway. The signature would be the optional element in between but in a typical transaction (I hope) we should see many witnesses without signatures and only one with it, so the signature is more of an exception within a transaction that uses explicit sighashes. I also find that keeping the "metadata" together just nicer and it makes code and documentation look a bit nicer which makes it a bit easier to reason about as well, but I certainly biased here.

Happy to consider changing this if more reviewers prefer this style.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a footnote here to document that this is an explicit choice, not a mistake.

Comment thread bip-XXXX.mediawiki
Comment on lines +455 to +456
The marker byte alone cannot protect such inputs, since a third party could replace the opt-out marker with an aggregation marker and fold the unchanged signature into the group.
The protection comes from the signature message committing to the aggregation mode.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This explains why the signature message must commit to the aggregation mode, but not why the opt-out marker must actually be present in the transaction (instead of opting out by omitting the marker).

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the explicit opt-out there would be ambiguity on what a 65-byte element is. It could be an opted out signature with sighash byte or it could be a fullagg final signature without a sighash byte. There certainly would still be ways to make this work but this seemed like the best solution to me.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I thought, but it would be nice to state that explicitly in the BIP.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added two sentences making the parsing ambiguity explicit.

Comment thread bip-XXXX.mediawiki Outdated
Comment on lines +498 to +499
Key path spends have one signature per input with clear validation semantics.
Script path spends involve arbitrary scripts, and aggregating them raises questions such as which <code>OP_CHECKSIG</code> operations to aggregate, how <code>OP_CHECKSIGADD</code> interacts with aggregation, and whether MuSig-style key aggregation composes with signature aggregation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find the complexity rationale to be very convincing, for three reasons:

  1. OP_CHECKSIGADD is just the script fragment OP_ROT OP_SWAP OP_CHECKSIG OP_ADD folded into one opcode. It doesn't need any special handling on top of OP_CHECKSIG.
  2. "Which OP_CHECKSIG operations to aggregate" seems like an easy question to answer: those that are executed with non-empty signatures. Because BIP-342 mandates that signatures must be either valid or empty, a construction like <key> OP_CHECKSIG OP_IF leaves no ambiguity as to which branch is executed.
  3. The MuSig point isn't specific to script path spends.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I am realizing how bad this line in the BIP is. What happened here is: I didn't want to go into details on the actual issue since it is something that I am deferring to a separate BIP that may or may not come into existence since I am still unclear if there is enough of a need for it and if there is a satisfactory solution to our problems. So I wrote this terrible sentence trying to mention some issues without really describing the primary issue that I see as the blocker, which makes it so confusing.

Let's say aggregation existed in Tapscript and someone makes the script [0xbc] OP_CHECKSIG OP_SUCCESSX where the marker is a placeholder for an aggregated signature. Today's nodes see the OP_SUCCESSX and the script succeeds at parse time, so the key contributes nothing to the aggregate. After a later soft fork that redefines OP_SUCCESSX, the script actually executes and the key joins the aggregate. Now the two nodes expect different aggregate contents for the same transaction, and a transaction built for the new rules gets rejected by the older nodes. That would turn a OP_SUCCESS redefinition into a hard fork, which kills the tapscript upgrade mechanism.

I will think about how much I want to go into the details but I will certainly update this part. Maybe I will just link to AJ's original post on the issue but this may not be ideal either because it predates Taproot and parts of it may be confusing because of it: https://gnusha.org/pi/bitcoindev/[email protected]/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that is a major blocker, and while you could for example accept the fact that future OP_SUCCESS and non-c0 version scripts will either have to use their own aggregation groups or not use aggregation at all, I wouldn't call that a satisfactory solution. I'm looking forward to you updating this, definitely recommend going into the details here (the BlockstreamResearch/cross-input-aggregation readme mentions Generalized Taproot and Entroot as possible solutions, so you might want to link to those).

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the section with details on the actual issues, thanks for pushing me on this.

@fjahr

fjahr commented Jul 18, 2026

Copy link
Copy Markdown
Owner Author

Thanks a lot for sharing your feedback @vostrnad ! I haven't made any changes to the document yet but I am certainly going to make improvements based on your comments. But I'll wait a bit for more comments and potentially further responses from you.

@fjahr

fjahr commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

I have addressed your feedback @vostrnad , thanks again! I will close this now and move the discussion to the official bips repo. If anyone still has a review in flight here feel free to post the comments anyway and I will address the in the bips repo PR.

@barbaradeck1946-arch

Copy link
Copy Markdown

[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants