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

<p>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.</p>

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

CC BY-SA 3.0
2017-07-05T19:16:00.083Z
Exactly. The best chain field in the wallet is so that the client knows what to rescan after a restore from backup.
Pieter Wuille
CC BY-SA 3.0
2017-07-05T17:40:05.877Z
2017-07-05T17:40:05.877Z
Nick ODell
<p>When I run Bitcoin core to synchronize the blockchain without getting innvolved in any transaction, the <code>wallet.dat</code> gets written to nevertheless.</p>

<p>I <em>believe</em> 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.)</p>

<p>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.</p>

<blockchain><wallet>
Why does the wallet keep a pointer to the best chain
René Nyffenegger
# Why does the wallet keep a pointer to the best chain

(Asked by: username_0 on 2017-07-05)

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.

**Tags:** blockchain, wallet


---

## 1 answers

### Answer by username_1 on 2017-07-05. Score: 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`.

> **Comments:**
> **username_2**: Exactly. The best chain field in the wallet is so that the client knows what to rescan after a restore from backup.  

---

