I have a private key and I want to add it to the keys in the Bitcoin client. Is there an easy way to do this?


2 Answers 2


Importing could be done with Pywallet or hopefully soon-to-be-official wallet export/import bitcoin patch, but make sure to backup your wallet first.

  • Pywallet doesn't work on Mac. When the patch is official, will it be a part of the normal version of the client? Dec 17, 2011 at 19:15
  • @shoeless joe, that is wrong because "Pywallet is a python script that deals with wallets and keys" and "Confirmed to work on: Ubuntu 32bit(me), Windows 32bit(me) 64bit(ctoon6), OSX(defxor)" , as for the patch, I think you better ask Gavin
    – Serith
    Dec 17, 2011 at 19:42
  • What I mean is that it doesn't work on Mac unless you load a thousand non-native programs: bitcointalk.org/index.php?topic=34028.msg437850#msg437850 Dec 18, 2011 at 8:46
  • Quite disappointing: seems you have to import keys one by one?
    – o0'.
    Apr 30, 2012 at 14:23
  • The answer was written a while ago, a lot has changed since then, and I remember some buzz about the functionality on forum. Maybe someone made an improvement, my first guess would be to look at Armory client: bitcoinarmory.com
    – Serith
    May 4, 2012 at 1:09

An answer to How can I export the private key for an address from the satoshi client? gives the steps required to export a private key. The steps to import a private key are the same except that you need to change "dumpprivkey 1aaabbb..." to "importprivkey 5aaabbb...".

If you use bitaddress.org's "Bulk Wallet" feature you can generate a list of private keys, like this:


To import all the private keys into your wallet:

  1. copy/paste the list into a temporary file, /tmp/bitaddress.txt making sure there's a newline on the end of the last line
  2. tr -d '"' < /tmp/bitaddress.txt | tr , ' ' | while read number address privkey; do echo importing $address; bitcoind importprivkey $privkey; done

Note: if you're running Windows you'll need to modify the command in step 2 to whatever the equivalent Windows shell command would be.

Note 2: the importprivkey command is very slow since it rescans the whole transaction history after each private key import. It's possible to speed it up considerably by commenting out two lines in the bitcoind source code.

Note 3: importprivkey now has an optional rescan option which you can set to false. This will make importing much faster, and you don't have to edit the source code.

  • Hi Chris, this is a very good answer, but it presupposes that bitcoind is running on my computer, which it is not. So how do I get bitcoind running so I can give it the importaprivkey command? Aug 6, 2012 at 17:07
  • You don't need the bitcoind server running. The regular bitcoin-qt program will act as a server if you start it with the -server argument. You will need the bitcoind program to act as the client though. Do you have a copy of the bitcoind program? I thought it came with bitcoin-qt, but maybe that's not true. Aug 6, 2012 at 22:18
  • Yes, I have the bitcoin-qt program. I could start it in a Terminal window using -server argument. I can't find bitcoind on the bitcoin.org website and it is not in the bundle for MacOS. Aug 7, 2012 at 20:51
  • See bitcoin.stackexchange.com/a/4251/659 - it appears that you will need to build bitcoind from source. Aug 8, 2012 at 0:38
  • So the whole thing falls apart again and I am left doing really hacky things with lots of programs and libraries. Aug 10, 2012 at 3:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.