|

Merkle Mountain Range (MMR)

|
Visualizer

MMR Size vs Leaf Count

You probably noticed when using Herodotus services that our MMR size is almost 40 mln. You might ask how it is possible when the number of blocks is around 19 mln. That discrepancy is caused by the difference between MMR size and leaf count in an MMR.

MMR is a collection of balanced binary trees. All appended values are stored in leaves (nodes that have no children). Then those leaves are connected in pairs, and their values are hashed together and stored in a parent node.

7loading
3loading
10xcc6988...
20x679795...
6loading
40x1a1e68...
50x458b30...
10loading
80xe4c2e8...
90x87e8a5...

Therefore, when a new block is appended, it creates exactly one new leaf, but it also may create a new parent node for that leaf, then join that parent with its sibling, and so on. That means that the number of leaves is always equal to the number of blocks (plus one, because of the genesis block), but the number of nodes in an MMR (or "MMR size") may be greater. (It is usually around twice as big, but more on that later.)

Conversion

In most cases, you will only need to convert between MMR size and leaf count. To do that, please use the converter below.

mmr size to leaf count

leaf count to mmr size

If you are wondering how the conversion is done, check out Leaf Count to MMR Size or MMR Size to Leaf Count algorithms.

© 2024 Herodotus Dev Ltd. All rights reserved.
Powered by