When I run dumpprivkey from Bitcoin Core 0.21.1. I get the following error message:

error code: -4
error message:
This type of wallet does not support this command

I came across achow's explanation stating that

"Descriptor Wallets store Output Script Descriptors in the wallet and use these to generate the addresses that users can use. Legacy Wallets (the non-descriptor wallet type, and the only type of wallet previous versions would create) instead used private keys to generate addresses."

If dumprivkey does not work, how can I get a private key from a descriptor wallet?

1 Answer 1


Master private keys for the wallet can be retrieved by using listdescriptors true and inspecting the output. There is also some ongoing work to make it easier to export these keys without having to interpret a descriptor.

Original answer from Aug 2021

It is currently not possible to export private keys from a descriptor wallet.

There is currently an open pull request which allows the listdescriptors command to optionally return descriptors with private keys. This will be the method by which private keys can be exported from a descriptor wallet.

Note that only the master private key used in a descriptor will be allowed to be exported from descriptor wallets. This is because descriptor wallets will be using unhardened derivation for the child keys and there is a known issue where having the parent xpub and a child key derived with unhardened derivation will allow the parent xprv to be computed. So to be clear to users that what they are doing is potentially unsafe, we will only allow exporting the master private key (it is more obviously unsafe when you have the master private key as users are unlikely to know about this weakness and may think that giving out child keys and the parent xpub is safe).

  • Is my understanding correct that the output of listdescriptors with the parent master private key is enough to recover the entire wallet using importdescriptor? Dec 19, 2022 at 22:35
  • 1
    @MartinBraun Yes. The output of listdescriptors true is sufficient to recover your wallet.
    – Ava Chow
    Dec 20, 2022 at 5:15
  • 3
    This is too paternalistic. A user advanced enough to be able to extract the private key should know better what to do with it. This stuff just makes it harder to work with Bitcoin Core's wallet and forces us developers to go and look for third-party resources instead.
    – Bilthon
    Jun 23, 2023 at 22:49
  • I feel like Bitcoin Core developers are going out of their way to make it difficult for wallet owners to manage their older wallets. I have the important info (older wallet.dat and/or private keys) and "importing" or "migrating" these wallets seems unnecessarily daunting @Bilthon . I go on blockchain.com and see that importing private key took all but 5 seconds. Why couldn't I do something like that in Bitcoin Core GUI?
    – Jon Grah
    Mar 4 at 12:57
  • @JonGrah Importing has never been a feature meant for most users and it's always been a little obtuse. Migration is meant for most users, and there isn't really anything that you need to do with it except to click a single button.
    – Ava Chow
    Mar 5 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.