Merkle Sum Tree

Published by Mario Oettler on

A Merkle Sum Tree (MST) is a variant of a Merkle tree which not only combines the pairwise hashes of its leaves and nodes but also the sum of an additional amount field in its leaves and nodes. Both, hashes and sums of the child nodes/leaves are used as input for the hashing function to create the parent node.

Merkle Sum Tree (MST).

This data structure is helpful to commit to the value or amount of a piece of data. In Taproot Assets, a Merkle sum tree is used to prevent inflation of assets. That means, they hinder malicious actors to arbitrarily create more assets than planned, as the total amount of assets is stored in the root.

With this tool, you can figure out how a Merkle sum tree works.

Merkle Sum Tree Tool

This tool allows you to create a Merkle Sum Tree. Nodes are double hashed and prefixed with the number of child nodes. You can add new nodes (hashes and leaves) to the Merkle Sum Tree and delete them from the Merkle Sum Tree by hovering over a node and selecting the preferred option. Note that deleting a parent node will also delete all of its child nodes. The input accepts hexadecimal values (with or without a 0x prefix). The output is an array of data.

Below, you can create a Merkle Sum Tree from a given Array by inserting the Array into the input and clicking the button. The Array should contain the elements in the order in which they should be hashed, and should have the format of {"output": "Value", "value": 0}.


MAST Treearray:
Categories: