BLOCKCHAIN & WEB3 FUNDAMENTALS - Chapter 3, Exercise 3 Solution ========================================================== Why SPV Wallets Can Trust a Merkle Proof Alone PROBLEM ------- Explain, in your own words, why a lightweight wallet using Simplified Payment Verification (SPV) can trust that its own transaction is really in a block without downloading and checking every other transaction in that block. SOLUTION -------- An SPV wallet trusts a Merkle proof because of the same two properties this course established back in Chapter 2: a cryptographic hash function is collision resistant (nobody can practically find two different sets of data that produce the same hash) and exhibits the avalanche effect (any change to the underlying data produces a completely different hash). Because of this, the small set of sibling hashes in a Merkle proof - just log2(n) of them, per Exercise 1 - is enough to recompute the exact same Merkle root that's already stored in the block header, but only if the transaction being proven is genuinely, unaltered, part of that block's real transaction set. If the transaction had been tampered with, or wasn't really included, recomputing up the tree using the given sibling hashes would produce a different root that wouldn't match the one already recorded in the block header. The wallet doesn't need to independently re-derive or double-check every other transaction in the block, because it isn't trusting the other transactions themselves - it's trusting the mathematics of the hash function to make it computationally infeasible for anyone to have constructed a fake proof that both includes an altered or fabricated transaction AND still reproduces the correct, already-published Merkle root. The wallet does still need to trust that the block header itself (including that stored Merkle root) is part of the real, longest proof-of-work chain - which is a separate question SPV wallets answer by checking block headers, not something this Merkle-proof mechanism alone guarantees. ANSWER: An SPV wallet can trust a Merkle proof because forging one - producing a fake proof for a transaction that isn't really in the block - would require finding a hash collision, which the chapter establishes is computationally infeasible for a real cryptographic hash function; it doesn't need to see every other transaction because it's relying on the hash function's own mathematical guarantees rather than on independently checking the rest of the block's contents. ---- WHY THIS WORKS AS AN ANSWER This ties SPV's own trust model directly back to the hash-function properties (collision resistance, avalanche effect) established in Chapter 2 and reused throughout Chapter 3, rather than treating SPV as a separate, unexplained convenience feature.