rpc: add stripbip32derivs to PSBT processing RPCs #35370

pull junbyjun1238 wants to merge 4 commits into bitcoin:master from junbyjun1238:rpc-strip-psbt-bip32-derivs changing 7 files +201 −4
  1. junbyjun1238 commented at 1:29 PM on May 25, 2026: contributor

    This PR adds a stripbip32derivs option to both the walletprocesspsbt and descriptorprocesspsbt RPCs.

    Motivation

    Currently, setting bip32derivs=false only prevents the addition of new key-origin metadata. It does not remove BIP32 derivation metadata that is already present in the input PSBT. For collaborative PSBT workflows, users may want to strip this existing metadata before sharing the PSBT with counterparties.

    Behavior

    Setting stripbip32derivs=true removes standard key-origin fields from the returned PSBT, including global xpubs and BIP32 derivation paths.

    If stripbip32derivs=true is used without explicitly setting bip32derivs, the RPC suppresses adding new key-origin metadata and strips existing standard key-origin fields.

    Explicitly setting both stripbip32derivs=true and bip32derivs=true is rejected. This avoids asking the RPC to add and remove the same class of metadata in a single call.

    Implementation Notes

    The same option is applied to descriptorprocesspsbt because it shares the same bip32derivs behavior and can return the same class of key-origin metadata.

    Following prior review feedback in #30341, the stripping functionality is implemented in the PSBT processing RPCs rather than combinepsbt.

    Tests

    • git diff --check origin/master..HEAD
    • python -m py_compile .\test\functional\rpc_psbt.py
    • python3 test/functional/rpc_psbt.py --configfile=build/test/config.ini in Docker/Ubuntu

    Closes #30294.

  2. psbt: add helper to strip key-origin fields 4dae815fcb
  3. rpc: add stripbip32derivs to PSBT RPCs df5ff420ca
  4. test: cover stripbip32derivs behavior 59bb438181
  5. DrahtBot added the label RPC/REST/ZMQ on May 25, 2026
  6. DrahtBot commented at 1:29 PM on May 25, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35370.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Approach ACK willcl-ark

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #32857 (wallet: allow skipping script paths by Sjors)

    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):

    • walletprocesspsbt(psbt_with_derivs, True, "ALL", True, False) in test/functional/rpc_psbt.py
    • walletprocesspsbt(psbt_with_derivs, False, "ALL", True, False) in test/functional/rpc_psbt.py
    • walletprocesspsbt(psbt_with_derivs, False, "ALL", False, False) in test/functional/rpc_psbt.py
    • walletprocesspsbt(psbt, True, "ALL", True, False) in test/functional/rpc_psbt.py
    • walletprocesspsbt(psbt_with_derivs, False, "ALL", False, False) in test/functional/rpc_psbt.py

    <sup>2026-05-25 13:31:39</sup>

  7. doc: add release note for stripbip32derivs 2ec965091c
  8. DrahtBot added the label CI failed on May 25, 2026
  9. DrahtBot removed the label CI failed on May 25, 2026
  10. willcl-ark commented at 10:18 AM on May 28, 2026: member

    Approach ACK.

    This looks like the correct approach (in contrast to #30341), putting strip functionality in walletprocesspsbt (and also descriptorprocesspsbt).

  11. achow101 commented at 11:27 PM on May 28, 2026: member

    The option does more than stripping bip32 derivation paths and it's name should reflect that.

    I'm not sure about stacking yet another bool argument. Maybe it would be better to convert the existing bip32derivs into a enum/choices argument.


github-metadata-mirror

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-05-31 17:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me