<p>Bitcoin 0.5 will flush the key pool upon encryption. This means that when you encrypt a fresh wallet, none of its active reserve keys will ever have touched the disk in unencrypted form.</p>

CC BY-SA 3.0
2011-11-18T12:44:09.137Z
2011-11-18T12:44:09.137Z
Pieter Wuille
<p>Seems to me that the easiest way would be to create a brand new, encrypted wallet using the new client, then send all your coins to that one and forget about the old one.</p>

<p>(You can force a new wallet by simply deleting wallet.dat before launching the client)</p>

CC BY-SA 3.0
2011-09-25T17:34:21.957Z
Can I create a brand new encrypted wallet?  I thought I could only create a wallet and then encrypt it.  i.e., if I had malware already that would copy the wallet.dat as soon as it was created, it would get the unencrypted copy before I had a chance to encrypt.
Stephen Gornick
CC BY-SA 3.0
2011-09-25T18:00:52.487Z
Yeah, I think you're right about that. I was addressing the case where you have some old backup that someone could possibly get ahold of (that's the way you put it in your question). The case where you have malware insta-stealing your new wallet I'm not sure about.
D.H.
CC BY-SA 3.0
2011-09-26T07:15:14.717Z
@Stephen: irrelevant. If you had a malware you could also have a keylogger that would get your passphrase, or whatever else.
o0'.
CC BY-SA 3.0
2011-09-26T10:12:08.300Z
You can start the client with -keypool=1, then encrypt the wallet, and then restart normally and add an address. Only one key ever touched your hard drive then in unencrypted form. There should be an option to force a new wallet to be created directly in encrypted mode though, but that'll be for after bitcoin-qt is merged.
Pieter Wuille
CC BY-SA 3.0
2011-11-12T04:16:54.920Z
Apparently there were problems with the encryption of existing key pool entries. https://bitcointalk.org/index.php?topic=51604.0
Stephen Gornick
CC BY-SA 3.0
2011-12-15T03:42:12.757Z
How to transfer all funds to new keys http://bitcoin.stackexchange.com/questions/1272/how-can-i-transfer-all-funds-to-new-keys
Stephen Gornick
CC BY-SA 3.0
2012-04-19T18:40:26.230Z
Gotta also remember to not re-use any addresses generated prior to encryption. http://bitcointalk.org/index.php?topic=77314.msg859310#msg859310   It is probably best to simply archive the old wallet.dat and start with a new, empty wallet and encrypt it before any receiving any coins.
Stephen Gornick
CC BY-SA 3.0
2011-09-25T16:29:49.923Z
2011-09-25T16:29:49.923Z
D.H.
<p>Now that v0.4 of the bitcoin client has encryption I've gone ahead and encrypted the keys in my wallet.  But I had previously made backups of my (unencrypted) wallet and those keys are the same keys that are now encrypted.</p>

<p>This gives me a false sense of security.</p>

<p>Is there any way after I've upgraded to v0.4 and encrypted to force all my existing keys to become invalid and then to spend to a new (encrypted) key so that even if an attacker gets ahold of my backup that my coins are safe?</p>

<security><wallet><encryption>
Can I force my wallet to only have news keys, post-encryption?
Stephen Gornick
# Can I force my wallet to only have news keys, post-encryption?

(Asked by: username_0 on 2011-09-25)

Now that v0.4 of the bitcoin client has encryption I've gone ahead and encrypted the keys in my wallet. But I had previously made backups of my (unencrypted) wallet and those keys are the same keys that are now encrypted.

This gives me a false sense of security.

Is there any way after I've upgraded to v0.4 and encrypted to force all my existing keys to become invalid and then to spend to a new (encrypted) key so that even if an attacker gets ahold of my backup that my coins are safe?

**Tags:** security, wallet, encryption


---

## 2 answers

### Answer by username_2 on 2011-09-25. Score: 6 | Accepted answer

Seems to me that the easiest way would be to create a brand new, encrypted wallet using the new client, then send all your coins to that one and forget about the old one.

(You can force a new wallet by simply deleting wallet.dat before launching the client)

> **Comments:**
> **username_0**: Can I create a brand new encrypted wallet?  I thought I could only create a wallet and then encrypt it.  i.e., if I had malware already that would copy the wallet.dat as soon as it was created, it would get the unencrypted copy before I had a chance to encrypt.  
> **username_2**: Yeah, I think you're right about that. I was addressing the case where you have some old backup that someone could possibly get ahold of (that's the way you put it in your question). The case where you have malware insta-stealing your new wallet I'm not sure about.  
> **username_3**: @username_0: irrelevant. If you had a malware you could also have a keylogger that would get your passphrase, or whatever else.  
> **username_1**: You can start the client with -keypool=1, then encrypt the wallet, and then restart normally and add an address. Only one key ever touched your hard drive then in unencrypted form. There should be an option to force a new wallet to be created directly in encrypted mode though, but that'll be for after bitcoin-qt is merged.  
> **username_0**: Apparently there were problems with the encryption of existing key pool entries. https://bitcointalk.org/index.php?topic=51604.0  
> **username_0**: How to transfer all funds to new keys http://bitcoin.stackexchange.com/questions/1272/how-can-i-transfer-all-funds-to-new-keys  
> **username_0**: Gotta also remember to not re-use any addresses generated prior to encryption. http://bitcointalk.org/index.php?topic=77314.msg859310#msg859310   It is probably best to simply archive the old wallet.dat and start with a new, empty wallet and encrypt it before any receiving any coins.  

---

### Answer by username_1 on 2011-11-18. Score: 4

Bitcoin 0.5 will flush the key pool upon encryption. This means that when you encrypt a fresh wallet, none of its active reserve keys will ever have touched the disk in unencrypted form.


---

