fjahr
commented at 7:51 PM on August 29, 2026:
contributor
Reference implementation of BIP460 Cross-Input Signature Aggregation for Taproot key path spends. Implements witness v2 outputs whose key path spends can be aggregated with BIP458 half-aggregation or BIP459 full-aggregation, or opt out with a plain BIP341 signature.
Draft to accompany the BIPs, not intended for merge:
BIP458: bitcoin/bips#2205
BIP459: bitcoin/bips#2210
BIP460: bitcoin/bips#2212
Further notes:
Depends on the unmerged secp256k1 modules from bitcoin-core/secp256k1#1566 (halfagg) and bitcoin-core/secp256k1#1754 (fullagg). The updated subtree here adds both.
Activation is regtest-only and there are no parameters set for other chains
BIP460 test vectors are vendored in src/test/data/ and run in src/test/cisa_tests.cpp. Additional functional tests cover relay and block validation.
DrahtBot
commented at 7:51 PM on August 29, 2026:
contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
#36918 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36918.svg"></sub> (Witness stacks in serialized form (optimization follow-ups) by sipa)
#36909 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36909.svg"></sub> (kernel: add btck_witness_stack_get_items by pzafonte)
#36895 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36895.svg"></sub> (Keep witness stacks in serialized form in CScriptWitness by sipa)
#36885 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36885.svg"></sub> (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc)
#36820 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36820.svg"></sub> (refactor: remove more dead code by fanquake)
#36794 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36794.svg"></sub> (test: make script_combineSigs and spends_witness_prog cases independent by alexanderwiederin)
#36648 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36648.svg"></sub> (descriptor, rpc, wallet: do not echo key material in error messages by fametrano)
#36466 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36466.svg"></sub> (policy: make unstructured Taproot annexes standard by RobinLinus)
#36444 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36444.svg"></sub> (wallet: Store information about created and imported multipath descriptors by achow101)
#36443 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36443.svg"></sub> (descriptor: Reconstruct a multipath descriptor from its expansion by achow101)
#36442 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36442.svg"></sub> (descriptor: Represent multipath descriptors in a single Descriptor object by achow101)
#36409 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36409.svg"></sub> (sign: use fresh randomness as BIP340 auxiliary data by fametrano)
#36154 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36154.svg"></sub> (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp)
#36039 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36039.svg"></sub> (psbt: classify missing Taproot script-path signatures as signer by btcpavao)
#35918 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35918.svg"></sub> (descriptor: Expose key expression parsing by pseudoramdom)
#35793 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35793.svg"></sub> (Implement BIP 54 (Consensus Cleanup) without mainnet activation by darosior)
#35662 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35662.svg"></sub> (script: prevent partial reinitialization of sighash data by l0rinc)
#35444 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35444.svg"></sub> (wallet: make descriptor SPKM mutex non-recursive by w0xlt)
#34520 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34520.svg"></sub> (refactor: Add [[nodiscard]] to functions returning bool+mutable ref by maflcko)
#32857 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/32857.svg"></sub> (wallet: allow skipping script paths by Sjors)
#32575 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/32575.svg"></sub> (consensus: Remove special treatment for single threaded script checking by fjahr)
#29491 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/29491.svg"></sub> ([EXPERIMENTAL] Schnorr batch verification for blocks by fjahr)
#29247 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/29247.svg"></sub> (CAT in Tapscript (BIP-347) by arminsabouri)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
LLM Linter (✨ experimental)
Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):
Possible places where comparison-specific test macros should replace generic comparisons:
test/functional/test_framework/cisa.py: assert len(pk) == 32 and len(msg) == 32 and len(sig) == 64 → Prefer assert_equal checks for each length.
test/functional/test_framework/cisa.py: assert u == len(seckeys) > 0 → Prefer assert_equal(u, len(msgs)) and assert_greater_than(u, 0).
<sup>2026-11-27 18:51:49</sup>
DrahtBot added the label CI failed on Aug 29, 2026
fjahr force-pushed on Sep 7, 2026
fjahr force-pushed on Sep 7, 2026
fjahr
commented at 7:54 PM on September 7, 2026:
contributor
The latest commits, prefixed with draft-bip: go further than BIP460 itself. They implement two companion BIPs necessary for adoption that have not been reviewed and I don't think they are worth sharing on the mailing list yet either:
They are included so that wallets and protocols, like payjoin or coinjoin for example, can build proofs of concept on top of this branch and exercise CISA end-to-end through the their already common descriptor, wallet and PSBT RPCs flows. Expect these commits to change as these drafts evolve. Review of the consensus and policy commits does not depend on them and I would prefer if review is focused on those unless you are building a PoC and depend on these later changes.
fjahr force-pushed on Sep 7, 2026
DrahtBot added the label Needs rebase on Sep 7, 2026
DrahtBot removed the label CI failed on Sep 7, 2026
fjahr force-pushed on Sep 8, 2026
fjahr force-pushed on Sep 8, 2026
DrahtBot added the label CI failed on Sep 8, 2026
DrahtBot removed the label Needs rebase on Sep 8, 2026
DrahtBot removed the label CI failed on Sep 8, 2026
DrahtBot added the label Needs rebase on Sep 9, 2026
BarneyChambers
commented at 11:39 AM on September 15, 2026:
none
Hey Fabian, Hope you don't mind if I add a review here. I built this locally and ran feature_cisa.py and wallet_cisa.py from commit 224e15f. Both passed, and the consensus/policy test coverage looks great. I did hit three wallet/PSBT issues while reviewing the changes.
BarneyChambers
commented at 11:42 AM on September 15, 2026:
For a marked v2 keypath, VerifyScript returning success after ParseCISAWitness seems correct for a per-input structure check. ProduceSignature and DataFromTransaction then treat that success as complete, so a dummy member looks fully signed.
I made a 2-input v2 spend and put 32 zero bytes on both witnesses (half-agg members, no final). signrawtransactionwithwallet came back complete=true with no errors. testmempoolaccept then failed with mempool-script-verify-flag-failed (Invalid CISA aggregation group structure). So CISACheck is doing its job. Anyone who only looks at VerifyScript / complete will think the input is done.
Would it be reasonable to run VerifyCISATransaction on the full tx before setting complete when the parse yields a marker?
fjahr
commented at 11:04 AM on September 21, 2026:
The per-input success is intentional so existing aggregation data is not overwritten by a following opted-out signature, but nothing ran the tx-level check afterwards. SignTransaction now runs VerifyCISATransaction once all inputs are processed and reports the error on the aggregated inputs, so complete should now be false for your example. I also added a test for this in wallet_cisa.py.
BarneyChambers
commented at 11:46 AM on September 15, 2026:
You already reject conflicting full-agg nonces and partial sigs. wallet_cisa.py covers that (PSBTs not compatible). Half-agg signatures do not get checked the same way. Merge keeps the first m_cisa_halfagg_sig it sees.
I took two otherwise identical half-agg PSBTs and flipped one bit in input 0’s sig. combinepsbt([A, B]) succeeded and kept A. Swapping the order kept B.
We can fix this issue if you treat m_cisa_halfagg_sig like the full-agg partial sig (both present and unequal means incompatible). I only mention it because the full-agg side already works
fjahr
commented at 11:04 AM on September 21, 2026:
This is intended, halfagg has no signing session so two different signatures for the same input can both be valid and either one aggregates fine. It matches the behavior of BIP 174/371 for PSBT_IN_PARTIAL_SIG and PSBT_IN_TAP_KEY_SIG, which also keep the first. The flipped bit is an invalid signature rather than a conflict, and the Finalizer verifies every signature before aggregating, so it fails with complete=false instead of producing an invalid tx. I added an explicit test here.
BarneyChambers
commented at 11:50 AM on September 15, 2026:
FinalizeCISAInputs skips any input that is already signed. This skip on already-signed inputs can leave you with two separate groups of the same mode. Consensus then fails the tx with SCRIPT_ERR_CISA_GROUP_INVALID, because once it has seen a group’s final it will not accept another member.
The problem is basically when input 0 already has a final, and you then put input 1 into the same mode with a signature. The loop walks past input 0 and builds a brand new 1-input group on input 1.
Working example:
I signed a 2-input half-agg PSBT without finalizing, cleared input 1’s mode and sig, and ran finalizepsbt. That put a 65-byte final on input 0 and reported complete=false. I put input 1’s mode and sig back and finalized again. That time it reported complete=true, both witnesses were 65 bytes, and testmempoolaccept failed with a Invalid CISA aggregation group structure error.
fjahr
commented at 11:04 AM on September 21, 2026:
Right, good catch. The finalizer should treat a group as closed once any input of that mode has a final witness and I have changed FinalizeCISAInputs to do that, so the remaining input stays unfinalized instead of forming a second group. I also updated the psbt bip draft with a small sentence to clarify this.
fjahr force-pushed on Sep 21, 2026
fjahr force-pushed on Sep 21, 2026
DrahtBot added the label CI failed on Sep 21, 2026
DrahtBot
commented at 11:25 AM on September 21, 2026:
contributor
<!--85328a0da195eb286784d51f73fa0af9-->
🚧 At least one of the CI tasks failed.
<sub>Task 32 bit ARM: https://github.com/bitcoin/bitcoin/actions/runs/35590888385/job/106304773630</sub>
<sub>LLM reason (✨ experimental): CI failed during compilation because cisa_tests.cpp triggered -Werror=array-bounds (array subscript 64 out of bounds in std::vector/construction).</sub>
<details><summary>Hints</summary>
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
</details>
DrahtBot removed the label Needs rebase on Sep 21, 2026
fametrano
commented at 8:09 AM on October 25, 2026:
none
Tested 07addd3748: the consensus code agrees with BIP460's vectors and with 35 extra edge cases, checked against libraries I maintain.
I recomputed the wallet vectors of bips#2212 at ca1312e from the BIP text and checked its consensus vectors, using btclib's taproot sighash with the agg_mode byte added and ecc's BIP458 and BIP459 modules, both still in open pull requests. All 56 wallet values match, including both aggregates and the signed transactions, and so do all 53 consensus verdicts. On this head cisa_tests, feature_cisa.py and wallet_cisa.py pass. I then put the BIP's vectors and my 35 cases in cisa_consensus_vectors.json, and Core returned the expected verdict on each. They cover one-input groups of both kinds together, interleaved groups, an annex on every input, every sighash type in both modes, invalid sighash bytes, aggregates built in the wrong input order, s at or above n, duplicate keys, and P2SH-wrapped or 33-byte v2 inputs whose elements look like group members.
The vendored cisa_consensus_vectors.json is older than the BIP's copy. Its marker-undefined case is optout-sighash-undefined there, with the same transaction, now an opted-out signature with an undefined sighash type, which is how the BIP text reads 0xbb. Copying the BIP's file over fixes it.
The scripts and the 35 cases are in https://gist.github.com/fametrano/2a66f0b0064f4bf754edaf48bda44cdc. P2SH-wrapped inputs, s at or above n, and valid full aggregation with NONE, SINGLE or ANYONECANPAY are not in the BIP's vectors yet, and I can add them there if you want.
DrahtBot added the label Needs rebase on Oct 29, 2026
fjahr force-pushed on Nov 3, 2026
fjahr force-pushed on Nov 3, 2026
fjahr
commented at 3:08 PM on November 3, 2026:
contributor
The vendored cisa_consensus_vectors.json is older than the BIP's copy.
Updated in the latest push.
P2SH-wrapped inputs, s at or above n, and valid full aggregation with NONE, SINGLE or ANYONECANPAY are not in the BIP's vectors yet
I added two test vectors with multiple sighash types to the BIP vectors and added them here. I left out the s/n suggestion because this would belong in BIP458 and BIP459 and there are already vectors for it there, maybe I will add more as noted in the response there but I think it's not that important.
DrahtBot removed the label CI failed on Nov 3, 2026
DrahtBot removed the label Needs rebase on Nov 3, 2026
fametrano
commented at 8:03 AM on November 4, 2026:
none
The updated consensus vectors check out: at 02239232f1cisa_consensus_vectors.json is byte-identical to BIP460's as merged in bitcoin/bips (d5ca385c8e). With the setup of my earlier comment, where btclib computes the messages and btclib-org/ecc's BIP458 and BIP459 modules build and verify the aggregates, all 56 verdicts match, and Core's cisa_tests passes on this head. cisa_wallet_vectors.json is unchanged since 07addd3748, still identical to the BIP's copy I already matched.
The new cases are program-p2sh-wrapped and the two whose groups mix sighash types. In those two I changed each member's sighash byte in turn to another valid type, and checked each result with btclib and btclib-org/ecc: all eight altered transactions fail aggregate verification. So the two vectors catch an implementation that does not hash a member's sighash type. Ralph's report on this head says the vendored vectors were not diffed against the BIPs and that agreement between independent implementations is unverified. For the consensus and wallet vectors, this does both.
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-11-29 04:51 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me