<blockquote>
  <p>SPV (lightweight) users do not have a chain. (Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers. Am I correct?)</p>
</blockquote>

<p>SPV clients only keep track of the block headers, usually rely on other nodes to do the block validity verification, and do not keep any full blocks around. This may seem similar to a pruned node that only keeps a portion of the latest blocks, but is entirely different. Full nodes need the complete blocks to update the state of their ledger (the UTXO Set), pruned node fully verify each block and later discard part of the original chain. This only means that they cannot serve all blocks to other nodes and that they have to download the blocks again if they reindex, but they always have verified the full blockchain themselves. SPV nodes only track the block headers, and when they're interested in a block consume that block fully. Only then do they do some sanity checks like verifying that the block is well-formed. However, it's impossible to verify a single block fully without verifying all of its predecessors, so SPV nodes inherently trust their peers to serve them the correct blockchain.</p>

<blockquote>
  <p>If a block is created by a miner and a SPV user receives this block, he must append this block to the existing block chain, but this SPV user does not have the blockchain in this case, so what does SPV user do with a block when he receives it?</p>
</blockquote>

<p>SPV clients don't keep track of the full ledger, they only track the state of transactions that they created or that got sent to them. SPV clients use one of multiple methods to find out whether a block includes any interesting transactions such as delegating this completely to third parties (e.g. wallet service, Electrum server), requesting full node peers to run the SPV client's <a href="https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki" rel="nofollow noreferrer">BIP37 bloom filter</a> on any new blocks, or searching the fairly new <a href="https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki" rel="nofollow noreferrer">BIP158 Compact Block Filters</a>. Once the SPV client has identified that they're interested in a block, they either request the full block to get the actual transaction data, or they ask for the <a href="https://bitcoin.stackexchange.com/a/38399/5406">Merkle branch</a> and the transaction.</p>

<blockquote>
  <p>Do they just attach its block header to what the SPV user has at that time?</p>
</blockquote>

<p>Yeah, SPV clients keep a chain of all block headers, and for any transactions they're interested in, they keep the Merkle branch that ties the transaction to the block.</p>

CC BY-SA 4.0
2019-12-07T16:09:22.043Z
2019-12-07T16:09:22.043Z
Murch
<p>SPV can be well understood if you look at the purpose of having SPV. SPV is created for fast verification of a transaction being in the blockchain. This is useful when a user is only interested in knowing whether a transaction related to him/her is embedded in the blockchain and how much computation power the community has spent after it. </p>

<p>Each block in blockchain is of 1MByte size whereas the block header size is only 80bytes. The total size of all the block header to date is still only a few  MBytes which can be easily stored on a mobile device. </p>

<p>In a block, the transactions are tracked in the Merkle tree, where the existence of a transaction can be verified in O(log n) time if the path to the transaction is known. So whenever an SPV client is interested in knowing the existence of a transaction it can download the corresponding block from a full node and then check it. </p>

<p>Now coming to your question</p>

<blockquote>
  <p>Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers</p>
</blockquote>

<p>It depends on whether an SPV has requested for the updated block header from a full node or not.</p>

<blockquote>
  <p>what does SPV user do with a block when he receives this? </p>
</blockquote>

<p>Ideally, it should propagate the block to nodes it is connected to but an SPV can just decide to drop it and do nothing.</p>

<blockquote>
  <p>Just attach its block header to what the SPV user has at that time?</p>
</blockquote>

<p>It can't be done as the block header of the previous block will not match</p>

CC BY-SA 3.0
2018-02-14T10:40:29.947Z
Actually, a block can be larger than 1MB since BIP141. https://bitcoin.stackexchange.com/questions/69468/what-is-the-current-maximum-bitcoin-block-size-in-mb
Willtech
CC BY-SA 4.0
2018-01-14T13:10:14.670Z
2019-12-07T15:46:15.357Z
2019-12-07T15:46:15.357Z
sourav
<p>SPV (lightweight) users do not have a chain. (Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers. Am I correct?)</p>

<p>If a block is created by a miner and a SPV user receives this block, he must append this block to the existing block chain, but this SPV user does not have the blockchain in this case, so what does SPV user do with a block when he receives it?</p>

<p>Do they just attach its block header to what the SPV user has at that time?</p>

<blockchain><block><spv>
How do SPV clients apply a new block?
Rubertos
# How do SPV clients apply a new block?

(Asked by: username_0 on 2018-01-14)

SPV (lightweight) users do not have a chain. (Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers. Am I correct?)

If a block is created by a miner and a SPV user receives this block, he must append this block to the existing block chain, but this SPV user does not have the blockchain in this case, so what does SPV user do with a block when he receives it?

Do they just attach its block header to what the SPV user has at that time?

**Tags:** blockchain, block, spv


---

## 2 answers

### Answer by username_1 on 2019-12-07. Score: 1

> SPV (lightweight) users do not have a chain. (Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers. Am I correct?)

SPV clients only keep track of the block headers, usually rely on other nodes to do the block validity verification, and do not keep any full blocks around. This may seem similar to a pruned node that only keeps a portion of the latest blocks, but is entirely different. Full nodes need the complete blocks to update the state of their ledger (the UTXO Set), pruned node fully verify each block and later discard part of the original chain. This only means that they cannot serve all blocks to other nodes and that they have to download the blocks again if they reindex, but they always have verified the full blockchain themselves. SPV nodes only track the block headers, and when they're interested in a block consume that block fully. Only then do they do some sanity checks like verifying that the block is well-formed. However, it's impossible to verify a single block fully without verifying all of its predecessors, so SPV nodes inherently trust their peers to serve them the correct blockchain.

> If a block is created by a miner and a SPV user receives this block, he must append this block to the existing block chain, but this SPV user does not have the blockchain in this case, so what does SPV user do with a block when he receives it?

SPV clients don't keep track of the full ledger, they only track the state of transactions that they created or that got sent to them. SPV clients use one of multiple methods to find out whether a block includes any interesting transactions such as delegating this completely to third parties (e.g. wallet service, Electrum server), requesting full node peers to run the SPV client's [BIP37 bloom filter](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki) on any new blocks, or searching the fairly new [BIP158 Compact Block Filters](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki). Once the SPV client has identified that they're interested in a block, they either request the full block to get the actual transaction data, or they ask for the [Merkle branch](https://bitcoin.stackexchange.com/a/38399/5406) and the transaction.

> Do they just attach its block header to what the SPV user has at that time?

Yeah, SPV clients keep a chain of all block headers, and for any transactions they're interested in, they keep the Merkle branch that ties the transaction to the block.


---

### Answer by username_2 on 2018-01-14. Score: 0

SPV can be well understood if you look at the purpose of having SPV. SPV is created for fast verification of a transaction being in the blockchain. This is useful when a user is only interested in knowing whether a transaction related to him/her is embedded in the blockchain and how much computation power the community has spent after it.

Each block in blockchain is of 1MByte size whereas the block header size is only 80bytes. The total size of all the block header to date is still only a few MBytes which can be easily stored on a mobile device.

In a block, the transactions are tracked in the Merkle tree, where the existence of a transaction can be verified in O(log n) time if the path to the transaction is known. So whenever an SPV client is interested in knowing the existence of a transaction it can download the corresponding block from a full node and then check it.

Now coming to your question

> Well, some SPV users have a fraction of the full chain, but some SPV users only have block headers

It depends on whether an SPV has requested for the updated block header from a full node or not.

> what does SPV user do with a block when he receives this?

Ideally, it should propagate the block to nodes it is connected to but an SPV can just decide to drop it and do nothing.

> Just attach its block header to what the SPV user has at that time?

It can't be done as the block header of the previous block will not match

> **Comments:**
> **username_3**: Actually, a block can be larger than 1MB since BIP141. https://bitcoin.stackexchange.com/questions/69468/what-is-the-current-maximum-bitcoin-block-size-in-mb  

---

