Constructor
Get tree root
Insert new element into the tree
Element to insert
Insert multiple elements into the tree. Tree will be fully rebuilt during this operation.
Elements to insert
Change an element in the tree
Index of element to change
Updated element value
Get merkle path to a leaf
Leaf index to generate path for
An object containing adjacent elements and left-right index
Find an element in the tree
An element to find
A function that checks leaf value equality
Index if element is found, otherwise -1
Returns a copy of non-zero tree elements
Serialize entire tree state including intermediate layers into a plain object Deserializing it back will not require to recompute any hashes Elements are not converted to a plain type, this is responsibility of the caller
StaticdeserializeDeserialize data into a MerkleTree instance Make sure to provide the same hashFunction as was used in the source tree, otherwise the tree state will be invalid
Merkle tree