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?)

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?

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 on any new blocks, or searching the fairly new BIP158 Compact Block Filters. 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 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.

| improve this answer | |
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

| improve this answer | |

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.