Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jonathan on February 27, 2013, 08:28:51 AM



Title: getnewaddress encrypts priv-key?
Post by: jonathan on February 27, 2013, 08:28:51 AM
I am running bitcoind in linux. I have encrypted the wallet using 'walletpassphrase'. I then ran 'getnewaddress'. This generated a new keypair, and showed me the new address (call it '1address') in bash.

But getnewaddress never asked me for my wallet's encryption key though.

I then run 'dumpprivkey 1address'. And bash tells me it can't recover the priv-key.

Now, i decrypt the wallet using 'walletpassphrase'. I try 'dumpprivkey 1addressblahblah...' again and the priv-key comes up in bash.

My question is, How come the client knew the encryption key in such a way as to automatically encrypt the newly generated keypair's priv-key?


Title: Re: getnewaddress encrypts priv-key?
Post by: Jouke on February 27, 2013, 08:34:39 AM
It pre-makes 100 addresses in your wallet and everytime you decrypt your wallet is automatically keeps that number of unused addresses up to date. When you ask for a new address it gives you one of those premade unused address.


Title: Re: getnewaddress encrypts priv-key?
Post by: jonathan on February 27, 2013, 08:57:41 AM
ah yes, thanks Jouke. :)