Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

I'm just assuming that the wallet.dat file created by the reference client contains just one private key. (Correct me if I'm wrong here)

I want to know if the client generates additional private keys and if so, under what circumstances? Does a keypoolrefill affect the quantity of private keys? Does generating a given number of addresses cause an additional private key to be generated? etc...

share|improve this question
add comment

1 Answer 1

When a wallet is created, it contains 100 keys in its "key pool". Only one of them is made visible, but when you create a new address, it actually just takes one key from the pool. The reason for this is so you don't need to backup your wallet.dat file after every transaction or new address,

New keys are generated every time one is pulled from the key pool, if possible, to keep the key pool at size 100. In an encrypted wallet, the passphrase is required to store new keys, so the key pool is only filled when the wallet gets unlocked.

share|improve this answer
    
So then, is it a certainty that one private key has just one public key associated with it? –  smickles Nov 25 '12 at 18:08
1  
Every EC private key has exactly one EC public key associated with it. This public key can be serialized in compressed or uncompressed form, though, and as the address is derived from the hash of the serialized public key, there are really two addresses for every private/public key. In Bitcoin we solve this by separating all of them: the private keys get a marker byte, and we consider the compressed and uncompressed public key to be separate. –  Pieter Wuille Nov 27 '12 at 11:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.