Revives #22341 (marked “up for grabs”).
Add gethdkey RPC to derive an extended key at any BIP 32 path from the wallet’s active HD key.
This enables exporting xpubs/xprvs for external setups (e.g., BIP 87 multisig) without modifying the wallet’s keypool.
0$ bitcoin-cli gethdkey "m/87'/0'/0'"
1{
2 "xpub": "xpub6...",
3 "fingerprint": "1a2b3c4d",
4 "origin": "[1a2b3c4d/87'/0'/0']"
5}
6
7$ bitcoin-cli gethdkey "m/87'/0'/0'" '{"private": true}'
8{
9 "xpub": "xpub6...",
10 "xprv": "xprv9...",
11 ..
12}
Use case: Users setting up multisig (e.g., with hardware wallets or other software) need xpubs at specific derivation paths. Currently this there is no way to extract a specific path from wallets in Bitcoin Core.
Design: Intentionally simple, only exports key info. To sign with derived keys, users import the returned xprv via importdescriptors. This keeps all signing through the normal keypool mechanism.