0

Is there a way currently where an SPV client can send a TxID to a full node which is present in the UTXO set of the full node and have the full node not scan its entire blockchain to fetch the transaction data? Or under all the circumstances, the full node would always scan the entire blockchain to fetch the data?

Also, do the full nodes along with the transaction data also return the merkle proof to prove the validity of the data returned? I mean, how can an SPV node be convinced that the correct data has been returned?

1 Answer 1

1

Is there a way currently where an SPV client can send a TxID to a full node which is present in the UTXO set of the full node and have the full node not scan its entire blockchain to fetch the transaction data? Or under all the circumstances, the full node would always scan the entire blockchain to fetch the data?

A full node never scans the entire blockchain for a particular transaction to send to a SPV client. No client (SPV or not) can just request transactions that are in the blockchain; a node will not respond to such a request because it is computationally expensive (requires scanning the blockchain).

A SPV client can set a bloom filter which will filter for specific outputs and txids, and then request blocks from a full node. The node will send a filtered block to the SPV client then.

So no, a SPV client can't send a txid to a full node and get the transaction if it is already confirmed.

For SPV clients that use a client server model like electrum, the server is a full node which has indexed every single transaction in the blockchain (it maintains a database which maps txids to locations on disk). Those servers will respond to requests for specific txids, but they are not your typical full node and speak a different protocol.

Also, do the full nodes along with the transaction data also return the merkle proof to prove the validity of the data returned? I mean, how can an SPV node be convinced that the correct data has been returned?

Merkle proofs are provided by the nodes to prove that the transaction is in the block.

2
  • But don't the full nodes (as mentioned in link post) with -txindex flag set also maintain an index that maps TxID to some information that lets them retrieve transaction data efficiently. Wouldn't the full nodes, in this case, retrieve transaction data for SPV client queries on TxID?
    – archita
    Nov 19, 2018 at 18:49
  • 2
    No. While -txindex allows nodes to maintain a transaction index, this data is only exposed locally to the RPC interface. It is not used for node operations. Nodes with txindex are functionally the same as those without and are not distinguishable from those without txindex without access to the RPC interface.
    – Andrew Chow
    Nov 19, 2018 at 21:01

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.