May any one give example how merkle tree is used in blockchain to verify the transaction? I confused because validation of data in ethereum is done through the proof of work where you find the nonce(hash of block + nonce) value that will less than and equal to target hash value. If I am wrong than please correct me as I am new to blockchain technology.
There is some misunderstanding. Proof of work is the mechanism of consensus. This defines the rules for mining. The Merkle tree is an architecture type of distributed database (blockchain). This defines the rules of storing data. These are two different elements of the blockchain.
Actually there is no transaction verification, you can send any transaction you want.
Common transaction lifecycle
- Mining / execution / confirmation / including in block
But after execution depends on the data and parameters, the transaction may fail or succes. Fail means that the instructions inside the transaction trows an error due to a conflict in the Merkle tree, so the data has not changed.
Merkle Tree is a tree which uses Hash pointers.
In Bitcoin's blockchain,
Every new block contains a section where it stores the a Hash Pointer which is related to the previous block
The Hash pointer has two things encapsulated in it
The location of the previous block
The Hash of the data in the previous block
If someone tries to change the data in the previous block then its hash changes and as the hash stored in next block still points to old original block, The integrity of the database is maintained.
So to verify a transaction, What you do is, You go on checking the hashes in reverse order following the hash pointers to the very origin of where the mining reward was generated.