Use
listdescriptors, take note of the results.
Now use
getaddressinfo "address", and check if its parent descriptor matches one of your wallet's descriptor.
To get the private descriptor, use
listdescriptors true to list the same results above but with the "
master private key" instead.
With those info, use your own script to derive the address from your master private key with the provided derivation path in the descriptor.
As for disabling
dumpprivkey, it's a safety feature since clients that does that with non-hardened addresses have been doing it with risks.
See:
learnmeabitcoin.com/technical/keys/hd-wallets/extended-keys/#weaknessProbably related to those "
unexplained" hacks that we've been seeing in Electrum or other clients sometimes.
Im not forcing you to use Bitcoin Core though, it's up to you to choose your Bitcoin client.
OP if you want to get one or more private keys from the root key of your bitcoin core wallet, the easiest way is for you by following @nc50lc's instructions by writing listdescriptors true in the console, get the root key (xpriv--bunch-of-numbers-random-base-58-format), you will need 2 tools:
iancoleman converter (
html page that can be loaded both online and offline) and the electrum wallet, when downloading them, check the gpg signature to guarantee the integrity of the files (recommended). Take the following steps from an offline air-gapped machine to ensure that you don't accidentally leak your wallet's sensitive data, which is the extended private keys.
Open the iancoleman
html page, paste the root key of your bitcoin core wallet in the field: BIP32 Root Key.
Below you will see the Derivation Path tab with the tabs, the ones we are interested in are BIP44, BIP49 and BIP84. Each BIP represents a type of address, being:
BIP44 = produces legacy or p2pkh addresses (addresses starting with the prefix 1).
49 = Nested segwit addresses or p2wpkh-p2sh, these are addresses starting with 3.
84 = Finally, these are native segwit or p2wpkh addresses starting with bc1
When you click on each of these tabs, there will be all the addresses of your bitcoin core wallet with the public keys and private keys, which is what you are looking for. You can compare the addresses and you will see that the reproduced addresses are the same as your bitcoin core wallet.
However, if you want to have these private keys more accessible whenever you need them without having to do this all the time (as this can greatly expose you to the risk of accidentally leaking data or some security breach). you must follow the procedures below:
[Attention, you will need to do this process 3x times to restore wallets with each type of address above] Open the electrum wallet, select you want to create a new wallet > standard wallet > Use the master key... copy the extended private key that is in the field: Account Extended Private Key of the BIP44, BIP49 or BIP84 tab and paste it into Electrum.
However, as bitcoin core only supports root keys in legacy format (xpriv = legacy or p2pkh format), when listing your bitcoin core root key, it will show the root key only in legacy format, electrum will only restore the legacy addresses of your bitcoin core wallet in the BIP-44 derivation path which that key.
If you want to get all your wallet address scripts, you must convert the Account Extended Private Key into p2wpkh-p2sh and p2wpkh formats and one of the easiest ways is to use the electrum console, which I leave instructions below on how to proceed:
To obtain segwit-p2sh addresses (addresses starting with prefix 3):
convert_xkey(xkey="xpriv-your-account-extended-privkey-here",xtype="p2wpkh-p2sh")
To obtain bech32 native-segwit addresses (addresses starting with bc1):
convert_xkey(xkey="xpriv-your-account-extended-privkey-here",xtype="p2wpkh")
Open a new wallet in electrum and import the root keys you got through the electrum root key converter: ypriv, zpriv...
Repeat the process below and paste one of the Account Extended Private Keys and do the entire process for the remaining extended privkeys (ypriv or zpriv...)
After you have generated the 3 wallets in electrum, each one with its address script, go to the wallet you want to obtain the private key for the address, in the addresses tab, select the address and with a right click you will see the option to private key, when selecting this option, it will ask for your electrum password (if you have configured a password) you will see the private key for that address.