1

When I run Bitcoin core to synchronize the blockchain without getting innvolved in any transaction, the wallet.dat gets written to nevertheless.

I believe this is the case because the wallet keeps track of the best chain. (However, I am not sure if this is the only change that is written to the wallet.)

Now, I am wondering why the wallet needs to keep track of the best chain. My possibly faulty understaning is that there is a consensus about the best chain which can be deduced from the blockchain. Hence, no seperate storing of it should be necessary.

2

I think it is necessary. The wallet doesn't just contain addresses. It also contains transactions that are sent to you.

Suppose you generate a wallet, then back it up. You receive a bunch of money. You delete the wallet on your computer, and restore the old wallet. How does Bitcoin know that it should rescan the blockchain for transactions sent to you? I don't think it can, unless the wallet contains a field that represents the current best chaintip.

If you don't want Bitcoin to ever write to the wallet, you can compile it with --disable-wallet.

  • Exactly. The best chain field in the wallet is so that the client knows what to rescan after a restore from backup. – Pieter Wuille Jul 5 '17 at 19:16

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.