The growth of blockchain technology has led to an increasing demand for lightweight clients that can efficiently handle transactions without the need to store the entire blockchain, which can be over 300 gigabytes in size. Mainstream users are unlikely to have the resources to maintain and validate such a massive amount of data on their devices, especially on mobile devices with limited storage, CPU, and network capabilities.
To address this challenge, Satoshi Nakamoto, the creator of Bitcoin, proposed an ingenious solution called the Simplified Payment Verification (SPV) scheme in the original Bitcoin whitepaper. The core idea behind SPV is to enable lightweight clients to verify the inclusion of their transactions in the blockchain without having to store the entire blockchain data.
The SPV scheme relies on the concept of block headers, which are compact representations of each block in the blockchain, containing only the proof-of-work and the Merkle root hash. Lightweight clients can store these block headers, which are only 80 bytes in size, instead of the entire blocks, which can be several megabytes each. By storing the block headers, lightweight clients can verify the longest valid chain and the proof-of-work without needing to store or validate every single transaction.
To verify the inclusion of a specific transaction, the lightweight client uses the Merkle tree structure. The client requests the relevant transaction data and a partial Merkle tree from full nodes on the network. By computing the Merkle root hash from the transaction data and the partial Merkle tree, the client can compare it to the Merkle root hash stored in the block header. If the computed Merkle root hash matches the one in the header, the client can confirm that the transaction is indeed included in that block and the blockchain.
This SPV scheme elegantly solves the scaling problem for lightweight clients, allowing them to securely verify their transactions without the need to store and process the entire blockchain. It strikes a balance between security and convenience, enabling mainstream adoption of blockchain technology by making it accessible to users with limited computational resources.