Class ProvableMerkleTreeUtils

Collection of utility functions for merkle tree in the circuit.

ProvableMerkleTreeUtils

Constructors

Properties

EMPTY_VALUE: Field = EMPTY_VALUE

Empty value for merkle tree

Static

Memberof

ProvableMerkleTreeUtils

Methods

  • Returns true if the value is in the tree and it is at the index from the key

    Type Parameters

    • V

    Parameters

    • proof: BaseMerkleProof
    • expectedRoot: Field
    • index: Field
    • value: V
    • valueType: Provable<V>
    • Optional options: {
          hashValue: boolean;
          hasher?: Hasher;
      } = ...

      hasher: The hash function to use, defaults to PoseidonHasherFunc; hashValue: whether to hash the value, the default is true.

      • hashValue: boolean
      • Optional hasher?: Hasher

    Returns Bool

    {Bool}

    Static

    Memberof

    ProvableMerkleTreeUtils

  • Returns true if there is no value at the index from the key

    Parameters

    Returns Bool

    {Bool}

    Static

    Memberof

    ProvableMerkleTreeUtils

  • Calculate new root based on index and value.

    Type Parameters

    • V

    Parameters

    • proof: BaseMerkleProof
    • index: Field
    • value: V
    • valueType: Provable<V>
    • Optional options: {
          hashValue: boolean;
          hasher?: Hasher;
      } = ...

      hasher: The hash function to use, defaults to PoseidonHasherFunc; hashValue: whether to hash the value, the default is true.

      • hashValue: boolean
      • Optional hasher?: Hasher

    Returns Field

    {Field}

    Static

    Memberof

    ProvableMerkleTreeUtils