Constructor
Number of levels in the tree
Insert multiple elements into the tree.
Elements to insert
Returns a copy of non-zero tree elements
Find an element in the tree
An element to find
A function that checks leaf value equality
Index if element is found, otherwise -1
Insert new element into the tree
Element to insert
Get merkle path to a leaf
Leaf index to generate path for
An object containing adjacent elements and left-right index
Get tree root
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
Change an element in the tree
Index of element to change
Updated element value
Returns a copy of n-th zero elements array
Create a merkle tree with the target root by inserting the given leaves one-by-one. If the root matches after an insertion, return the tree. Else, return undefined.
An array of ordered leaves to be inserted in a merkle tree
The root that the caller is trying to build a tree against
Deserialize 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
Generated using TypeDoc
Merkle tree