Difference between revisions of "Simplified Payment Verification"

Line 5: Line 5:
 
To validate a such proof, a user only needs to download the block headers. By computing the hash of the transaction and the Merkle root, the user can compare it with the Merkle root in the block header. If it matches, then the validation is successful.  
 
To validate a such proof, a user only needs to download the block headers. By computing the hash of the transaction and the Merkle root, the user can compare it with the Merkle root in the block header. If it matches, then the validation is successful.  
  
As block headers are of constant size of 80 bytes, the size of the data grows linearly, and is independent of the size of the blocks. The size of a Merkle path is of maximum <math>32 * 2 * log_{2}{n}</math> bytes, where <math>n</math> is the total number of transaction in one block.  
+
As block headers are of constant size of 80 bytes, the size of the data grows linearly, and is independent of the size of the blocks. The size of a Merkle path is of maximum <math>64log_{2}{n}</math> bytes, where <math>n</math> is the total number of transaction in one block.  
  
 
[[File:Longest_proof_of_work_chain.png|frame|centre|alt=Longest proof of work chain]]
 
[[File:Longest_proof_of_work_chain.png|frame|centre|alt=Longest proof of work chain]]

Revision as of 14:55, 20 January 2020

Simplified Payment Verification (SPV) is described in section 8 of the Bitcoin whitepaper. It allows a user to prove or verify that a transaction is in the chain without downloading the full chain.

To provide a proof, a user simply download the block headers and the Merkle paths of interested transactions. By showing the Merkle path of a transaction, and its corresponding Merkle root in the block header, it confirms that the transaction is in the chain at that block height.

To validate a such proof, a user only needs to download the block headers. By computing the hash of the transaction and the Merkle root, the user can compare it with the Merkle root in the block header. If it matches, then the validation is successful.

As block headers are of constant size of 80 bytes, the size of the data grows linearly, and is independent of the size of the blocks. The size of a Merkle path is of maximum bytes, where is the total number of transaction in one block.

Longest proof of work chain

SPV Wallet

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:

  1. - the transaction that contains the UTXO as an output,
  2. The Merkle path of
  3. The block header that contains the Merkle root derived from the Merkle path (or its identifier, e.g., block height)
  4. - the transaction that spends the UTXO

To validate the information, a user computes the Merkle root from the Merkle path of . The user then compares it with the Merkle root specified in the block header. If they are the same, the user accepts that is in the chain.

Offline Payment

Note that by storing locally, a user will be able to sign offline, as any signature on requires the scriptPubKey (locking script) part from .