Difference between revisions of "Simplified Payment Verification"

Line 6: Line 6:
  
 
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>32 * 2 * log_{2}{n}</math> bytes, where <math>n</math> is the total number of transaction in one block.  
 
and describes a means by which a user can receive a proof of confirmation for any [[UTXO]] on the network. This proof consists of a Merkle path that links the transaction to the Merkle root of a block in the longest proof of work chain. By linking the transaction to a place in the chain, it can be confirmed as a valid Bitcoin transaction that the network has built upon.
 
  
 
[[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]]
  
Using this technique, it becomes possible to build a Bitcoin wallet or utility that does not need to witness or verify everything taking place on the network, but which can instead receive block headers from the network and validate the Merkle branch of any coin being received against the block's proof of work.
+
== SPV Wallet ==
 
+
SPV wallet is a lightweight wallet that uses the mechanism of SPV to construct bitcoin transactions and payments.  
In Simplified Payment Verification, clients connect to Bitcoin nodes and download only the block headers in the longest proof of work chain. This data grows linearly over time at a rate of around 4.2MB per year. From this data, they can easily and quickly verify the chain headers connect together correctly and that the difficulty is correct. Using typical connection methods, clients then request transactions matching particular patterns from the network (ie, payments with known addresses in their redeem scripts), and receive copies of those transactions along with a Merkle branch linking them to the block in which they were mined. This exploits the Merkle tree structure to allow proof of inclusion without needing the full contents of the block.
 
  
Programs implementing this approach can have fixed storage/network overhead in the null case of no usage, and resource usage proportional to received/sent transactions.
+
To spend a UTXO, a user of a SPV wallet will pass on the following information to the receiver:
 +
# <math>Transaction_0</math> - the transaction that contains the UTXO as an output,
 +
# The Merkle path of <math>Transaction_0</math>
 +
# The block header that contains the Merkle root derived from the Merkle path (or its identifier, e.g., block height)
 +
# <math>Transaction_1</math> - the transaction that spends the UTXO

Revision as of 14:46, 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