UNPKG

postchain-client

Version:

Client library for accessing a Postchain node through REST.

19 lines (17 loc) 848 B
/// <reference types="node" /> import { Path } from "./types"; import { Buffer } from "buffer"; export declare function calculateRoot(hashes: Buffer[], depth?: number, leafDepth?: number): Buffer; export declare function merklePath(hashes: Buffer[], target: Buffer): Path; /** * * @param path The merkle path to validate. * Format [{side: <0|1>, hash: <hash buffer depth n-1>}, * {side: <0|1>, hash: <hash buffer depth n-2>}, * ..., * {side: <0|1>, hash: <hash buffer depth 1>}] * @param target the leaf hash that the path proves belongs in the merkleRoot * @param merkleRoot The merkle root that supposedly contains the target via the supplied path. * The merkle root is typically taken from a block header. */ export declare function validateMerklePath(path: Path, target: Buffer, merkleRoot: Buffer): boolean;