Namespace: merkle
Classes​
Functions​
proofMerklePath​
â–¸ proofMerklePath(root
, leaf
, path
, hashMethod?
): boolean
Tests a Merkle tree path
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
root | string | undefined | hex-string |
leaf | string | undefined | hex-string |
path | string [] | undefined | hex-string array |
hashMethod | (a : BigNumberish , b : BigNumberish ) => string | computePedersenHash | hash method to use, default: Pedersen |
Returns​
boolean
true if the path is valid, false otherwise
Example
const leaves = ['0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7'];
const tree = new MerkleTree(leaves);
const result = proofMerklePath(tree.root, '0x3', [
'0x4',
'0x5bb9440e27889a364bcb678b1f679ecd1347acdedcbf36e83494f857cc58026',
'0x8c0e46dd2df9aaf3a8ebfbc25408a582ad7fa7171f0698ddbbc5130b4b4e60',
]);
// result = true