<p>Master private keys for the wallet can be retrieved by using <code>listdescriptors true</code> and inspecting the output. There is also some ongoing work to make it easier to export these keys without having to interpret a descriptor.</p>
<hr />
<h2>Original answer from Aug 2021</h2>
<p>It is currently not possible to export private keys from a descriptor wallet.</p>
<p>There is currently an open <a href="https://github.com/bitcoin/bitcoin/pull/21500" rel="nofollow noreferrer">pull request</a> which allows the <code>listdescriptors</code> command to optionally return descriptors with private keys. This will be the method by which private keys can be exported from a descriptor wallet.</p>
<p>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).</p>

CC BY-SA 4.0
2022-12-19T22:35:59.667Z
Is my understanding correct that the output of `listdescriptors` with the parent master private key is enough to recover the entire wallet using `importdescriptor`?
Martin Braun
CC BY-SA 4.0
2022-12-20T05:15:14.657Z
@MartinBraun Yes. The output of `listdescriptors true` is sufficient to recover your wallet.
Ava Chow
CC BY-SA 4.0
2023-06-23T22:49:43.713Z
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
CC BY-SA 4.0
2024-03-04T12:57:05.487Z
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
CC BY-SA 4.0
2024-03-05T01:23:02.630Z
@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
CC BY-SA 4.0
2021-08-06T16:47:05.507Z
2024-03-05T01:24:47.547Z
2024-03-05T01:24:47.547Z
Ava Chow
<p>When I run <code>dumpprivkey</code> from Bitcoin Core 0.21.1. I get the following error message:</p>
<pre><code>error code: -4
error message:
This type of wallet does not support this command
</code></pre>
<p>I came across achow's explanation stating that</p>
<blockquote>
<p>&quot;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 <strong>private keys</strong> to generate
addresses.&quot;</p>
</blockquote>
<p>If <code>dumprivkey</code> does not work, how can I get a private key from a descriptor wallet?</p>

<bitcoind><bitcoin-cli><output-script-descriptors>
How do I get the private key of an address in descriptor wallets? How to dumpprivkey?
U2F0b3NoaVNhdHVyZGF5
# How do I get the private key of an address in descriptor wallets? How to dumpprivkey?

(Asked by: username_0 on 2021-06-23)

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?

**Tags:** bitcoind, bitcoin-cli, output-script-descriptors


---

## 1 answers

### Answer by username_1 on 2021-08-06. Score: 8 | Accepted answer

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](https://github.com/bitcoin/bitcoin/pull/21500) 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).

> **Comments:**
> **username_2**: Is my understanding correct that the output of `listdescriptors` with the parent master private key is enough to recover the entire wallet using `importdescriptor`?  
> **username_1**: @username_2 Yes. The output of `listdescriptors true` is sufficient to recover your wallet.  
> **username_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.  
> **username_4**: 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 @username_3 .  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?  
> **username_1**: @username_4 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.  

---

