Class: MerkleTree
merkle.MerkleTree
Constructors​
constructor​
• new MerkleTree(leafHashes
)
Parameters​
Name | Type |
---|---|
leafHashes | string [] |
Defined in​
Properties​
leaves​
• leaves: string
[]
Defined in​
branches​
• branches: string
[][] = []
Defined in​
root​
• root: string
Defined in​
Methods​
hash​
â–¸ Static
hash(a
, b
): string
Create pedersen hash from a and b
Parameters​
Name | Type |
---|---|
a | string |
b | string |
Returns​
string
format: hex-string
Defined in​
build​
â–¸ Private
build(leaves
): string
Create Merkle tree
Parameters​
Name | Type | Description |
---|---|---|
leaves | string [] | hex-string array |
Returns​
string
format: hex-string; Merkle tree root
Defined in​
getProof​
â–¸ getProof(leaf
, branch?
, hashPath?
): string
[]
Return path to leaf
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
leaf | string | undefined | hex-string |
branch | string [] | undefined | hex-string array |
hashPath | string [] | [] | hex-string array |
Returns​
string
[]
format: hex-string array