Function LazyTowerHashChainProofBuilder

  • LazyTowerHashChainProofBuilder is a TypeScript implementation of LazyTower to generate proofs of membership.

    Parameters

    • H: number

      Height of tower of the proving circuit. It can be less than the H in the contract.

    • W: number

      Width of tower.

    • hash: ((a, b) => bigint) = defaultHash

      A hash function which supports 2 input values.

        • (a, b): bigint
        • Parameters

          • a: bigint
          • b: bigint

          Returns bigint

    Returns {
        add: ((item) => void);
        build: ((idx) => LazyTowerHashChainProof);
        indexOf: ((item) => number);
    }

    • add: ((item) => void)
        • (item): void
        • Adds a new item in the LazyTower.

          Parameters

          • item: bigint

            Item to be added.

          Returns void

    • build: ((idx) => LazyTowerHashChainProof)
    • indexOf: ((item) => number)
        • (item): number
        • Returns the index of a item. If the item does not exist it returns -1.

          Parameters

          • item: bigint

            Added item.

          Returns number

          Index of the item.