How do SPV get their transactions after being offline?



SPV nodes rely on their peers to send them transaction data that is relevant to them. When an SPV node sets up a bloom filter with one of their full node peers, doesn't that only tell the full node which transactions to send the SPV node from now on?

How do SPV nodes catch up after being offline? Which p2p calls can they use to get their transaction info from their peers?


Posted 2015-04-07T18:38:31.713

Reputation: 13 123



Block fetching requests are also filtered, so the client requests every single block they missed out on seeing since the last time they were last online, sequentially. The client downloads all block headers from genesis up to the current head using getheaders, sets a filter on their peer with filterload, and then downloads filtered blocks with getdata until they are in sync with the network. filteradd may be used in deterministic wallets to extend the filter to include more keys as used ones are discovered in their scan. When they are in sync, they will only receive new inventory that matches the filter.


Posted 2015-04-07T18:38:31.713

Reputation: 12 846

So if a filter is set, then getdata will return partially filled blocks, with only transactions satisfying the filter inside them? – morsecoder – 2015-04-07T20:36:13.703

Yes. BIP37 is a good place to start.

– Anonymous – 2015-04-07T21:11:56.027