Skip to content
merkl-darkcover
Feb 12, 2025 6:16:46 PM2 min read

What's a Merkle Tree?

The Merkl incentive platform is named that way for a reason — can you guess why?
It’s because its tech stack (the set of tools used to develop the Merkl engine) relies heavily on a data structure called "Merkle trees".

Let’s dive into what they are and how they work.

Merkl tree

 

An efficient data structure

In computer science, a tree is a data structure where each node has children — just like in a family tree.

Merkl Incentive - Binary Tree

Consider the image above:

  • The node 1 is called the root of the tree—it has no parent
  • All other nodes are connected to their parent
  • The bottom nodes (2, 5, and 11) are called leaves because they have no children

Okay, but what kind of tree are we talking about?

A tree of hashes

A Merkle tree is a tree of hashes.

A data hash is like a unique fingerprint created by applying a special math formula (called a hash function) to a piece of data. No matter the size of the input — a word, a file, or a message — the hash always produces a fixed-length string of characters.

If even a tiny change is made to the original data, the hash changes completely. This makes it easy to check if data has been altered without re-reading everything.

For example:

  • The hash of "cat" might be "a9f5b3..."
  • But if you write "Cat" with a capital letter, the hash becomes "f72c1d..." — totally different!

Hashes are widely used in cybersecurity, blockchain, and many other fields to secure and verify data integrity.

In a Merkle tree, each leaf node contains the hash of a data block, and each non-leaf node contains the hash of its child nodes.

Merkl incentive platform — data hash

Consider the example above: the leaf 'Data A' contains the data 'Bryan.' Its parent contains the hash of this data H(A) . Its grandparent H(X) contains the hash of its two children H(A) and H(B), and so on.

Want to scale your business with Merkle trees?


How to create a Merkle tree

Creating a Merkle tree requires the following steps:

  1. Data hashing – Each piece of data (e.g., a blockchain transaction) is hashed.
  2. Leaf node creation – These hashes form the leaf nodes of the tree.
  3. Parent node creation – Pairs of leaf nodes are hashed together to create parent nodes.
  4. Root hash – This process continues up the tree until only one hash remains: the Merkle root.

Screenshot 2025-02-10 at 11.12.35 PMH(C) and H(X) are needed to complete the root and verify that the D leaf is part of the Merkle tree.

Now that you get how a Merkle tree works, you’re probably wondering — what’s it for?

 

The benefits of Merkle trees

Merkle trees offer several key benefits:

  • Efficient verification – They enable quick validation of large datasets without processing all the data.
  • Data integrity – Any modification to the data changes the Merkle root, making tampering easily detectable.
  • Storage efficiency – Only the Merkle root needs to be stored, significantly reducing storage requirements.
  • Fast data comparison – Comparing Merkle roots is much quicker than comparing entire datasets.
 
In our case, a Merkle tree is used to store all the rewards streamed through the Merkl incentive platform!

(And don’t mix them up — Merkl (the incentive platform) is spelled without an "e," while a Merkle tree includes one!)

Related articles