Quantcast
Channel: What is the Merkle root? - Bitcoin Stack Exchange
Viewing all articles
Browse latest Browse all 7

Answer by Geremia for What is the Merkle root?

$
0
0

"Figure 7-2. Calculating the nodes in a merkle tree" from Mastering Bitcoin shows the Merkle Root (HABCD) of a list of four transactions: Tx A, Tx B, Tx C, and Tx D: Figure 7-2. Calculating the nodes in a merkle tree


To verify that a transaction—for example, that with hash HK—is a valid transaction (i.e., part of a list of, in this example, 16 transactions with hashes HA, HB, … HP), one need only perform at most 2*log2(N) < N hashes, shown in the Merkle path here:

Figure 7-5. A Merkle path used to prove inclusion of a data element

If HK leads to the correct Merkle root, then TK was in the transaction list.

And the Merkle path, needed to verify Hk corresponds with the Merkle root, only contains 4 hashes in the above example. The Merkle path takes up much less space than storing all the transactions in a block. (In the example above: 4 hashes takes much less space than 16.) This is why SPV is lighter-weight.

In this case N = 16, and 2*log2(16) = 5.55… is indeed less than 16.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>