Bitcoin Forum
April 05, 2026, 01:52:34 AM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoin core descriptor dump wallet privatekeys  (Read 178 times)
mcdouglasx (OP)
Hero Member
*****
Offline Offline

Activity: 966
Merit: 532



View Profile WWW
April 12, 2025, 10:46:05 PM
Merited by LoyceV (8), ABCbits (2), Forsyth Jones (1)
 #1

I bring you this script to help you extract your private keys from a wallet.dat (descriptor) and the ability to export them to Electrum-compatible format.

For this, you need to have Bitcoin Core installed, but only to extract the descriptors, you don't need to download the blockchain. I strongly recommend making a backup of your wallet.dat at all times and working using the backup.

1- We open Bitcoin Core, load the wallet (if you haven't done so already), and open the console with window-console or Ctrl+T.


2- We execute the command listdescriptors true to extract the descriptors.
3- We copy the master private key, known as the 'xpriv'.


4- We open our script easy_wallet_backup.py


5- We load our wallet.dat file, select 'Dump Descriptor,' and paste the 'xprv' in the following line.



6- If we click 'Go' the addresses present in the wallet.dat file along with their respective private keys will be listed.



7- If we want them to be listed in Electrum-compatible format, we click the 'Export2Electrum' button. These can then be saved using the 'Save Result' button or copied as a list to be accepted by Electrum via the 'Import Private Keys' option"



Clarification: When using Export2Electrum, addresses not supported by Electrum, such as Taproot addresses, are omitted.


Alternative options:

With the Extended PrivKey (xpriv), you can generate a series of addresses derived from it. The .dat file is not necessary, as these addresses follow standard hierarchical derivations.



Or you can simply list the addresses in the wallet.dat file.



github: https://github.com/Mcdouglas-X/easy-wallet-backup



Disclaimer: Handle your private data with caution, in isolated environments. Always work on backups of your file. I am not responsible for human errors; use at your own discretion.
Forsyth Jones
Legendary
*
Offline Offline

Activity: 1862
Merit: 2030


I love Bitcoin!


View Profile WWW
April 14, 2025, 10:14:20 PM
Merited by vapourminer (1), mcdouglasx (1)
 #2


Alternative options:

With the Extended PrivKey (xpriv), you can generate a series of addresses derived from it. The .dat file is not necessary, as these addresses follow standard hierarchical derivations.

Great tool!

There is a way for Electrum to restore private keys/addresses through the standard derivation paths such as: M/44H, M/49H, M/84H and M/86H by importing the "Account Extended Private Key". With only the bitcoin core master privkey, Electrum will not derive on these derivation paths as electrum always derives the xpriv on the root (m/0).

There is another command to derive descriptors containing public or private keys in Bitcoin Core, called 'gethdkeys'. This became available starting from version 28.0:

A new RPC gethdkeys lists all of the BIP32 HD keys in use by all of the descriptors in the wallet. These keys can be used in conjunction with createwalletdescriptor to create and add single key descriptors to the wallet for a particular key that the wallet already knows. (#29130)

Optionally, you can request to export only active descriptors with:

Code:
gethdkeys '{"active_only": true, "private": true}'

"active_only": true = lists all active descriptors.

"private": true = includes master/extended private keys. Without private or with "false", returns only descriptors without private keys (xpubs)

You can combine parameters according to your needs, e.g.: {"active_only":false, "private":true} for all paths with xprv.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!