4

The leaves of the Merkle Tree has the hash of the transactions. How are transactions stored in the block? What is the purpose of Merkle Tree.

1 Answer 1

1

Btc wiki: Merkle Trees

A Merkle tree is a hash function value which can be used to validate that every piece of information in a block can be authenticated, in this case, it validates that for each Tx and its hash value, it has not been tampered with in any way, shape or form.

Let's use an analogy: assume we have a file cabinet of files, each file in numerical order. Now, assume each file is sealed with a wax stamp, and each wax stamp has the date spelt in words. If we changed the date at all, the words make it so there's no longer a match (1==>7 is easily done, but not one==>seven!). So we're sure each file (Tx) is legit. Now assume the filing cabinet has the sum of the number of letters used in those words on the Txs' stamps. Any change that was made, say one==>seven has changed the sum of the letter, since seven is two letters longer than one. This is a simplistic analogy of how hashes can easily authenticate a piece of data.

Furthering the analogy, each block (filing cabinet) has a combination lock which references the block (filing cabinet )before that. So minor changes in even one single letter of a single Tx in a single filing cabinet (block) will invalidate whole system.

I recommend looking into the Wikipedia cryptographic hash entry to get a deeper understanding, or books like Mastering Bitcoin

4
  • But the transaction is verified before mining the block (ownership, non-repudiation, authenticity) using public key and digital signature of the sender. The transaction record has its own hash. Why is hash stored in the merkel tree. If a block is mined successfully, is it possible in future to tamper with the block?
    – Curious
    Feb 13, 2015 at 7:23
  • You just answered your own question; the whole idea of the Merkel tree value is to validate an untampered block. The block could just as easily list every Tx hash, but taking a hash of the tree saves a lot of space. Digital signatures and scripting are for spending, a totally different area than miners validating blocks. Yes, miners validate that the script is correct, but remember, a Tx is never validated per se until it's in a block that's been accepted, so it's more accurate to say a Tx is verified while they're mining the block. Feb 13, 2015 at 7:31
  • After a transaction is received, it should be verified for ownership, authenticity, integrity etc. Then transaction is added to the block. Later, the block is mined, right? So you are saying The block does not store the transaction, but just hash of the transaction in the Merkle tree? Where are transactions stored then?
    – Curious
    Feb 13, 2015 at 7:36
  • @Curious There is no difference between those two things. It's just a question of semantics whether you consider the transactions part of the block or not. Mar 15, 2015 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.