Post
Topic
Board Development & Technical Discussion
Re: Help Unable to export private key
by
NotATether
on 09/02/2025, 15:28:10 UTC
Although the private keys are available in a descriptor wallet that uses "xprv" descriptors, I wonder what the timeline is for support for exporting such kind of wallets to be added into Bitcoin Core.

You cannot export a single private key from descriptor wallets. You can export sufficient information by running listdescriptors true. It will tell you what your master private key is, what your derivation path is etc.

Here's an explanation from the expert:
Descriptor wallets do not allow dumpprivkey because the fundamental principle behind descriptor wallets is that private keys are not enough information to transport a wallet. Private keys lack derivation information and lack information about what kind of scripts to create. They also do not work for wallets that have anything more complicated than just single key scripts. Thus allowing a RPC that only outputs private keys would be working against the point of having descriptors.

Instead of dumpprivkey, descriptor wallets have listdescriptors. This will output all of the descriptors stored in the wallet, which means that it will include information about derivation paths and scripts to create. Descriptors are a full backup of the key and script information stored in the wallet. With 23.0, listdescriptors will also be able to optionally output descriptors containing private keys.

Considering that information, a new RPC call can be added for descriptor wallets to check if the descriptor contains an extended private key, and if found, export that. Or perhaps the first N private keys in case addition derivation paths are used.