Bitcoin Forum
May 26, 2024, 08:06:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Messy Private Keys Dump  (Read 382 times)
ironfeast (OP)
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
October 11, 2018, 05:57:17 PM
 #1

Hi there,

Could anyone explain me how to export and import bitcoin's private keys in bitcoin core. I have exported private keys, it's a text file and have something like:

# Wallet dump created by Bitcoin v0.16.0
# * Created on 2018-10-08T10:01:00Z
# * Best block at time of backup was 544879 (00000000000000000010c6fe1edd3f236745b6af51929969bdaba2d59200dcc5),
#   mined on 2018-10-08T09:51:59Z

 "# extended private masterkey: <some long key>"
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/0'/699'
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/1'/947'
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/0'/86

This is a long list which goes on about four thosand lines. Then I see:

<Some Random Text(Not sure if it's a key)> 0 script=1 # addr=<some address>
<Some Random Text(Not sure if it's a key)> 0 script=1 # addr=<some address>

This goes till some eight thousand lines and the file end with # End of dump

Please help to understand all this messy thing.


AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
October 11, 2018, 06:24:49 PM
Last edit: October 11, 2018, 08:25:21 PM by AdolfinWolf
Merited by ABCbits (1)
 #2

I don't think you're able to derive adresses in Bitcoin core itself from an (outside) XPRIV key. You'll need to use another library to do so.

See:
https://bitcoin.stackexchange.com/questions/52384/how-to-restore-bitcoin-core-hd-wallet-private-keys-by-master-key

Which lists this as a tool to do so; https://github.com/prusnak/bip32utils, but this tool is no longer available or has since moved. This should work aswell? https://iancoleman.io/bip39/
(https://github.com/iancoleman/bip39) (Always make sure you're running this safely!)

I haven't exactly tried it so i could be wrong.


You can then obviously import all your private keys generated with such a tool using

Code:
importprivkey

A more detailed guide can be found here:
https://bitcoin.stackexchange.com/questions/5941/how-do-i-import-a-private-key-into-bitcoin-core

Quote
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/0'/699'
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/1'/947'
<some key> 2018-04-26T17:08:10Z change=1 # addr=<some address> hdkeypath=m/0'/0'/86

The <some key> should be importable, (as i presume this is a "change" adress.) Try using above method to import these and see if it works.

I'm not exactly an expert on Bitcoin Core, but the

Quote
<Some Random Text(Not sure if it's a key)> 0 script=1 # addr=<some address>
Doesn't seem right, and is not something i've seen before.

Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
October 12, 2018, 04:36:56 PM
 #3

- If you're looking to import the private keys into different wallet software NOW then <some key> is what you want to import/sweep. You can ignore the rest.

- If you're looking to save this dump file for import years later then just don't. Instead use the backup wallet file option in the file menu of bitcoin core.
Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
October 13, 2018, 12:05:07 PM
Merited by ABCbits (1)
 #4

Please help to understand all this messy thing.
that's why it's called wallet dump Cheesy
basically each line represents info of a specific bitcoin address
<private-key-WIF> <creation-date> <label/reserve/change> # addr=<bitcoin-address> hdkeypath=<derivation-path>

Could anyone explain me how to export and import bitcoin's private keys in bitcoin core.
depending on your intentions, there are a few dos and don'ts on exporting/importing keys
and there are a few commands that you can use:
dumpprivkey: exports single private key of an address
dumpwallet: exports all private keys to a file in wallet dump file format
importprivkey: imports single key into bitcoin core  
importaddress: imports a watch-only address
importwallet: imports private keys from a file in wallet dump file format

tell us your specific intention, so we can give you advise on how to do it properly and safely Wink

WelderInChief
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 09, 2019, 05:15:26 PM
 #5

- If you're looking to import the private keys into different wallet software NOW then <some key> is what you want to import/sweep. You can ignore the rest.

- If you're looking to save this dump file for import years later then just don't. Instead use the backup wallet file option in the file menu of bitcoin core.

Why not just backup the "extended private masterkey" for use years later? It would certainly be easier to write it down on paper or metal than each individual private key (assuming you are using many private keys from the same extended private masterkey so to break up your balance for privacy)?

Is it because you can't currently import it into bitcoin core and might need to use another app? It seems that this would give you all the benefits of bip39 without the downsides.
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
August 09, 2019, 06:31:46 PM
Merited by ABCbits (1)
 #6

- If you're looking to import the private keys into different wallet software NOW then <some key> is what you want to import/sweep. You can ignore the rest.

- If you're looking to save this dump file for import years later then just don't. Instead use the backup wallet file option in the file menu of bitcoin core.

Why not just backup the "extended private masterkey" for use years later? It would certainly be easier to write it down on paper or metal than each individual private key (assuming you are using many private keys from the same extended private masterkey so to break up your balance for privacy)?

Is it because you can't currently import it into bitcoin core and might need to use another app? It seems that this would give you all the benefits of bip39 without the downsides.

The xprv doesn't include all the information you need to restore the wallet. It doesn't tell you what derivation path was used or what script types were used i.e. whether you created p2pkh, p2wpkh etc. addresses. It doesn't tell you how many addresses you generated. And if you used addresses from imported private keys or pre-HD bitcoin core then those private keys can't be restored using the xprv.
WelderInChief
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 10, 2019, 08:16:17 PM
 #7

I get that it wouldn't include the imported keys, but if the software can't figure out those other details from the xpriv then how can it be used to. migrate to another wallet today? Is it because the new wallet makes some educated guesses that are probably correct, but might not be, but you still have the old wallet software in that edge case?

bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 11, 2019, 11:55:57 AM
 #8

I get that it wouldn't include the imported keys, but if the software can't figure out those other details from the xpriv then how can it be used to. migrate to another wallet today? Is it because the new wallet makes some educated guesses that are probably correct, but might not be, but you still have the old wallet software in that edge case?

It is because there are standards on how to derive private keys (i.e. which derivation path to use for which address type).
This data is stored in wallet files. The xpriv itself is only used to derive the private keys.

BIP32 and BIP44 define the standard to derive private keys for different 'accounts' or coins. Following the standardization you will be able to derive your needed keys using your xpriv.

legendster
Hero Member
*****
Offline Offline

Activity: 1778
Merit: 764


www.V.systems


View Profile
August 11, 2019, 08:00:48 PM
 #9

I've worked with masternode coins and in most of them you could just point to the dump file location and it parses the information on its own in the console.
So maybe mention where exactly you are trying to import and maybe you could get better responses here that way.


   ██████████        ████████████
     ██████████        ██████████
       ██████████        ████████
         ██████████        ██████
           ██████████        ████
             ██████████        ██
               ██████████
                 ██████████
                   ████████
                     ██████
                       ████
                        ██
|
     ▄▀▀▀▀▀▀▀▀▀█                 ▄▀▀▀▀▀▀▀▀▀█
 ▄▀                ▄▀█             ▄▀                ▄▀█
 ██████████    █             ██████████    █
 █                █                   █                █    █
 █                █     ▀▀▀▀▀▀▀█                █    █
 █                █  ▄▀             █                █  ▄▀
 ██████████▀                 ██████████▀
          █                                    █
          █                                    █
     ▄▀ █  ▀▀▀▀█                   ▄▀ █ ▀▀▀▀▀▀█
 ▄▀             ▄▀█               ▄▀               ▄▀ █
 █████████   █               ██████████    █
 █              █   █               █                █    █
 █              █   █               █                █    █
 █              █  ▄▀▀▀▀▀▀▀  █                █  ▄▀
 █████████▀                  ██████████▀

Blockchain
Database
                             ▄▄▄
                         ▄▄▀  ▀▄▄
        ▄           ▄▄▀  ▄▀▄  ▀▄▄
      █▄█   █████████████████    █
        █     █                              █ ▄▀ ▌
        █     █        ▄    █   ▄         █▀ ▄▌
       ██    █      ▀▄   █    ▄▀       █▀█
       ▌ ▌   █            █                █  █
       ▌ ▌   █                              █  █
       ██    ███████████████████
                     ▀▀▄  ▀▄▀  ▄▀▀
                         ▀▀▄  ▄▀▀
                             ▀▀▀
Dev friendly
SDK Platform
                             ▄▄▄▄
                         ▄▄█    █▄▄
                     ▄▄█            █▄▄
                 ▄▄█       ▄▄▄       █▄▄
                 █       ▄▀      ▀▄       █
               █▀     █      █      █     ▀█
               ▀▀█  █   ▄█▀█▄   █  █▀▀
               █▀▀   █  ▀███▀  █   ▀▀█
               ▀▀█     █    █    █     █▀▀
                   ▀▀█   █  █  █   █▀▀
                       ▀████████▀
                           █▄▄▄▄█
                 █        █▄▄▄▄█      █
             ▄▀ █▄                   ▄█  ▀▄
            █   █▀▄         ▀      ▄▀█    █
           █   █  █  ▌      ▀   ▐  █  █    █
           █   █▄▀▄▌      ▀   ▐▄▀▄█    █
           █       █          ▀        █       █
        █▀▀▀▀▀▀█                █▀▀▀▀▀▀█
        ▀▀▀▀▀▀▀▀                ▀▀▀▀▀▀▀▀
User-friendly
Token Creation
|
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10593



View Profile
August 12, 2019, 03:22:10 AM
Merited by bob123 (1)
 #10

I get that it wouldn't include the imported keys, but if the software can't figure out those other details from the xpriv then how can it be used to. migrate to another wallet today? Is it because the new wallet makes some educated guesses that are probably correct, but might not be, but you still have the old wallet software in that edge case?

It is because there are standards on how to derive private keys (i.e. which derivation path to use for which address type).
This data is stored in wallet files. The xpriv itself is only used to derive the private keys.

BIP32 and BIP44 define the standard to derive private keys for different 'accounts' or coins. Following the standardization you will be able to derive your needed keys using your xpriv.

actually BIPs aren't exactly "standards", they are more like suggestions which is why most wallets are not compatible with each other specially when it comes to BIP39 (mnemonic) and also choice of paths for BIP32.
so it is best, when you make a backup, you also write down the wallet name you used, the version of the wallet you used to create the data you are backing up and possibly if you knew anything more about their derivation paths or at least your address(es).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
August 12, 2019, 07:01:55 PM
Merited by ABCbits (1)
 #11

BIP32 and BIP44 define the standard to derive private keys for different 'accounts' or coins. Following the standardization you will be able to derive your needed keys using your xpriv.

Bitcoin core doesn't use bip44.

I get that it wouldn't include the imported keys, but if the software can't figure out those other details from the xpriv then how can it be used to. migrate to another wallet today? Is it because the new wallet makes some educated guesses that are probably correct, but might not be, but you still have the old wallet software in that edge case?

Using an xpriv backup with the same wallet software i.e. bitcoin core is hard to do. So if it's hard to do it with the same software it's even harder with a different one. For example I know of no software that uses the same derivation path as bitcoin core.
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!