2

Using SPV the client can assure that a transaction is inside a block, but how does it know in which blocks to look?

3

SPV nodes usually only look at block headers, and then will download some of the actual block data of blocks which other peers have told them contain transactions relevant to them. SPV nodes are relying on at least one of their peers to be honest and report when a transaction appears on the network that is relevant to them.

But how do other peers know which transactions the SPV nodes want to know about?

SPV nodes essentially give their full-node peers a filter, called a bloom filter, that tells the nodes that download all the transaction data which transactions to send to the spv node. This filter also has a built-in false positive rate, so that the SPV nodes don't have to show exactly which addresses are theirs (essentially a built-in privacy level). Rather they make a filter that will validate a superset of transactions that the node is actually interested in.

The filteradd, filterclear, and filterload are the relevant p2p protocol methods. The bitcoin developer documentation goes into more detail here.

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.