<p>If you don't persist the headers in some way then you'd have to reload them each time you launched. Loading the headers from scratch isn't a free operation. Its not just a matter of downloading 626k. It may be a small amount of data in the end but each header still needs to be verified (targets calculated and checked, etc). Not only that, but there are less obvious privacy implications of requesting the block chain from the network each time.</p>

<p>SPVBlockStore still uses memory mapped IO so its not like you take a performance hit, it just makes subsequent launches of the software faster.</p>

CC BY-SA 3.0
2013-11-17T20:30:25.457Z
2013-11-17T20:30:25.457Z
jwsample
<p>My understanding of bitcoinj is that it is used to implement a "thin client" that doesn't store the entire blockchain- just the headers.</p>

<p>When I use the WalletAppKit, it creates a file "default.spvchain" that is 626Kib. This could easily fit in memory, so why is SPVBlockStore (using memory mapped file) used? Wouldn't MemoryBlockStore be a better choice?</p>

<bitcoinj><thin-clients>
In bitcoinj, why is MemoryBlockStore not used by default?
yzernik
# In bitcoinj, why is MemoryBlockStore not used by default?

(Asked by: username_0 on 2013-10-24)

My understanding of bitcoinj is that it is used to implement a "thin client" that doesn't store the entire blockchain- just the headers.

When I use the WalletAppKit, it creates a file "default.spvchain" that is 626Kib. This could easily fit in memory, so why is SPVBlockStore (using memory mapped file) used? Wouldn't MemoryBlockStore be a better choice?

**Tags:** bitcoinj, thin-clients


---

## 1 answers

### Answer by username_1 on 2013-11-17. Score: 1

If you don't persist the headers in some way then you'd have to reload them each time you launched. Loading the headers from scratch isn't a free operation. Its not just a matter of downloading 626k. It may be a small amount of data in the end but each header still needs to be verified (targets calculated and checked, etc). Not only that, but there are less obvious privacy implications of requesting the block chain from the network each time.

SPVBlockStore still uses memory mapped IO so its not like you take a performance hit, it just makes subsequent launches of the software faster.


---

