15

What information does the Bitcoin wallet file used by the Bitcoin.org client contain?

Is the owner's Bitcoin balance written in the wallet.dat file, or does it contain a list of transactions that have been made since the beginning of wallet creation? Does the wallet's filesize grow bigger as more transactions are made?

  • Now that there are clients with their own wallet formats, I clarified the question by specifying that it is referring to the Bitcoin.org client. – Stephen Gornick Mar 15 '12 at 19:38
  • The one important thing contained in the wallet is the secret (private key or keys) needed to access your Bitcoin address(es), one for each. Everything else depends on your specific client. Also note that clients may or may not preallocate future Bitcoin addresses for you in your wallet file, and may or may not update that in the future (hence possibly requiring regular rather than one-off backups). – pyramids Nov 13 '13 at 14:31
12

From looking at the code, the wallet.dat can contain entries of the following types:

  • name - an address book name
  • tx - a transaction
  • acentry - an accounting entry
  • key - a pair of public and private keys
  • mkey - a master key
  • ckey - an encrypted key
  • defaultkey - the default receiving address' key
  • pool - a keypool entry
  • version - the version of the software that wrote this wallet
  • minversion - the earliest version of the software that can read this wallet
  • cscript - a script
  • bestblock - a pointer to the end of the best blockchain seen
  • wkey - a private key (no longer used)
  • setting - used to store user interface settings (no longer used, except to hold an invalid setting to stop pre-0.4.0 versions of the client which don't understand minversion from loading wallets that are too new for them)

See also this answer.

  • wkey is not used anymore, afaik, it is a private key with some metadata. key contains both public and private key. There is also 'bestblock' with a locator of the last seen tip of the blockchain. – Pieter Wuille Mar 15 '12 at 18:15
2

A default bitcoin wallet contains a list of private and pub key pairs. A number of keys are created on generation this is to allow for "swap" as you send money from it, these are not visible directly. This does not affect your balance which you use.

Your transactions are stored within the blockchain. If you generate new address to receive to then your wallet size will grow. If your wallet is moved to a new computer, with no blockchain, it will appear empty until you download blocks up until your transactions are known by the client.

  • Yes, but the wallet also contains a copy of the transactions that affect your balance. If you restore an old backup of wallet.dat you'll find it is missing transactions that happened after the backup until you use the -rescan command line option to get it to look through the blockchain and copy the relevant new transactions into the wallet.dat. – Chris Moore Mar 15 '12 at 15:23
  • Not all clients store this information as far as im aware. – MaxSan Mar 15 '12 at 15:24
  • I guess I assumed the question was about the Satoshi client. Is there another one which keeps its wallet in "wallet.dat" and rescans the entire blockchain every time you run it? – Chris Moore Mar 15 '12 at 17:30
  • Your correct. I took wallet as generic rather than the specific client. Il modify my answer. – MaxSan Mar 15 '12 at 19:01

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.