Merkle Mountain Range (MMR)


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.


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.)


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