Author

Topic: When exactly does the client generates new keys? (Read 1250 times)

donator
Activity: 1218
Merit: 1079
Gerald Davis
It will add one address for every one used, so there will always be 100 (by default) unused addresses. That is as far as I know.

Great - I think that means my wallet encryption approach is safe then (as I never run the client to do more than a small number of transactions at a time).


For more safety you can increase the size of the keypool.  200 or 500 keys in keypool doesn't make the wallet much bigger (about 1 KB per key).

Just run client from command line w/ -keypool=xxx option (where xxx is desired size of keypool).  It does take a few seconds for it to generate a couple hundred keypairs so just let it run.  Once client loads if you will notice wallet.dat size has increased. 
newbie
Activity: 37
Merit: 0
Strictly speaking it generates a new key any time the number of keys in the pool drops below the number it thinks it should have.  The default is 100, but you can adjust that with the -keypool parameter.  Personally I run it once with the keypool size set to 10,000, and then backup the wallet.  It makes your wallet about 70Mb, but you don't have to worry about the backup becoming obsolete for quite a while.  Key creations and the size of the pool are recorded in the debug.log file if you feel the need to check on its status.
legendary
Activity: 1072
Merit: 1181
i hope some veteran user would comment if generate new address is the same as un-hide an address from pool and attach a new address at the pools end.

This is correct, at least as long as the wallet is not locked.

If your wallet is encrypted, and not unlocked by the user (by providing the passphrase), any new key retrieved from the key pool will cause the generation of a fresh one.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
It will add one address for every one used, so there will always be 100 (by default) unused addresses. That is as far as I know.

Great - I think that means my wallet encryption approach is safe then (as I never run the client to do more than a small number of transactions at a time).
sr. member
Activity: 462
Merit: 250
my best guess is that every time your client uses an address from the "100 addresses pool" it generates a new one.
also when you hit the button 'create new address' it will take an existing one from the pool, make it visible to you and creates a new one which is added to the pool but not to your eyes directly (is not visible in your address book). this way you have always a reserve list of addresses that will surface in the client gui on demand. and if you have to return to a backup wallet which is missing last transactions, you have pretty good chance to recover all your coins as they were send to yourself using the pool and/or if you received any bitcoins to any 'new' addresses, they were in fact already in that older backup sitting in the pool waiting for you to be 'generated'.

i hope some veteran user would comment if generate new address is the same as un-hide an address from pool and attach a new address at the pools end.

and that client generates new addresses for the pool as soon as any of them are used.
sr. member
Activity: 476
Merit: 250
It will add one address for every one used, so there will always be 100 (by default) unused addresses. That is as far as I know.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
Hi all,

Just wondering exactly when the standard client will generate new keys in your wallet. Will it do so only exactly when the last key in the key pool has been used or will it do it before that?

The reason for the question (and depending upon the answer the reason perhaps for a change request) is that I keep my wallet encrypted using external software which via a script I use to run the client decrypts and after the client finishes executing automatically re-encrypts the wallet (I am not using the Bitcoin wallet encryption).

My concern is that if the new keys are only generated when the pool is totally exhausted then if something terrible happens to my computer whilst the wallet is being re-encrypted then I could potentially lose BTC that was received via a newly generated key (this would not be a problem if new keys were generated whilst a number of "old keys" are still available to be used first).


Cheers,

Ian.
Jump to: