I am new to Bitcoins. I have read about how double spending is prevented in Bitcoins.
Suppose A, a peer, receives 'B' BTCs from various transactions: B1,B2,B3, etc. Also, A had spent 'S' BTCs in various transactions S1,S2,S3, etc. Now, whenever a new transaction is initiated from A to B (eg: A wants to transfer X bitcoins to B), the transaction has to be verified as follows.
Fullnodes have the Unspent Transactions Output (UTXO) database. A's address is scanned in this database and checked if A has any unspent bitcoins. If there are at least X unspent bitcoins against A's address, then the transaction is legitimate.
Q 1) Where does SPV and Merkel trees come into picture during the above-mentioned verification process? I have read elsewhere on the internet that SPV nodes will query for the previous transactions B1,B2,B3, .. and S1,S2,S3 & check if whether A's claim is valid or not.
Q 2) How many previous transactions do usually SPVs look into? My understanding is that SPVs have to look at all the transactions associated with A's address. What if A does not input all its previous transactions? (Eg: A hides its some of its spending transactions, say, S1)