<p>Assuming the SPV client has the block header and the transaction hash; proof for only one transaction</p>

<pre><code>ceil(log_2 (number_of_tx_in_that_block)) * 32 bytes
</code></pre>

<p>You can see the structure of the merkle tree <a href="https://github.com/bitcoin/bitcoin/blob/master/src/consensus/merkle.cpp#L20" rel="nofollow noreferrer">here</a> (the 2nd one)</p>

<p>For example, for TX 4, you need to give the hash of TX 3, hash D, hash C.</p>

CC BY-SA 4.0
2018-09-15T16:53:51.820Z
Thanks, but how to be certain the block header is not phony?  I guess can prove Merkle Root is valid with full chain of block headers, but that is still a lot of data.  Do I have to go back to genesis block?  Or, would I just need to see enough block headers chained after my block to be certain header is not fake?
user1055568
CC BY-SA 4.0
2018-09-15T16:55:49.027Z
SPV wallets *should* (must with little exceptions) store the block headers. That's what most of the SPV wallets do, and that's useful @user1055568
MCCCS
CC BY-SA 4.0
2018-09-15T17:21:40.093Z
Seems like I only need a few block header preceding the block that contains my transaction, and then 6 or so that follow.  I can make up fake Merkle root, and all the Hash that follow, but to fake a preceding header, I need to solve reverse hash, and repeatedly for each preceding header.
user1055568
CC BY-SA 4.0
2018-09-15T16:21:11.333Z
2018-09-15T16:21:11.333Z
MCCCS
<p>In theory, you would only need the data from the block of the transaction, and the ability to prove it the transaction still exists after at least 6 confirmations.</p>

<p>The more confirmations (blocks mined beyond a transaction) the lower probability it becomes possible to reverse. Generally speaking, 6 confirmations is enough to identify a transaction is irreversible.</p>

<p>Here's a quote from <a href="https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch02.asciidoc#mining-transactions-in-blocks" rel="nofollow noreferrer">Mastering Bitcoin by Andreas Antonopoulos</a>:</p>

<blockquote>
  <p>By convention, any block with more than six confirmations is considered irrevocable, because it would require an immense amount of computation to invalidate and recalculate six blocks. </p>
</blockquote>

<p>Block vary in size, but in SegWit transactions, the entire block can be a maximum  ~2 MB.</p>

<p>These days there are many online tools that can verify this without needing the entire blockchain.
The <a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)" rel="nofollow noreferrer">bitcoind JSON RPC API</a> also works fairly well in providing transaction data. (Cannot be manipulated like with an online API)</p>

CC BY-SA 4.0
2018-09-15T15:52:20.337Z
I thought I could be certain a transaction belongs to a block, just by looking at the Merkle root and Merkle path.  But, if the Merkle root is made up, then it would be easy to make up phony path.   So, must have header chain, or at least a subset of it, to know Merkle root is not made up.
user1055568
CC BY-SA 4.0
2018-09-15T05:02:20.073Z
2018-09-15T05:02:20.073Z
Mason Ticehurst
<p>As I understand the SVP protocol, a client can be reasonably certain that a transaction has been accepted on the blockchain if they know it is a member of a certain block, via the Merkle path, and a reasonable number of blocks have been mined on top of that block.</p>

<p>How much total data would that be, roughly?  I guess if you were beginning with 0 knowledge, you would need all of the block headers, beginning from the genesis block?  But once you are convinced you are looking at the head of the right chain, you could discard all of the ancient block headers, and just save a recent one as a trusted starting point to evaluate subsequent transactions?</p>

<hr>

<p>I guess the premise of my question is faulty, as a fake transaction could always be embedded in a fake chain, if enough computing resources were available.  So, there is no amount of data that insures a transaction is valid, without access to other information, e.g., what is the longest chain currently in existence.</p>

<p>A better question for my purposes would be how much would the electricity cost to create one fake block header at today's difficulty level?  Figuring that blockchain currently pays around $60K to mine one block, I would guess it must be in that order of magnitude, though smaller since we are removing the race condition.</p>

<blockchain>
How much data does it take to prove a given transaction exists on the blockchain?
user1055568
# How much data does it take to prove a given transaction exists on the blockchain?

(Asked by: username_0 on 2018-09-15)

As I understand the SVP protocol, a client can be reasonably certain that a transaction has been accepted on the blockchain if they know it is a member of a certain block, via the Merkle path, and a reasonable number of blocks have been mined on top of that block.

How much total data would that be, roughly? I guess if you were beginning with 0 knowledge, you would need all of the block headers, beginning from the genesis block? But once you are convinced you are looking at the head of the right chain, you could discard all of the ancient block headers, and just save a recent one as a trusted starting point to evaluate subsequent transactions?

---

I guess the premise of my question is faulty, as a fake transaction could always be embedded in a fake chain, if enough computing resources were available. So, there is no amount of data that insures a transaction is valid, without access to other information, e.g., what is the longest chain currently in existence.

A better question for my purposes would be how much would the electricity cost to create one fake block header at today's difficulty level? Figuring that blockchain currently pays around $60K to mine one block, I would guess it must be in that order of magnitude, though smaller since we are removing the race condition.

**Tags:** blockchain


---

## 2 answers

### Answer by username_1 on 2018-09-15. Score: 0

Assuming the SPV client has the block header and the transaction hash; proof for only one transaction
ceil(log_2 (number_of_tx_in_that_block)) * 32 bytes

You can see the structure of the merkle tree here (the 2nd one)
For example, for TX 4, you need to give the hash of TX 3, hash D, hash C.

> **Comments:**
> **username_0**: Thanks, but how to be certain the block header is not phony?  I guess can prove Merkle Root is valid with full chain of block headers, but that is still a lot of data.  Do I have to go back to genesis block?  Or, would I just need to see enough block headers chained after my block to be certain header is not fake?  
> **username_1**: SPV wallets *should* (must with little exceptions) store the block headers. That's what most of the SPV wallets do, and that's useful @username_0  
> **username_0**: Seems like I only need a few block header preceding the block that contains my transaction, and then 6 or so that follow.  I can make up fake Merkle root, and all the Hash that follow, but to fake a preceding header, I need to solve reverse hash, and repeatedly for each preceding header.  

---

### Answer by username_2 on 2018-09-15. Score: 0

In theory, you would only need the data from the block of the transaction, and the ability to prove it the transaction still exists after at least 6 confirmations.

The more confirmations (blocks mined beyond a transaction) the lower probability it becomes possible to reverse. Generally speaking, 6 confirmations is enough to identify a transaction is irreversible.

Here's a quote from [Mastering Bitcoin by Andreas Antonopoulos](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch02.asciidoc#mining-transactions-in-blocks):

> By convention, any block with more than six confirmations is considered irrevocable, because it would require an immense amount of computation to invalidate and recalculate six blocks.

Block vary in size, but in SegWit transactions, the entire block can be a maximum ~2 MB.

These days there are many online tools that can verify this without needing the entire blockchain.
The [bitcoind JSON RPC API](https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)) also works fairly well in providing transaction data. (Cannot be manipulated like with an online API)

> **Comments:**
> **username_0**: I thought I could be certain a transaction belongs to a block, just by looking at the Merkle root and Merkle path.  But, if the Merkle root is made up, then it would be easy to make up phony path.   So, must have header chain, or at least a subset of it, to know Merkle root is not made up.  

---

