> For the complete documentation index, see [llms.txt](https://hub.bsvblockchain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hub.bsvblockchain.org/wiki/economics-and-payments/payments-in-bitcoin/simplified-payment-verification.md).

# Simplified Payment Verification

Simplified Payment Verification (SPV) is described in section 8 of the Bitcoin whitepaper. It allows a transaction recipient to prove that the sender has control of the source funds of the payment they are offering without downloading the full Blockchain, by utilising the properties of Merkle proofs. This does not guarantee that the funds have not been previously spent, this assurance is received by submitting the transaction to the Bitcoin miners. However, in such a case the SPV proof acts as strong evidence of fraud backed by legally recognised digital signature technology. SPV allows users to securely transact with each other, peer-to-peer, while nodes act to form the settlement layer.

1. Advantages The advantages of using SPV are clear in terms of the volume of data required:

* a wallet can store **all necessary block headers in around 50MB - this covers the entire block chain** (as of January 2020, with 80 bytes per block and around 620,000 blocks in the chain). The total **grows linearly** at around 4MB per year (i.e. it increases by 80 bytes with each block mined, regardless of the size of that block).
* contrast this with the **hundreds of gigabytes** which would be required to store the entire chain, if SPV were not being used.
* The size of the data required for the **merkle paths** is of maximum 64log\_{2}{n} bytes, where n is the total number of transaction in one block. As explained in Section 8 of the Bitcoin whitepaper: And in Section 7:

1. Approach There have been a lot of previous misunderstandings around SPV and peer-to-peer transacting. Previously, the custom had been for the sender of the payment to just broadcast the payment to the Bitcoin network nodes. The receiver of the payment would then need to somehow filter through all of the transactions coming onto the network for specific transactions relating to them (an extremely difficult task in of itself). Even if the sender sent the transaction to the receiver as well as the network nodes, the custom had been for the receiver to always wait for the transaction to be confirmed at least 6 times whatever the transaction type, amount or situation. The better approach is that transactions between SPV clients are negotiated peer-to-peer and settled on the ledger through the network nodes. An analogy for this is a transaction done using cheque at a much faster speed. The customer hands the the signed cheque (transaction) to the merchant, who then banks or cashes the cheque (settles the transaction on chain). When/if the merchant is satisfied according to the situational risk of the transaction, then they can hand over the goods or services. There is no such thing as absolute security, there is always a risk against the cost of being defrauded (which decreases exponentially as time goes by). If the transaction is only for a cup of coffee, then the merchant will be exposed to less risk than if the transaction is to buy a car for example, and they would behave differently. If selling a cup of coffee, they can satisfy themselves that the transaction they have received appears to be valid using the SPV process detailed above, and submit the transaction themselves to the network (or even to a trusted miner if using a Merchant API). Given that they will likely receive notification and proof of a fraud attempt within seconds, they will not want to maintain a copy of the entire ledger or even the UTXO set to check against, because the risk they face does not justify the cost. SPV is adequate just as an instant contactless payment without a pin number although arguably the security of SPV is far superior given that discovery of fraud attempts is rapid. Likewise, they will not want to detain their customer while they wait for 6 confirmations - it simply is not necessary - they have received a transaction which appears to be valid, and it has been accepted by the network without a double spend alert. This will probably be enough for them to risk the cost of the coffee.
2. Merkle Trees, Merkle Roots, Merkle Paths and Merkle Proofs A **Merkle Tree** is a structure used in computer science to validate data - see [wikipedia definition](https://en.wikipedia.org/wiki/Merkle_tree) for more information. The **Merkle Root** in a Bitcoin block is the hash contained in the block header, which is derived from the hashes of all transactions in the block. A **Merkle Path** in SPV represents the information which the user needs to calculate the expected value for the Merkle root for a block, from their own transaction hash contained in that block. The Merkle path is used as part of of the Merkle Proof. A **Merkle Proof** in SPV proves the existence of a specific transaction in a specific block (without the user needing to examine all the transactions in the Block). It includes the Merkle Root and the Merkle Path.

* To **create** a Merkle proof, a user (or their wallet) simply needs the Merkle path of the transaction as well as the block header for a given block (80 bytes).
* To **validate** a proof, a user (or their wallet) only needs the chain of block headers (as opposed to the whole blocks themselves). I.e. they need their own copy of the block header of each block, that they know to be accurate. Using their own block header chain, together with the transaction (or its hash/id) they want to verify, as well as its Merkle proof (also sometimes referred to as an inclusion proof), a user can verify the transaction was time stamped in a specific block, without examining every transaction in that block. The following diagram shows how transaction hashes can be related to the Merkle root in a block header:

![Three transactions and the Merkle paths which can be used to relate them to blocks](/files/S58ufF0QIlB6RFcCqZrS)

1. SPV Wallet An SPV wallet is a lightweight wallet that uses the mechanism of SPV to construct Bitcoin transactions and payments. To spend a UTXO, a user of a SPV wallet will pass on the following information to the receiver:
2. Transaction\_0 - the transaction that contains the UTXO as an output,
3. The Merkle path of Transaction\_0
4. The block header that contains the Merkle root derived from the Merkle path (or its identifier, e.g., block height)
5. Transaction\_1 - the transaction that spends the UTXO To validate the information, a user computes the Merkle root from the Merkle path of Transaction\_0. The user then compares it with the Merkle root specified in the block header. If they are the same, the user accepts that Transaction\_0 is in the chain.
6. Offline Payment Note that by storing Transaction\_0 locally, a user will be able to sign Transaction\_1 offline, as any signature on Transaction\_1 requires the scriptPubKey (locking script) part from Transaction\_0.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hub.bsvblockchain.org/wiki/economics-and-payments/payments-in-bitcoin/simplified-payment-verification.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
