2

I've noticed that Bitcoin Core and its API now strongly prefers to make a separate sub-dir in your datadir for each wallet, such as "lukewarm", which then contains a wallet.dat, instead of just having "lukewarm.dat" in the data dir.

Why was this change made? I can't tell you how much scary work it would be for me to update my own system into this new method. I refer to my wallets by their .dat filename and that's their internal label that I use to keep track of everything in my database.

I know that Bitcoin Core also supports the old way (different-named .dat files in the data dir), but for how long? And why was this change made to begin with? It seems to create some kind of log files or something which seem to contain nothing of value. What's that about? Am I missing out by clinging to the old way? I don't understand why it wants to segment wallets into wallet.dat files in their own sub-dirs.

1

The original move to a directory per wallet file was motivated due to an issue with the way Berkeley DB behaved when multiple databases were opened in the same database environment, which are tied to directories containing the database. In particular, the issue is that BDB creates a database environment log which contains data from all of the databases open. This creates issues with backing up and portability as database logs need to be backed up as well.

With the transition away from BDB to SQLite, it is possible that we move back to the old way. However current discussions around that seem to indicate that that move is unlikely.l

3
  • Interesting. Can you elaborate on why the database logs need to be backed up, though? Why are those important? Am I putting myself at risk for not using or backing up them? – Mickel S. Feb 20 at 1:09
  • 1
    BDB writes to the log before they are written to the database file. It is possible to create a situation where a record exists only in the log and not the database itself (the wallet.dat file). This is dangerous as only backing up the database file will cause you to lose anything that was only written to the log and not the database yet. So yes, you should be backing up the database logs and you are putting yourself at risk if you are not. – Andrew Chow Feb 20 at 1:27
  • Bitcoin Core will try to ensure that everything from the logs is in the database file, and remove the logs afterwards. But it is possible to create a situation where the logs exist after the shutdown. – Andrew Chow Feb 20 at 1:27

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.