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.
An efficient data structure
In computer science, a tree is a data structure where each node has children — just like in a family 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.
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:
- Data hashing – Each piece of data (e.g., a blockchain transaction) is hashed.
- Leaf node creation – These hashes form the leaf nodes of the tree.
- Parent node creation – Pairs of leaf nodes are hashed together to create parent nodes.
- Root hash – This process continues up the tree until only one hash remains: the Merkle root.
H(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!)