How can I export all my private keys using bitcoind?

6

2

I know that PyWallet has a -dumpwallet but without using pywallet, how can I export all the addresses and privatekeys with the stock bitcoind?

Is there an API command that lists all addresses held by the wallet?

Stephen Gornick

Posted 2012-09-04T21:10:02.320

Reputation: 26 118

Answers

4

You could send the dumpprivkey JSON-RPC call to the client. It takes a single parameter of BitcoinAddress to reveal the private key for that specific address.

To export all private keys for all addresses, you would have to call listreceivedbyaddress to list the addresses and then call dumpprivkey for each.

See: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list

Jason Southwell

Posted 2012-09-04T21:10:02.320

Reputation: 360

1That won't dump keys associated with 'change' addresses.gavinandresen 2012-09-05T01:31:24.460

1According to the documentation...

"Listing the bitcoin addresses in your wallet is easily done via listreceivedbyaddress. It normally lists only addresses which already have received transactions, however you can list all the addresses by setting the first argument to 0, and the second one to true." – Jason Southwell 2012-09-07T23:34:40.067

3

Using bitcoin-qt for an interface:

listaddressgroupings

is the command which will list all addresses in use. Run it in the debug console window from the 'Help/Debug Window' screen.

Then, apparently, you can dump all the private keys, but only one at a time, using dumpprivkey for each key.

Seems lame.

SnowDog

Posted 2012-09-04T21:10:02.320

Reputation: 31

1

Just go to your QT Wallet Console (Help -> Debug Window -> Console)

dumpwallet "C:/users/yout-user-name/dumpwallet.txt" 

The command will export every of your private keys into that text file.

P/s: in case you have encrypted Wallet before you need run this command before run dumpwallet

walletpassphrase "your pass phrase" 600

rc125

Posted 2012-09-04T21:10:02.320

Reputation: 11