rpc: add gettxproof and verifytxproof for transactions with witness #116
Open
Sjors wants to merge 8 commits into
Open
rpc: add gettxproof and verifytxproof for transactions with witness #116Sjors wants to merge 8 commits into
Sjors wants to merge 8 commits into
Conversation
ec05210 to
3496580
Compare
This was referenced Jun 13, 2026
Owner
Author
|
Based on some light investigation, my current impression is that with Electrs you don't need |
Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
3496580 to
2503d28
Compare
2503d28 to
406128e
Compare
406128e to
b629abf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
gettxproofandverifytxproofonly proofTxidinclusion, not the witness. This PR adds that.This PR introduces two new methods (
gettxproofandverifytxproof), rather than expanding the originals, since those were designed around BIP37 bloom filters. The new methods requireWtxidinstead ofTxid. Clients that have the full serialized transaction can calculate both. Clients that only know theTxidhave no need for the witness inclusion proof and can just keep using the old RPC methods.Note that there is no
-wtxindex(see #117) so we can't infer the block even when-txindexis enabled. If that's required, then see #118.Commits:
common: move merkle path helpers out of consensus:consensus/merkle.{h,cpp}already contains functions that are not actually used by consensus and are not needed for the kernel. Since PR introduces additional such functions, add common/merkle.{h,cpp}` for those.Allow calling GetWitnessCommitmentIndex with just the coinbase tx: taken from RPC/txoutproof: Support including (and verifying) proofs of wtxid bitcoin/bitcoin#32844, but renaming "generation" to "coinbase".common: add merkle branch verification helpercommon: add witness merkle path helpernode: add transaction proof helpers: includes test fixtures of small and early blocks, which should probably be in a BIP toorpc: add verifytxproofdoc: release noteSuperseedes bitcoin#32844
This PR may still contain LLM hallucinations, so I'm holding off on opening it on
bitcoin/bitcoin. Feedback and testing is welcome, but detailed code review is probably premature.TODO:
blockhashargument last forgettxproofto make (future) support of-wtindexeasier (it becomes optional), see Witness transaction index #117