I'd like to better understand how a light client works. As far as I know, a light client stores locally only the block headers (80 bytes each) and it receives a new block header on average each 10 minutes.

I've essentially two questions:

1) How can a light client retrieve a transaction given its hash? I'd like to get back the complete transaction so to read out the data after the OP_RETURN code.

2) How can the light client be sure that the retrieved transaction is really the one in the longest blockchain? Does it simply check if there are 5 blocks already confirmed after the transaction's block?

Thank you very much

1 Answer 1


1) The easiest way within the protocol is probably to add that transaction hash to a bloom filter, send the bloom filter to a remote node with filterload, and request each filtered block. This will send you only the transaction you're interested in. (It will also send some extra transactions that match the bloom filter because they're false positives.) See BIP37 for more details about how this feature works. This is how BitcoinJ based light clients find transactions relevant to them.

Knowing the block height that this is included at would simplify this enormously, as you will only need to look at one block, instead of the entire chain.

2) No. They get the block headers for the entire best chain. This goes from the genesis block to the current tip. (This is currently 450000*80=36MB) They then check that the relevant block is somewhere in that chain.

  • thank you for the explanation! Can I also ask you what are the minimum requirements for a thin client in term of RAM and CPU ?
    – gatb27
    Jan 30, 2017 at 19:58
  • Pretty much nothing. Strictly speaking, you don't even need to keep all of the block headers once you've checked that they connect to the genesis block. You could keep only the chain tip, and the ones you're interested in. The primary issue with thin clients is not the resources they use, but their inability to check whether a blockchain is valid.
    – Nick ODell
    Jan 30, 2017 at 20:43
  • Ok, now I've got it. To be sure the blockchain is a valid one, we need the complete blocks with all the transaction, so a full node right?
    – gatb27
    Jan 30, 2017 at 21:15
  • Right. You need all of the blocks to enforce rules like not letting the same output be spent twice.
    – Nick ODell
    Jan 30, 2017 at 21:25
  • Hi @nick , if I am a thin client (bitcoinj) and I know both the tx_hash and the block_number, what kind of message do I need to send to my peers to get back the complete transaction?
    – gatb27
    Feb 1, 2017 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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