8

I am asking for what is being created when there is a new wallet created.

And the second part of my question is considering public key. Is the public key the same thing as the address? I read that there is for every private key a large pool of 100 adresses. Every adress is used when sending any single transaction and "creating" new adress.

  • There are many types of wallets and clients, each of which can operate in a unique way regarding how it stores and manages the wallet. You may wish to clarify that you are inquiring specifically about wallet for the Bitcoin.org client. – Stephen Gornick Jul 21 '12 at 20:06
  • 2
    For each private key corresponds a public key, and an address is the hash of a public key. There is no pool of 100 addresses -per private key-, rather the wallet has a pool of 100 private keys, each of which corresponds to an address. (This is referring to the standard client) – Meni Rosenfeld Jul 21 '12 at 20:27
6

Your wallet is a collection of private keys and a record of the transactions relating to them. By default your wallet has a key pool of 100 keys. So when your wallet is created, around 100 private keys are randomly generated and stored in your wallet.

Each private key has a corresponding public key, and each public key has a corresponding address. A public key isn't "the same thing as" an address, but there is an algorithm that can give you the address corresponding to any given public key. The reverse isn't true. There are many different public keys for each address, since public keys are 256 bits wide and addresses are only 160 bits wide.

When you click 'new address' in the 'receive coins' tab of the client, it will show you an address you've not seen before. It is taken from the 100 address keypool. The keypool is topped up when possible to always contain 100 unseen addresses. If your wallet is encrypted then it's not possible to top up the keypool until the wallet is unlocked with the passphrase.

Also, when you make a transaction out of your wallet, it's quite likely that the amount you are sending doesn't exactly match the sum of any of the inputs you currently have private keys for, and so some 'change' needs to be sent back to your wallet. When this happens an address from your 100 address keypool is used to receive the change. In this case the keypool will be immediately topped up, since your wallet will need to be unlocked since you're spending coins.

This all happens behind the scenes - you won't see any evidence of it happening unless you look at the blockchain.

3

When you create a new wallet you create 100 new private keys. From these can be derived the public keys and the "address". The keys are created randomly, so could in theory be the same as one already in existence, but that is so unlikely it will never happen.

Difference between the public key and the address is that the address is a "hash" of the public key along with a checksum added (so you can not mistype it) and is converted into characters that can be displayed and copy/pasted easily (base58).

Technical details are here: https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses

The only reason that 100 addresses are created is that when you backup your wallet, you will have saved the next 100 address you will use. So even if you do some transactions then lose the wallet and have to restore from backup you should still be able to get your bitcoins back (assuming you used less than 100 addresses since the backup).

  • Good point recovering from the backup! Note this is a double–edged sword: if someone steals your backup (or access your osx time machine at a point where there was no encryption!), your future transactions will be stolen too. – laffuste Apr 15 '14 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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