Bitcoin Forum
May 12, 2024, 04:33:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: When exactly does the client generates new keys?  (Read 1223 times)
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 09, 2012, 08:45:37 AM
 #1

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.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
1715488418
Hero Member
*
Offline Offline

Posts: 1715488418

View Profile Personal Message (Offline)

Ignore
1715488418
Reply with quote  #2

1715488418
Report to moderator
1715488418
Hero Member
*
Offline Offline

Posts: 1715488418

View Profile Personal Message (Offline)

Ignore
1715488418
Reply with quote  #2

1715488418
Report to moderator
1715488418
Hero Member
*
Offline Offline

Posts: 1715488418

View Profile Personal Message (Offline)

Ignore
1715488418
Reply with quote  #2

1715488418
Report to moderator
"Bitcoin: mining our own business since 2009" -- Pieter Wuille
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715488418
Hero Member
*
Offline Offline

Posts: 1715488418

View Profile Personal Message (Offline)

Ignore
1715488418
Reply with quote  #2

1715488418
Report to moderator
vuce
Sr. Member
****
Offline Offline

Activity: 476
Merit: 250


View Profile
January 09, 2012, 10:27:19 AM
 #2

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.
mila
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250



View Profile
January 09, 2012, 12:20:46 PM
 #3

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.

your ad here:
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 09, 2012, 12:24:19 PM
 #4

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

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
January 09, 2012, 01:00:49 PM
 #5

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.

I do Bitcoin stuff.
tlhonmey
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
January 19, 2012, 07:15:29 PM
 #6

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.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
January 19, 2012, 07:32:10 PM
 #7

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. 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!