<p>Latest versions of the reference Bitcoin implementation have the 'dumpwallet' RPC command, which dumps a human-readable list of all of your private keys.</p>

<p>The format is simple: just comment-lines (starting with #) or lines that are the private key (plus metadata about the key). So to combine keys from several wallets you would:</p>

<ol>
<li>Re-run bitcoind/Bitcoin-Qt, giving the -wallet=/path/to/wallet option</li>
<li>dumpwallet the private keys to a file (walletpassphrase first if the wallet has a passphrase)</li>
<li>Shutdown</li>
<li>concatenate the files together</li>
<li>Re-run and importwallet the combined file</li>
</ol>

<p>The last step will take a while as the blockchain is scanned for transactions to/from the imported private keys (concatenating several wallet keys together in step 3 saves time over repeatedly dumping/importing).</p>

<p>A php or python or bash script that did all of the starting/stopping/concatenating either using the JSON/RPC interface or bitcoin-cli would be spiffy. Extra credit if it noticed which wallets were locked and prompted for passphrases....</p>

CC BY-SA 3.0
2014-06-09T14:36:35.910Z
2014-06-09T14:36:35.910Z
gavinandresen
<p>I know about pywallet, about this <a href="https://github.com/bitcoin/bitcoin/pull/220" rel="nofollow">modification</a> for bitcoind, but what is a simple way to merge two wallets, or export a list of private keys and addresses of all of wallets from litecoin, dogecoin, bitcoin, quark, et cetera?</p>

<p>Thank you!</p>

<wallet.dat>
How to merge two wallet.dat files
Alex
# How to merge two wallet.dat files

(Asked by: username_0 on 2014-06-08)

I know about pywallet, about this [modification](https://github.com/bitcoin/bitcoin/pull/220) for bitcoind, but what is a simple way to merge two wallets, or export a list of private keys and addresses of all of wallets from litecoin, dogecoin, bitcoin, quark, et cetera?

Thank you!

**Tags:** wallet.dat


---

## 1 answers

### Answer by username_1 on 2014-06-09. Score: 5

Latest versions of the reference Bitcoin implementation have the 'dumpwallet' RPC command, which dumps a human-readable list of all of your private keys.

The format is simple: just comment-lines (starting with #) or lines that are the private key (plus metadata about the key). So to combine keys from several wallets you would:

1. Re-run bitcoind/Bitcoin-Qt, giving the -wallet=/path/to/wallet option
2. dumpwallet the private keys to a file (walletpassphrase first if the wallet has a passphrase)
3. Shutdown
4. concatenate the files together
5. Re-run and importwallet the combined file

The last step will take a while as the blockchain is scanned for transactions to/from the imported private keys (concatenating several wallet keys together in step 3 saves time over repeatedly dumping/importing).

A php or python or bash script that did all of the starting/stopping/concatenating either using the JSON/RPC interface or bitcoin-cli would be spiffy. Extra credit if it noticed which wallets were locked and prompted for passphrases....


---

