For each of the UTXO being spent, follow the steps below:
a. Get the Prev Tx Id and its block hash
b. Query block hash and get the block header
c. Extract the Block’s Merkle root from the Block header
d. Follow the process for constructing Merkle root from the Prev Tx ID of the said UTXO
e. Validate the constructed Merkle root value to be same as the Merkle root obtained from the Block header.
f. If both values match, the UTXO is valid and can be spent.
g. Return Valid SPV check result
h. Go to the next UTXO in Tx and start from step a.