Anatomy of the Bitcoin Node filesystem

There are man explanations like this, but this one is mine.

Just in case anyone was curious. I dug up some good posts on this and thought I'd distill it as best I could. I'll be using Windows file separators, but fee free to change them in your head.

If you name a -datadir argument, this is what will land there. If one is not named it defaults to %APPDATA%\Bitcoin

  • <datadir>\bitcoin.conf - The config file
  • <datadir>\debug.log - The log file
  • <datadir>\*.dat - Info on fees, peers, bans and mempool
  • <datadir>\blocks\index\* - Metadata for the block store
  • <datadir>\chainstate\* - The UTXO database

If you name a -blocksdir argument, this is what will land there. If one is not named it defaults to <datadir>

  • <blocksdir>\blocks\blk*.dat - The raw block data
  • <blocksdir>\blocks\rev*.dat - The Undo files. List of spent UTXOs for each block

If you name a -main.walletdir argument, this is what will land there. If one is not named it defaults to <datadir>\wallets or just <datadir> if the wallets subdirectory doesn't exist.

  • <walletdir>\wallet.dat - The wallet file with private keys and UTXOs
  • <walletdir>\db.log - Database log of access to wallet
  • <walletdir\database\* - More database logs

Note that -datadir, -blocksdir and -main.walletdir can all point to different storage. The things you need to keep in mind:

  1. -datadir should be your FASTEST storage
  2. -blocksdir should be your LARGEST storage
  3. -main.walletdir should be your most SECURE storage

As a footnote, testnet will throw a testnet3\ in everything, and would require a -test.walletdir switch to set the wallet directory.



Submitted September 22, 2020 at 11:11AM by brianddk https://ift.tt/3mJItvJ

Comments

Popular posts from this blog

No, Bitcoin is not controlled by a small group of investors and miners (A rebuttal to the TechSpot article)

Day 9: I will post this guide regularly until available solutions like SegWit, order batching, and Lightning payment channels are mass adopted, the mempool is empty once again, and tx fees are low. Have you done your part?