17

I have somewhere in my hard disks some copies of old wallets which I need to analyse.

My idea was importing them into blockchain.info, but to do that apparently you need to dump them with pywallet.py, which is one of the worst pieces of software I've recently put my hands on.

Is there an alternative?

I.e. either one software which given (via command line) the full path of the file, will dump something that blockchain.info can import, or something that at least given a wallet (again, full path via command line) will dump all the private keys.

PS: this has to work for encrypted wallets too, asking the password either at runtime (would be better) or at the command line.

1
  • 2
    Sorry can't answer but am also interested to know what other options are available for wallet management. I might suggest changing the title of the question to something else as I thought this was going to be about how to find the wallet.dat file on your computer. Maybe "Wallet/address software management options?" or something like that. Would have edited myself but wasn't sure what to change it to.
    – kirian
    Commented Apr 6, 2013 at 21:26

7 Answers 7

7

This is an old question but just to say that the dumpwallet command has been added to bitcoin core. This will give you all the private keys in a text format.

3
  1. "As I thought, it doesn't work that way. It wants a full directory with the databases, an alone wallet.dat is not enough. – Lohoris yesterday" Not at all... Wallet.dat is the only file that pywallet reads
  2. If you notice a bug, it's rather nice to report it to the dev instead of bashing him
  3. Same thing for new flags you might want: ask for them instead of complain about their absence

https://bitcointalk.org/index.php?topic=34028.180 I can also provide an email address if you don't have a bitcointalk account

1
  • Oh, sorry, I assumed it was unmantained. I'll properly report at github later, then.
    – o0'.
    Commented Apr 15, 2013 at 0:07
1

I hate to be that guy, but you should really take another look at pywallet. Your problems may be specific to Joric's pywallet, which hasn't been updated in awhile. There is a better-maintained fork of pywallet by JackJack.
If this was the version of it that you already experienced, you could always try the web interface by running:./pywallet.py --web and then navigating to localhost:8989/ in a web browser.
You did however request a command line way of doing it, which with jackjack's pywallet would look like this:
./pywallet.py --dumpwallet --datadir=DATADIR --wallet=WALLETFILE --passphrase=PASSPHRASE
The --passphrase option may have been the issue you ran into with pywallet, since it is necessary for dealing with encrypted wallets, but it isn't in the readme (not really sure why that is).
Anyway, pywallet really does seem to be your best bet for what you're trying to do. If you are having issues using it, feel free to include information about these issues.

6
  • 4
    --wallet and --datadir do not work: they expect you to provide a full data dir, while I just have the wallet.dat file. (and yes I'm using JackJack's version)
    – o0'.
    Commented Apr 12, 2013 at 10:15
  • I was just able to dump a wallet.dat file using ./pywallet.py --dumpwallet --datadir=/mywalletfilefolder where mywallerfilefolder had a wallet.dat in it. Is it possibly the encryption that is the issue? What output do you get when you try?
    – 7anner
    Commented Apr 12, 2013 at 20:22
  • 1
    Apparently I just assumed pywallet for some reason requred a full data dir. Instead it is just so dumb to require two different parameters for the directory and for the wallet name.
    – o0'.
    Commented Apr 13, 2013 at 14:31
  • As I thought, it doesn't work that way. It wants a full directory with the databases, an alone wallet.dat is not enough.
    – o0'.
    Commented Apr 13, 2013 at 16:04
  • huh. I didn't need any other files to do it.
    – 7anner
    Commented Apr 15, 2013 at 21:56
1

Beside that I don't understand your problem with PyWaller, like Eyal suggests, you can use the standard Bitcoin software for this as well, although this method will be a little more time-consuming.

I suggest doing the following for every wallet.dat file you have:

  1. Backup your current wallet.dat file.
  2. Copy the old wallet.dat to your Bitcoin directory.
  3. Open up a terminal and run the bitcoind daemon:

    bitcoind -daemon

  4. Retrieve a list of all the addresses in the wallet:

    bitcoind listaddressgroupings

  5. For every address you want the private key from, dump it:

    bitcoind dumpprivkey <bitcoinaddress>

  6. Stop the daemon before changing the wallet.dat file:

    bitcoind stop

This should give you all the private keys you need and you can import them to any wallet you would like.

6
  • 1
    This is terribly time consuming, that's exactly what I'm trying not to do.
    – o0'.
    Commented Apr 11, 2013 at 15:50
  • How many wallet files do you have then? If you want to save time, you can always use PyWallet... Commented Apr 11, 2013 at 20:13
  • 1
    No, because pywallet doesn't take a full path as an input, i.e. I would have to move the wallet.dat anyway, which is what I'm trying to avoid in the first place. Please notice it pretends to be able to give a path, but it doesn't really work: he wants a path for a whole .bitcoind directory, while I just have the wallet.dat.
    – o0'.
    Commented Apr 12, 2013 at 10:14
  • With a little change to the code you could have changed that... Commented Apr 15, 2013 at 9:45
  • 1
    I tried, it's a complete mess, never seen anything like that.
    – o0'.
    Commented Apr 15, 2013 at 9:49
0

As suggested by the other response. You can use pywallet just fine. Since you require the dumping of many wallets and would like a CLI solution, then a simple bash script + pywallet will do just fine.

This is not by any means tested (i.e. backup all the wallets involved), but should do just fine:

Bash

#!/bin/bash

echo "Enter directory with all the wallet *.dat files live:"
read walletdir
echo "Enter passphrases for all the encrypted wallets in directory:"
read passphrase

for i in $walletdir/*.dat; do
    pywallet.py --dumpwallet --datadir=$walletdir --wallet=$i --passphrase=$passphrase
done

Batch (Not my strong side)

@echo off
set /p walletdir=Wallet directory?:
set /p passphrase=Passphrase?:

for /r %%i in (*) do pywallet.py --dumpwallet --datadir=%walletdir% --wallet=%%i --passphrase=%passphrase%

Also if you'd like to isolate any information within the JSON dump itself you can surely do that too. I'm not exactly sure the anticipated output of --dumpwallet as I am not a user of pywallet, but I believe you can edit the pywallet.py code to change

print json.dumps(json_db, sort_keys=True, indent=4)

to

print "\n".join(private_keys)

In conclusion doing those 2 things will print out a long list of all the private keys to all the addresses to all the wallet files.

Disclaimer - Once again, I have not tested any of this

1
  • See my answer to 7anner: pywallet is stupid and can't process a wallet.dat file if it isn't located into a directory with the bitcoin database.
    – o0'.
    Commented Apr 13, 2013 at 16:05
0
  1. Run JackJack's pywallet.py:

    $ python2.7 pywallet.py --dumpwallet --datadir=/tmp | \
    grep addr | sort | uniq | awk -F'"' '{print $4}' > \
    ~/tmp/wallet_dump.txt
    
  2. Get balances from reports for each address using a web-scraping script:

    $ python3 addrep.py ~/tmp/wallet_dump.txt
    

example results:

121a2C6kbqaPDrRDsbfZFNafcLBDZMum3p: 0 BTC
129oeaukHtXR8xiPqV8Mnb7p6hs9Ev3VwX: 0 BTC
12F9DRQRw2wmGrFUiZRQFk9cG2NtEBxYDv: 0 BTC
137wgZG4TSNw7Zqt4WrEHS7w2bgfeqXkkZ: 0 BTC
13PNjSy4b372f2jMVrHHLZnXXqgAArhwD8: 0 BTC

refs:

https://github.com/jackjack-jj/pywallet/blob/master/pywallet.py https://github.com/joshuaburkhart/pywallet/blob/master/addrep.py

-1

If it's fewer than 10 wallets, just copy them into bitcoin-qt's configuration directory one-at-a-time and transfer all the bitcoins to a new wallet. It would take you about 10 minutes to do it.

1
  • 2
    This totally isn't helpful: obviously I could do it by hand, the whole point of this question is to avoid doing that.
    – o0'.
    Commented Apr 12, 2013 at 10:16

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.