new MerkleTree(leaves, hasher)
Implements a merkle hash tree
Parameters:
Name | Type | Description |
---|---|---|
leaves | Array.<string> | | Initial tree input |
hasher | function | Hash function for building tree |
- Source
Methods
depth() → {Number}
Computes the tree depth
- Source
Returns:
- Type:
- Number
level(level) → {String}
Returns the leaves at the given level
Parameters:
Name | Type | Description |
---|---|---|
level | Number |
- Source
Returns:
- Type:
- String
levels() → {Number}
Returns the number of levels in the tree
- Source
Returns:
- Type:
- Number
nodes() → {Number}
Returns the number of nodes in the tree
- Source
Returns:
- Type:
- Number
root() → {String}
Returns the merkle root of the tree
- Source
Returns:
- Type:
- String