SPV clients querying the full node 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?
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.