How do SPV clients acquire transactions from other nodes and verify that they are part of the blockchain?


I explored SPV clients as a subject from a lot of different resources, but there are a few of things that are keeping me confused:

  1. I found out that SPV clients have no mempool even though SPV clients are participating in transaction verification. So, what happens when the node verifies a transaction? Is a SPV client checking only its own outgoing transactions?
  2. Does a transaction that a SPV client is trying to verify have a block hash as a reference where the transaction came from? Is that how a SPV client knows in which block to search for the target transaction when the SPV asks a full node for part of Merkle tree?
  3. A SPV client asks a full node for hashes inside the Merkle tree, so it can reconstruct the part of the tree it is interested in and checks that way if a transaction is really in the block that the transaction is referring to. Is this correct? And if it is, is there anything more these two clients share?
  4. If I'm on the right path, how do bloom filters help in increasing of level of privacy since SPV clients still needs to ask a full node for a transaction by its hash?

Thank you.


Posted 2020-07-13T17:00:45.410

Reputation: 419

You would get better answers to each of your seven question in this post if you hadn't posted all of them in a single topic. I'd like to reiterate that it's perfectly fine to post multiple question posts at once. Doing so would allow people to more thoroughly address each of the questions more in depth, and you may even get multiple answers to some. I was considering to close this as "too broad", but since it has an answer already, I don't feel strongly enough about it. – Murch – 2020-07-13T21:01:49.600

@Murch I considered commenting something like this too, but all the questions really seem to be around clarifying a single concept that OP has a hard time expressing. – Pieter Wuille – 2020-07-13T21:07:01.053

Yeah, but then the title of the topic being "Details of SPV clients" is already a good indicator that the topic is too broad–it's not easy to summarize it in a single phrase. It could have been split for example into "How do SPV clients verify transaction validity?", "How does an SPV client know what block confirmed a transaction?", "How do Merkle branches work?", and "What are the privacy benefits of BIP-37?". The topic is already structured that way anyway! – Murch – 2020-07-13T21:16:22.073

@Murch sorry I wanted to do just what Pieter said, it was all related to one subject. I'm trying to keep in one question as much as I can so I dont spam site with a lot of question. Plus there is a delay of 40minutes in posting the question, right? – ddavi031 – 2020-07-13T21:26:19.870

"so I dont spam site with a lot of question" ⇒ Right, what I'm trying to say is that you should rather "spam the site with multiple questions" than ask everything in one post. :) If you are currently under a delay, I'm fairly certain that such a limit will be lifted once you get a little more rep. The title of a topic is the most important element of a question post: the title and the tags serve other users to quickly assess whether a topic is interesting to them. Something as broad as "Details of SPV clients" does not narrow down the topic sufficiently to inform other users. – Murch – 2020-07-13T23:11:45.373

Ok @Murch, thank you! – ddavi031 – 2020-07-14T06:41:59.183

I cleaned up the question a bit and tried to give it a more descriptive title. Hope you find it fitting, but feel free to amend. Maybe I'm just being overly sensitive and Pieter's right, it's actually just all the facets of the SPV transaction validation flow. Anyway, please don't let my grumblings discourage you from asking more questions. :) – Murch – 2020-07-14T17:30:26.343

No problem, thank you for your help. Please don't let my mistake discourage you from keep editing my question so it fits the site and community :) – ddavi031 – 2020-07-14T18:27:00.783



  1. I found out that SPV has no mempool, but although SPV client is participating in transaction verification. So, what happens when node verifies transaction? Is SPV client checking only owner's outgoing transactions?

That depends on what you mean by "verification". SPV clients cannot and do not verify the validity of transactions themselves; they can only verify that they were included in a block, relying on the assumption that miners would not waste their energy on creating a block with invalid transactions in it.

  1. Transaction that SPV client is trying to verify has block hash as a reference where did a transaction came from? That's how SPV client knows in which block to search for target transaction when SPV asks full node for part of Markle tree. Is this correct?

Transactions do not (and cannot) contain a hash of the block they're contained it; that would be a cyclic dependency. I don't understand the rest of this question.

  1. SPV client asks full node client for hashes inside Merkle Tree, so he can reconstruct the part of the tree of his interest and that way check if transaction is really in the block that transaction is referring to.

When using BIP37, the client sends a Bloom filter of which scripts/addresses/utxos they're interested in, and then requests blocks. The server responds with filtered blocks, containing only the matching transactions, plus efficient Merkle proofs that those transactions are actually in a block with the claimed hash.

  1. If I'm on a right path, how does bloom filters help in increasing of level of privacy since SPV client still needs to ask full node client for a transaction by its hash?

BIP37 bloom filters are primarily a way to improve efficiency - it means that with little bandwidth overhead, the server knows what to not send to the client. It was intended to optionally offer some moderate level of privacy, because a client can choose to send an overly broad filter, resulting in false positives. It has since been discovered that this basically offers no privacy at all, due to correlation the server can still observe between requested things.

Pieter Wuille

Posted 2020-07-13T17:00:45.410

Reputation: 64 874

Thank you for your answer, you got me on the right path of understanding SPV now. – ddavi031 – 2020-07-14T06:32:57.173