Once a wallet file is initially created, does the reference client generate additional private keys?

5

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

smickles

Posted 2012-11-25T10:30:14.300

Reputation: 440

Answers

7

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.

Pieter Wuille

Posted 2012-11-25T10:30:14.300

Reputation: 54 032

what does EC stand for?knocte 2016-05-31T11:25:57.520

Elliptic Curve.Pieter Wuille 2016-05-31T12:00:33.973

So then, is it a certainty that one private key has just one public key associated with it?smickles 2012-11-25T18:08:01.677

1Every 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 2012-11-27T11:03:47.710