45

What data do different Bitcoin .dat files contain? How about the other files in the same folder?

The wallet.dat file is somewhat documented and there are some ways to convert it to human-readable form, but I don't think the same can be said about the other files. What data do they store and how is it encoded?

  • 1
    These are tied to each Bitcoin.org client release. For example, addr.dat was discontinued before v0.7. Other big changes will occur with v0.8. – Stephen Gornick Dec 1 '12 at 21:39
42

wallet.dat, addr.dat and blkindex.dat are Berkeley Database files. They can be read using standard tools, but aren't human readable by themselves. blk0001.dat (and additional blk000n.dat blocks) contain the blockchain itself, that's just a binary concatenation of the blocks.

  • wallet.dat contains your private keys, your address book, a copy of the transactions that send coins from or to one of your addresses, accounts, reserve keys, personal settings, and a pointer to the current best block.
  • addr.dat contains IP addresses of peers, both those you've connected to yourself or those you've only heard about. It has been replaced by peers.dat since 0.7.0
  • peers.dat contains the same information as addr.dat, but using an efficient custom format.
  • blkindex.dat contains an index of the blocks and transactions that can be found in all the blk000n.dat files.

I don't know about any standalone tools that convert addr.dat and blkindex.dat to human-readable form, although blockexplorer.com can be used to inspect the blockchain, and addr.dat just contains IP addresses.

Update: the data above is only valid before v0.8.0. As of v0.8.0, a new database structure (with associated filesystem layout) is used for blocks and indexes.

  • I made a list of the various keys that exist in a wallet.dat file in bitcoin.stackexchange.com/a/3177/659 . The list doesn't mention personal settings or a pointer to the current best block. I think the personal settings are saved in ~/.config/Bitcoin/Bitcoin-Qt.conf nowadays. But what about the pointer to the best block; is that still stored in the wallet? – Chris Moore Mar 15 '12 at 15:49
  • Since 0.6.0rc2, settings are either stored in ~/.config/Bitcoin/Bitcoin-qt.conf (but very platform dependent) or bitcoin.conf, and no longer in wallet.dat. – Pieter Wuille Mar 16 '12 at 8:42
  • I notice that an invalid setting is still stored in the wallet to prevent pre 0.4.0 clients which don't understand the 'minversion' entry from loading wallets that are too new for them to load properly. – Chris Moore Mar 16 '12 at 16:15
  • Oh, yes, indeed. – Pieter Wuille Mar 16 '12 at 16:54
  • 1
    Edit: since 0.7.0, peers.dat is used instead of addr.dat. – Pieter Wuille Dec 1 '12 at 14:48

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.