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

CC BY-SA 3.0
2014-05-10T14:20:27.703Z
2014-05-10T14:20:27.703Z
Nate Eldredge
<p>If you call <code>getnewaddress</code> 100 times (via RPC for bitcoind, in the debug console for Bitcoin-Qt), the key pool is flushed.</p>

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

CC BY-SA 3.0
2014-05-10T14:14:09.753Z
2014-05-10T14:14:09.753Z
Pieter Wuille
<p>You have probably considered it already, but the only thing I can think of, is to <strong>create a new wallet</strong>.</p>

<h2>Make a new wallet, and get an address from it</h2>

<ul>
<li><strong>Backup</strong> your old wallet </li>
<li>Delete the old wallet from the Bitcoin directory</li>
<li>Start Bitcoin Core (it'll create a new wallet).</li>
<li>Copy a receive address from the new wallet.</li>
<li>Close Bitcoin Core</li>
</ul>

<h2>Transfer the bitcoins from the old wallet</h2>

<ul>
<li><strong>Backup</strong> your new wallet.</li>
<li>Replace the new wallet in the Bitcoin directory with your old wallet.</li>
<li>Start Bitcoin Core</li>
<li>Send your Bitcoins to the previously copied address from the new wallet</li>
<li>Close Bitcoin Core</li>
<li>Replace the old wallet in the Bitcoin directory with your new wallet.</li>
</ul>

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

CC BY-SA 3.0
2014-04-10T12:31:30.727Z
Of course you'd know the step-by-step, but maybe someone else would find it useful.
Murch
CC BY-SA 3.0
2014-04-10T12:31:05.970Z
2014-04-10T12:31:05.970Z
Murch
<p>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.</p>

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

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

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

CC BY-SA 3.0
2014-05-10T14:12:39.747Z
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.
Pieter Wuille
<bitcoin-core><private-key><keypool>
How do I flush the keypool?
Nate Eldredge
# How do I flush the keypool?

(Asked by: username_0 on 2014-04-10)

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.)

**Tags:** bitcoin-core, private-key, keypool

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

---

## 3 answers

### Answer by username_0 on 2014-05-10. Score: 2 | Accepted answer

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


---

### Answer by username_1 on 2014-05-10. Score: 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.


---

### Answer by username_2 on 2014-04-10. Score: 1

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.

> **Comments:**
> **username_2**: Of course you'd know the step-by-step, but maybe someone else would find it useful.  

---

