# Definition

Simply put, a Merkle Tree is a method in cryptography and computer science to store and represent data in a concise and secretive (encoded) form. This means a large amount of data can be represented in a concise and encoded (Hash) manner.

In order to dig deep the Merkle Trees, we need to understand the “Hash Function”.

## Hash Function

A Hash is a function in cryptography, which when applied to data of any length or form (text, audio, picture, etc.) produces a unique output called ” Digest” of a specific length. The Hash function has the below given characteristics.

• Hash of any two data values x and y cannot be the same. That is for any two data values x and y we can not find Hash(x) and Hash(y), such that Hash(x)=Hash(y). Hence any data has a unique Hash Value which can be treated as its fingerprint.
• Hash of any data of any length and form is of the same length. The figure below depicts SHA 256 (A Hash function) applied to different data values.

# Merkle Trees in Blockchain

Data in the Blocks in most Blockchains are stored in the form of Merkle Trees. As per Wikipedia the definition of Merkle Trees is as follows:

In cryptography and computer science, a hash tree or Merkle tree is a tree in which every leaf node is labelled with the cryptographic hash of a data block, and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes.

Let us take the example of a Blockchain with three blocks, namely A, B and C. See the figure below. The Block B which is being discussed here has (suppose) transactions A to F, namely T(A), T(B), T(C), T(D),……….., T(F).