<p><a href="https://en.bitcoin.it/wiki/Protocol_documentation%23Merkle_Trees" rel="nofollow">Btc wiki: Merkle Trees</a></p>

<p>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.</p>

<p>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 <em>one</em>==><em>seven</em>!). 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.</p>

<p>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. </p>

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

CC BY-SA 3.0
2015-02-13T07:23:45.327Z
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
CC BY-SA 3.0
2015-02-13T07:31:49.303Z
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.
Wizard Of Ozzie
CC BY-SA 3.0
2015-02-13T07:36:37.200Z
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
CC BY-SA 3.0
2015-03-15T10:21:14.957Z
@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.
David Schwartz
CC BY-SA 3.0
2015-02-13T07:18:41.000Z
2015-02-13T07:18:41.000Z
Wizard Of Ozzie
<p>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.</p>

<block><merkle-tree>
What is the purpose of Merkle Tree in blocks?
Curious
# What is the purpose of Merkle Tree in blocks?

(Asked by: username_0 on 2015-02-13)

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.

**Tags:** block, merkle-tree


---

## 1 answers

### Answer by username_1 on 2015-02-13. Score: 1

[Btc wiki: Merkle Trees](https://en.bitcoin.it/wiki/Protocol_documentation%23Merkle_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*

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  
> **username_0**: 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?  
> **username_2**: @username_0 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.  

---

