4

I created a new wallet in Bitcoin Core v23.x,
as expected it created an empty wallet
version 169900
descriptors true
format sqlite.

It seems it created 4 streams of 1000 keys each.

Anyway I told it create some P2PKH, P2SH-nested P2WPKH, P2WPKH, P2TR addresses.

It created a bech32m address, but it won't let me access private keys.

Whatever the address type, it's telling:

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

Why is this happening and where to go from here?

1 Answer 1

6

As the error message says, the type of wallet you are using does not support the dumpprivkey command. You are using a descriptor wallet, and individual private keys cannot be exported from the wallet.

You can get the master private keys by using listdescriptors true. This will output all of the descriptors stored in the wallet along with their corresponding private keys. Because Bitcoin Core uses BIP 32 derivation, instead of thousands of individual private keys, you will get descriptors which contain the master private key from which you can do derivation on to get the individual child keys.

Descriptor wallets specifically disabled export of child private keys because it is unsafe. Because unhardened derivation is used by default, a child private key and a parent extended public key is equivalent to having the parent extended private key. However it is not immediately obvious to the vast majority of users that this is unsafe, so child private key export is disabled.

3
  • When did Core switch to non-hardened as the default? Is there a reason non-hardened keys is the default? bitcoin.stackexchange.com/a/50247/26873
    – m1xolyd1an
    Commented May 22, 2022 at 22:05
  • 1
    @m1xolyd1an Since descriptor wallets were added, and only for descriptor wallets. As descriptor wallets make it easier to import and export wallets via descriptors, we decided to move to use the standard derivation paths that allow for such exports.
    – Ava Chow
    Commented May 23, 2022 at 4:08
  • Since "Descriptor wallets specifically disabled export of child private keys because it is unsafe.", how do I sign a 2-of-3 PSBT transaction whose one of its public keys is of an address derived in such a descriptor wallet - without exporting its child private key? Looks like I will need to import the multisig adddress' descriptor into the wallet first, and it will need to have a masteror child private key, so I'll end up export it anyway. Or am I thinking about it in a wrong way?
    – Meglio
    Commented Mar 29, 2023 at 13:03

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.