<ol>
<li>"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</li>
<li>If you notice a bug, it's rather nice to report it to the dev instead of bashing him</li>
<li>Same thing for new flags you might want: ask for them instead of complain about their absence</li>
</ol>

<p><a href="https://bitcointalk.org/index.php?topic=34028.180" rel="nofollow">https://bitcointalk.org/index.php?topic=34028.180</a>
I can also provide an email address if you don't have a bitcointalk account</p>

CC BY-SA 3.0
2013-04-15T00:07:04.907Z
Oh, sorry, I assumed it was unmantained. I'll properly report at github later, then.
o0'.
CC BY-SA 3.0
2013-04-14T23:46:04.723Z
2013-04-14T23:46:04.723Z
jackjack
<p>I hate to be <em>that</em> guy, but you should really take another look at pywallet.  Your problems may be specific to <a href="https://github.com/joric/pywallet" rel="nofollow noreferrer">Joric's</a> pywallet, which hasn't been updated in awhile.  There is a better-maintained <a href="https://github.com/jackjack-jj/pywallet" rel="nofollow noreferrer">fork</a> of pywallet by JackJack. <br />
If this was the version of it that you already experienced, you could always try the web interface by running:<code>./pywallet.py --web</code> and then navigating to localhost:8989/ in a web browser. <br />
You did however request a command line way of doing it, which with jackjack's pywallet would look like this: <br />
<code>./pywallet.py --dumpwallet  --datadir=DATADIR --wallet=WALLETFILE --passphrase=PASSPHRASE</code> <br />
The <code>--passphrase</code> 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 <a href="https://github.com/jackjack-jj/pywallet/blob/master/README" rel="nofollow noreferrer">readme</a> (not really sure why that is).<br/>
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.</p>

CC BY-SA 3.0
2013-04-12T10:15:26.980Z
`--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'.
CC BY-SA 3.0
2013-04-12T20:22:11.497Z
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
CC BY-SA 3.0
2013-04-13T14:31:37.740Z
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'.
CC BY-SA 3.0
2013-04-13T16:04:17.813Z
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'.
CC BY-SA 3.0
2013-04-15T21:56:24.160Z
huh. I didn't need any other files to do it.
7anner
CC BY-SA 3.0
2014-09-19T01:33:43.077Z
Love that --web interface. I had a really bad experience with pywallet before too, but looks like this has gotten way  more mature. However, I *still* don't know how to get the private keys. I have the encrypted_privkey, and the "secret" in my output, but where the hell is the unencrypted private key?
B T
CC BY-SA 3.0
2013-04-12T00:42:54.720Z
2013-04-12T00:42:54.720Z
2020-06-16T11:10:03.350Z
7anner
<p>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.</p>

<p>I suggest doing the following for every <code>wallet.dat</code> file you have:</p>

<ol>
<li>Backup your current <code>wallet.dat</code> file.</li>
<li>Copy the old <code>wallet.dat</code> to your Bitcoin directory.</li>
<li><p>Open up a terminal and run the bitcoind daemon:</p>

<p><code>bitcoind -daemon</code></p></li>
<li><p>Retrieve a list of all the addresses in the wallet: </p>

<p><code>bitcoind listaddressgroupings</code></p></li>
<li><p>For every address you want the private key from, dump it:</p>

<p><code>bitcoind dumpprivkey &lt;bitcoinaddress&gt;</code></p></li>
<li><p>Stop the daemon before changing the wallet.dat file:</p>

<p><code>bitcoind stop</code></p></li>
</ol>

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

CC BY-SA 3.0
2013-04-11T15:50:37.850Z
This is terribly time consuming, that's exactly what I'm trying not to do.
o0'.
CC BY-SA 3.0
2013-04-11T20:13:35.693Z
How many wallet files do you have then? If you want to save time, you can always use PyWallet...
Steven Roose
CC BY-SA 3.0
2013-04-12T10:14:36.740Z
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'.
CC BY-SA 3.0
2013-04-15T09:45:06.573Z
With a little change to the code you could have changed that...
Steven Roose
CC BY-SA 3.0
2013-04-15T09:49:27.520Z
I tried, it's a complete mess, never seen anything like that.
o0'.
CC BY-SA 4.0
2018-06-16T18:26:54.080Z
some altcoin QT wallets use old code base, so dumpwallet doesn't even work. I had to use dumpprivkey, so I appreciate these steps as a workaround. dumpwallet is my preferred command, but sometimes it is not an option.
Sun
CC BY-SA 3.0
2013-04-11T14:09:08.723Z
2013-11-07T21:16:51.940Z
2013-11-07T21:16:51.940Z
Steven Roose
<p>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.</p>

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

<h3>Bash</h3>

<pre><code>#!/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
</code></pre>

<h3>Batch (Not my strong side)</h3>

<pre><code>@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%
</code></pre>

<p>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 <code>--dumpwallet</code> as I am not a user of pywallet, but I believe you can edit the pywallet.py code to change</p>

<pre><code>print json.dumps(json_db, sort_keys=True, indent=4)
</code></pre>

<p>to</p>

<pre><code>print "\n".join(private_keys)
</code></pre>

<p>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.</p>

<h2>Disclaimer - Once again, I have not tested any of this</h2>

CC BY-SA 3.0
2013-04-13T16:05:45.613Z
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'.
CC BY-SA 3.0
2013-04-13T05:55:30.480Z
2013-04-13T05:55:30.480Z
Bryan
<ol>
<li><p>Run JackJack's pywallet.py:</p>

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

<pre><code>$ python3 addrep.py ~/tmp/wallet_dump.txt
</code></pre></li>
</ol>

<p>example results:</p>

<pre><code>121a2C6kbqaPDrRDsbfZFNafcLBDZMum3p: 0 BTC
129oeaukHtXR8xiPqV8Mnb7p6hs9Ev3VwX: 0 BTC
12F9DRQRw2wmGrFUiZRQFk9cG2NtEBxYDv: 0 BTC
137wgZG4TSNw7Zqt4WrEHS7w2bgfeqXkkZ: 0 BTC
13PNjSy4b372f2jMVrHHLZnXXqgAArhwD8: 0 BTC
</code></pre>

<p>refs:</p>

<p><a href="https://github.com/jackjack-jj/pywallet/blob/master/pywallet.py" rel="nofollow">https://github.com/jackjack-jj/pywallet/blob/master/pywallet.py</a>
<a href="https://github.com/joshuaburkhart/pywallet/blob/master/addrep.py" rel="nofollow">https://github.com/joshuaburkhart/pywallet/blob/master/addrep.py</a></p>

CC BY-SA 3.0
2015-11-10T22:21:43.980Z
2015-11-10T22:21:43.980Z
Joshua Garrison Burkhart
<p>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.</p>

CC BY-SA 3.0
2013-04-12T10:16:47.203Z
This totally isn't helpful: **obviously** I could do it by hand, the whole point of this question _is_ to avoid doing that.
o0'.
CC BY-SA 3.0
2013-04-07T03:02:08.023Z
2013-04-07T03:02:08.023Z
Eyal
<p>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.</p>

CC BY-SA 3.0
2015-08-04T19:55:04.633Z
2015-08-04T19:55:04.633Z
Rich
<p>I have somewhere in my hard disks some copies of old wallets which I need to analyse.</p>

<p>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.</p>

<p>Is there an alternative?</p>

<p>I.e. either one software which given (via command line) <strong>the full path of the file</strong>, 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.</p>

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

CC BY-SA 3.0
2013-04-06T21:26:44.477Z
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
<blockchain.info><wallet.dat><wallet-import>
Dumping private keys from wallet.dat from command line (pywallet.py alternatives)
o0'.
# Dumping private keys from wallet.dat from command line (pywallet.py alternatives)

(Asked by: username_0 on 2013-04-04)

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.

**Tags:** blockchain.info, wallet.dat, wallet-import

> **Comments:**
> **username_1**: 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.  

---

## 7 answers

### Answer by username_10 on 2015-08-04. Score: 7 | Accepted answer

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.


---

### Answer by username_2 on 2013-04-14. Score: 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

> **Comments:**
> **username_0**: Oh, sorry, I assumed it was unmantained. I'll properly report at github later, then.  

---

### Answer by username_3 on 2013-04-12. Score: 1

I hate to be *that* guy, but you should really take another look at pywallet. Your problems may be specific to [Joric's](https://github.com/joric/pywallet) pywallet, which hasn't been updated in awhile. There is a better-maintained [fork](https://github.com/username_2-jj/pywallet) 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 username_2'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](https://github.com/username_2-jj/pywallet/blob/master/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.

> **Comments:**
> **username_0**: `--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)  
> **username_3**: 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?  
> **username_0**: 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.  
> **username_0**: As I thought, it doesn't work that way. It wants a full directory with the databases, an alone `wallet.dat` is not enough.  
> **username_3**: huh. I didn't need any other files to do it.  
> **username_4**: Love that --web interface. I had a really bad experience with pywallet before too, but looks like this has gotten way  more mature. However, I *still* don't know how to get the private keys. I have the encrypted_privkey, and the "secret" in my output, but where the hell is the unencrypted private key?  

---

### Answer by username_5 on 2013-04-11. Score: 1

Beside that I don't understand your problem with PyWaller, like username_9 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.

> **Comments:**
> **username_0**: This is terribly time consuming, that's exactly what I'm trying not to do.  
> **username_5**: How many wallet files do you have then? If you want to save time, you can always use PyWallet...  
> **username_0**: 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`.  
> **username_5**: With a little change to the code you could have changed that...  
> **username_0**: I tried, it's a complete mess, never seen anything like that.  
> **username_6**: some altcoin QT wallets use old code base, so dumpwallet doesn't even work. I had to use dumpprivkey, so I appreciate these steps as a workaround. dumpwallet is my preferred command, but sometimes it is not an option.  

---

### Answer by username_7 on 2013-04-13. Score: 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

> **Comments:**
> **username_0**: See my answer to username_3: pywallet is stupid and can't process a `wallet.dat` file if it isn't located into a directory with the bitcoin database.  

---

### Answer by username_8 on 2015-11-10. Score: 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/username_2-jj/pywallet/blob/master/pywallet.py>
<https://github.com/joshuaburkhart/pywallet/blob/master/addrep.py>


---

### Answer by username_9 on 2013-04-07. Score: -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.

> **Comments:**
> **username_0**: This totally isn't helpful: **obviously** I could do it by hand, the whole point of this question _is_ to avoid doing that.  

---

