<p><strong><em>MemoryBlockStore</em></strong> keeps StoredBlocks in memory and it is used primarily for unit testing. </p>

<p>Whereas <strong><em>SPVBlockStore</em></strong> holds a limited number of block headers in a memory mapped ring buffer. With such a store, you may not be able to process very deep re-orgs and could be disconnected from the chain (requiring a replay), but as they are virtually unheard of this is not a significant risk.
You can find the reference document from the following link:</p>

<p>MemoryBlockStore
<a href="https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/MemoryBlockStore.html" rel="nofollow noreferrer">https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/MemoryBlockStore.html</a></p>

<p>SPVBlockStore
<a href="https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/SPVBlockStore.html" rel="nofollow noreferrer">https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/SPVBlockStore.html</a></p>

CC BY-SA 3.0
2018-04-03T02:02:45.057Z
2018-04-03T02:02:45.057Z
m2pathan
<p>What are differences between MemoryBlockStore and SPVBlockStore in bitcoinj?</p>

<p>Which should be used for downloading the blockchain and why?</p>

<p>Can I use same SPVChain format file for all wallets?</p>

<blockchain><bitcoinj>
Differences between MemoryBlockStore and SPVBlockStore
Shivam Gupta
# Differences between MemoryBlockStore and SPVBlockStore

(Asked by: username_0 on 2015-10-26)

What are differences between MemoryBlockStore and SPVBlockStore in bitcoinj?

Which should be used for downloading the blockchain and why?

Can I use same SPVChain format file for all wallets?

**Tags:** blockchain, bitcoinj


---

## 1 answers

### Answer by username_1 on 2018-04-03. Score: 2

***MemoryBlockStore*** keeps StoredBlocks in memory and it is used primarily for unit testing.

Whereas ***SPVBlockStore*** holds a limited number of block headers in a memory mapped ring buffer. With such a store, you may not be able to process very deep re-orgs and could be disconnected from the chain (requiring a replay), but as they are virtually unheard of this is not a significant risk.
You can find the reference document from the following link:

MemoryBlockStore
<https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/MemoryBlockStore.html>

SPVBlockStore
<https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/SPVBlockStore.html>


---

