Constructors

Methods

  • Compute the Merkle root of a list of leaf hashes. If the number of leaves is odd, the last leaf is duplicated. Returns empty string for empty input.

    Parameters

    • leaves: string[]
    • algorithm: string = 'sha256'

    Returns string

  • Compute a Merkle inclusion proof for a leaf at a given index. Returns the sibling hashes needed to reconstruct the root.

    Parameters

    • leaves: string[]
    • leafIndex: number
    • algorithm: string = 'sha256'

    Returns MerkleProof

  • Verify a Merkle inclusion proof.

    Parameters

    • proof: MerkleProof
    • algorithm: string = 'sha256'

    Returns boolean