Post
Topic
Board Bitcoin Technical Support
Merits 4 from 2 users
Bitcoin Core export private key from descriptor wallet
by
nc50lc
on 18/04/2023, 07:27:19 UTC
⭐ Merited by ETFbitcoin (3) ,BitMaxz (1)
-snip-

  "walletname": "miner",
  "walletversion": 169900,
  "format": "sqlite",
Unfortunately, dumprivkey or dumpwallet commands aren't supported by descriptor wallets.
Your option is to export the parent descriptor of that address through and then use a tool that can derive the private key of that address from its master private key.

Here's the procedure (requires https://github.com/iancoleman/bip39):
  • Start Bitcoin Core preferably in an offline machine and enter the command getaddressinfo "address" and take note of the address' "parent_desc" and "ischange" values.
  • Next, enter the command listdescriptors trueand find the (private) descriptor
    with the matching script type of your address' parent descriptor, your address' should be "wpkh".
    But there'll be at least two desc with that script type, so based from your address' "ischange" value of 'true' or 'false', pick the descriptor with "internal" of the same value.
  • From the correct descriptor, copy it's master private key which is the long "xprv" key. Do not include the script type and '(' before and '/' after it.
  • Now open your iancoleman's BIP39 tool in an offline machine and paste your xprv key in "BIP32 Root Key".
  • Scroll down a bit and select the correct script type: BIP44 for legacy, BIP49 for Nested-SegWit and BIP84 for Native Segwit.
  • The default should be already correct for receiving addresses (internal: false), else, change the internal/external path from '0' to '1'.
  • Scroll-down to the derived addresses and it should be there along with its private key.
  • If your address' address_index is more than 20, you should derive more addresses in BIP39 tool by using the button: "Show ___ more rows" below the address list for it to show.