When an SPV client starts up with no state, connects to a full node and sets a bloom filter what messages will it receive?

Will it only get new transactions that match its filter or is there some way to also get the full node to supply all previous blocks that match the filter?


2 Answers 2


This question has the answer.

For the first question when an SPV client starts up and sets a bloom filter it will not receive any special messages from connected bitcoin nodes. The bloom filter will result in transaction broadcasts to the SPV being filtered.

In answer to the second question an SPV client must still request ALL block headers and send a getdata request for every block in order to determine whether it contains any relevant transactions. The purpose of the bloom filter is to restrict the number of transactions returned by the merkleblock response to the getdata request.

An SPV client that's relying on bitcoin peer nodes for transaction information will have a slow initial start up as it needs to request all the block headers.

  • Does getdata work for old blocks? from wiki: "This message cannot be used to request arbitrary data, such as historic transactions no longer in the memory pool or relay set."
    – Fraggle
    Feb 9, 2019 at 16:44


Upon receiving a filterload command, the remote peer will immediately restrict the broadcast transactions it announces (in inv packets) to transactions matching the filter, where the matching algorithm is specified below. The flags control the update behaviour of the matching algorithm.

The filter applies as soon as you set the filter using filterload. You can set fRelay false in the version command, to indicate that you want to disable broadcasting transactions until a filter is added.

SPV clients that wish to use Bloom filtering would normally set fRelay to false in the version message, then set a filter based on their wallet (or a subset of it, if they are overlapping different peers). Being able to opt-out of inv messages until the filter is set prevents a client being flooded with traffic in the brief window of time between finishing version handshaking and setting the filter.

  • yes I read that reference documentation as well but it doesn't say anything about an SPV client doing its initial block header load. How does an SPV client start from a clean slate and locate all the transactions relevant to its addresses?
    – sipsorcery
    Aug 9, 2017 at 22:20
  • 1
    SPV client sets the filter and then enables fRelay so it can receive filtered blocks along with block headers.
    – tuxcanfly
    Aug 10, 2017 at 3:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.