After the heartbleed vulnerability, I'm concerned that my private keys could have been compromised. I want to send all my coins to a new address with a freshly generated key.

However, if I just ask the Bitcoin Core client to generate a new address, it will just select one from the existing keypool. The keypool keys may also have been compromised, so I don't want to use them. I want a key that is really brand new.

Short of asking Bitcoin to generate hundreds of new addresses to exhaust the keypool, is there a way to flush the keypool and start getting fresh addresses?

I understand this happens when you encrypt a wallet, but I prefer not to do that. (Anyway, if my wallet was already encrypted, that wouldn't be an option.)

  • 1
    Did you ever use the -rpcssl optiond of bitcoind, exposed to the Internet? Or did you ever use the Payment Protocol functionality in Bitcoin-Qt? If not, you're not at risk. May 10, 2014 at 14:12

3 Answers 3


If you call getnewaddress 100 times (via RPC for bitcoind, in the debug console for Bitcoin-Qt), the key pool is flushed.

After that, you can request one more new address and send all your funds there.


What I ended up doing was more or less what Pieter Wuille suggests: write a small shell script to call bitcoind getrawchangeaddress more than 100 times. (Using getnewaddress would have cluttered my list of receiving addresses.)


You have probably considered it already, but the only thing I can think of, is to create a new wallet.

Make a new wallet, and get an address from it

  • Backup your old wallet
  • Delete the old wallet from the Bitcoin directory
  • Start Bitcoin Core (it'll create a new wallet).
  • Copy a receive address from the new wallet.
  • Close Bitcoin Core

Transfer the bitcoins from the old wallet

  • Backup your new wallet.
  • Replace the new wallet in the Bitcoin directory with your old wallet.
  • Start Bitcoin Core
  • Send your Bitcoins to the previously copied address from the new wallet
  • Close Bitcoin Core
  • Replace the old wallet in the Bitcoin directory with your new wallet.

Keep the backup of the old wallet, to be able to check old transactional data, and addresses you've sent to, or if someone unexpectedly sends you bitcoins to an old address.

  • Of course you'd know the step-by-step, but maybe someone else would find it useful.
    – Murch
    Apr 10, 2014 at 12:31

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.