#36697 wallet: Add exportaddresskey RPC for descriptor wallets
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36697 wallet: Add exportaddresskey RPC for descriptor wallets | Needs rebase | 0 | Crickets | 824 + 2,785 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Adds the exportaddresskey RPC method for descriptor wallets, allowing callers to export locally available private keys corresponding to a specified address. The RPC supports exporting either original wallet keys or effective Taproot key-path keys across single-key, P2SH/P2WSH, multisig, Miniscript, and Taproot scripts, including individual MuSig2 participant keys without aggregation.
Problem: Following the removal of legacy wallet support and dumpprivkey, descriptor wallets have lacked a direct mechanism to extract the private key for a single address. Callers needing an address's private key currently have to determine its descriptor, find the derivation index, and re-implement derivation math outside Bitcoin Core.
Evidence of importance:
- Author notes the initial motivation was 'the lack of dumppriv since v30 and the need for it in the making of the Quietproof client' (PR description). No other contributors or linked issues are cited.
Scope: The PR introduces descriptor inspection and private derivation methods (ExpandPrivateChecked, GetMuSig2KeyInfo, GetPrivateKeyRoots) alongside a new export module (src/wallet/export.cpp), with over 2,700 lines of unit and functional test coverage. It also includes an auxiliary block synchronization fix in test/functional/p2p_segwit.py.
Risk of a mistake: high (wallet, rpc_api). Flaws in private key extraction, TapTweak derivation, or export authorization could expose incorrect keys, leak unintended participant secrets, or bypass wallet passphrase protections.
Changed since the previous assessment: Includes full implementation and test diffs, adding x-only parity resolution for reloaded descriptors, wallet passphrase concurrency tests, and a synchronization fix in p2p_segwit.py.
Reviewability
Ready · Needs rebase
Conflicts with master; review the logic now, the rebase is mechanical.
Agreement
Crickets
no substantive comment either way
Objections, suggestions, and questions: none recorded.
Files
2785 lines under test/bench/ci.
- src/wallet/test/scriptpubkeyman_tests.cpp +1381/-0
- test/functional/wallet_exportaddresskey.py +1200/-0
- src/wallet/export.cpp +260/-0
- src/wallet/scriptpubkeyman.cpp +138/-0
- src/wallet/rpc/backup.cpp +134/-0
- src/wallet/test/wallet_rpc_tests.cpp +121/-0
- src/script/descriptor.cpp +117/-0
- doc/release-notes-exportaddresskey.md +77/-0
- src/test/key_tests.cpp +47/-0
- src/script/descriptor.h +31/-0
- src/wallet/export.h +31/-0
- src/wallet/scriptpubkeyman.h +17/-0
- src/qt/test/rpcnestedtests.cpp +16/-0
- src/test/rpc_tests.cpp +12/-0
- src/key.cpp +11/-0
- test/functional/p2p_segwit.py +4/-0
- src/key.h +3/-0
- src/wallet/test/walletload_tests.cpp +3/-0
- src/wallet/rpc/wallet.cpp +2/-0
- src/wallet/types.h +2/-0
- src/qt/rpcconsole.cpp +1/-0
- test/functional/test_runner.py +1/-0
Card
The short text the ranking pass compares across PRs.
Adds the exportaddresskey RPC to export locally available private keys for a specific address in descriptor wallets, filling a workflow gap left by the removal of dumpprivkey. It supports both raw wallet keys and effective Taproot key-path keys across single-key, script-based, Miniscript, and MuSig2 participant descriptors without aggregating participant secrets. The author cites integration requirements for the Quietproof client as motivation, though no external issues or corroborating users are linked.
Data
labels: Wallet, Needs rebase
Categories
Wallet
P3 · new feature (ranking pass: Moved down: single-client motivation with no corroborating demand places it at the bottom of the feature group.)
Adds exportaddresskey to fill the gap left by the removal of dumpprivkey in descriptor wallets, letting users export private keys for specific addresses without external derivation math. The author cites a concrete use case ('the lack of dumppriv since v30 and the need for it in the making of the Quietproof client'), though without wider linked issues or broad user demand this is a worthwhile feature rather than an urgent release blocker.
Membership: Carries the Wallet label, adds src/wallet/export.cpp, and introduces the exportaddresskey RPC for descriptor wallets.
Factors: security/stability 0, bug 0, performance 0, user value 2, leverage 0