main page

Merkle Tree
As explained here, hash functions are used for integrity verification.
In a trusted system like the Bitcoin network we have to make sure that the transactions of each block are all valid.
The solution consists of a unique and final hash of all the block transactions.
The idea is simple: hash all the transactions. Then hash them 2 by 2 till you get a single and final hash.
			
Example
A block B has 8 transactions: tx1, tx2, tx3, tx4, tx5, tx6, tx7 and tx8. We hash each transaction:
h(tx1) = d1, h(tx2) = d2, h(tx3) = d3, h(tx4) = d4, h(tx5) = d5, h(tx6) = d6, h(tx7) = d7, h(tx8) = d8.
Now we start hashing them 2 by 2:
h(d1, d2) = d12
h(d3, d4) = d34
h(d5, d6) = d56
h(d7, d8) = d78
We continue hashing them:
h(d12, d34) = d1234
h(d56, d78) = d5678
Finally we hash the two last hashes:
h(d1234, d5678) = D
We call this final hash the Merkle Root. This final hash is what protects the integrity of the transactions.
Its purpose is to sign all the block transactions. Any change in any transaction will result in a completely different final hash.
			
Visual example
			
Merkle Tree (Bitcoinwiki): here