Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: blockbet.net on March 26, 2013, 02:05:40 PM



Title: Unencrypted backups (just curious)
Post by: blockbet.net on March 26, 2013, 02:05:40 PM
Hi guys, quick question just out of curiousity, no big deal...

I just noticed that when I encrypt my wallet on Bt-Qt, it gives a message saying that "for security reasons, previous unencrypted wallets will become useless" and I'm just curious about how that works technically. So if I load a previous, unencrypted wallet, how does the program or the network know that there exists an encrypted one?

Or maybe I didn't understand that statement correctly?

Thanks for reading.


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 26, 2013, 02:15:12 PM
All unused private keys in the key pool (by default 100) are replaced when you encrypt your wallet (in order to secure your future txs).

Thus any tx's you do *after* the encryption (other than deposits to addresses you have already used) will be using addresses that the old wallet has never seen so if you then tried to restore your wallet you could quite easily have lost *all* your BTC (as typically a tx sends change back to you via a new address).

So if your wallet balance was say 100 BTC (in one UTXO) and after encryption you made a single tx of 1 BTC then 99 BTC would be sent to a *change* address which the old wallet doesn't know (so if you tried to restore from your old backup you would have 0 BTC).


Title: Re: Unencrypted backups (just curious)
Post by: blockbet.net on March 26, 2013, 03:05:53 PM
Alright, makes sense, thanks for a extensive and clear answer! So I suppose the old unencrypted wallet isn't necessarily useless, as there may or may not be something left there, at least if it's fairly recent? Though I understand why the developers wanted to word it like that to avoid any misconceptions.


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 26, 2013, 03:38:12 PM
The old wallet *could* have something but because of *change* it may have nothing at all (hence the big warning).

Of course I would not advise you to "throw away" your old backup - just make sure you take a new one straight after encrypting!


Title: Re: Unencrypted backups (just curious)
Post by: zeroday on March 26, 2013, 03:58:36 PM
Is there possibility to extract private keys from entire keypool in encrypted wallet in order to make offline paper backup? 
Suppose it's some command-line or json command with bitcooind. Can somebody explain?


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 26, 2013, 03:59:40 PM
I don't think that the Satoshi client will let you do that but I think that tools such as pywallet could help with that (although I have not tried pywallet with an encrypted wallet so it may not work).


Title: Re: Unencrypted backups (just curious)
Post by: zeroday on March 26, 2013, 04:04:10 PM
Did anyone have success extracting private keys from encrypted wallet?


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 26, 2013, 04:06:54 PM
Did anyone have success extracting private keys from encrypted wallet?

Actually unless it has been updated to take a pass phrase to decrypt (with the correct code to do so) then I would think it would be of no help unfortunately (haven't had time to look at it so maybe others could comment).


Title: Re: Unencrypted backups (just curious)
Post by: Dabs on March 27, 2013, 03:30:56 AM
I've tried the latest version of pywallet with an encrypted wallet. Got all the new keys.

What I did:
1. backup old wallet.dat, put into a rar file.
2. delete old wallet.
3. restart bitcoin-qt, let it generate a new wallet.
4. before even using the new wallet, encrypt it.
5. backup newly generated newly encrypted wallet.dat
6. run pywallet on it to get 100 keys from wallet.dat


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 27, 2013, 03:38:59 AM
6. run pywallet on it to get 100 keys from wallet.dat

So pywallet recognizes encrypted wallets and prompts you for a pass phrase (just want to be certain)?


Title: Re: Unencrypted backups (just curious)
Post by: Dabs on March 27, 2013, 03:47:03 AM
The latest pywallet from jackjack allows you to input the passphrase. It also has a web interface but I just used the command line. Windows here.


Title: Re: Unencrypted backups (just curious)
Post by: CIYAM on March 27, 2013, 03:54:45 AM
The latest pywallet from jackjack allows you to input the passphrase. It also has a web interface but I just used the command line. Windows here.

Thanks and good to know (will be updating my version).