Class MerkleTree<V>

Merkle Tree.

Type Parameters

  • V

Hierarchy

  • MerkleTree

Constructors

Properties

hashValue: boolean
hasher: Hasher
height: number
maxNumIndex: bigint
root: Field
store: Store<V>
valueType: Provable<V>

Methods

  • Delete a value from tree and return the new root of the tree.

    Returns

    {Promise}

    Memberof

    MerkleTree

    Parameters

    • index: bigint

    Returns Promise<Field>

  • Get the value for an index from the tree.

    Returns

    {(Promise<V | null>)}

    Memberof

    MerkleTree

    Parameters

    • index: bigint

    Returns Promise<null | V>

  • Check if the index exists in the tree.

    Returns

    {Promise}

    Memberof

    MerkleTree

    Parameters

    • index: bigint

    Returns Promise<boolean>

  • Set the root of the tree.

    Memberof

    MerkleTree

    Parameters

    • root: Field

    Returns Promise<void>

  • Parameters

    • root: Field
    • path: Field

    Returns Promise<{
        leafData: Field;
        pathNodes: Field[];
        sideNodes: Field[];
    }>

  • Update a new value for an index in the tree and return the new root of the tree.

    Returns

    {Promise}

    Memberof

    MerkleTree

    Parameters

    • index: bigint
    • Optional value: V

    Returns Promise<Field>

  • Update multiple leaves and return the new root of the tree.

    Returns

    {Promise}

    Memberof

    MerkleTree

    Parameters

    • ivs: {
          index: bigint;
          value?: V;
      }[]

    Returns Promise<Field>

  • Parameters

    • root: Field
    • key: bigint
    • Optional value: V

    Returns Promise<Field>

  • Parameters

    • sideNodes: Field[]
    • pathNodes: Field[]
    • oldLeafData: Field
    • path: Field
    • Optional value: V

    Returns Field

  • Build a new merkle tree.

    Static

    Returns

    {Promise<MerkleTree>}

    Memberof

    MerkleTree

    Type Parameters

    • V

    Parameters

    • store: Store<V>
    • height: number
    • valueType: Provable<V>
    • Optional options: {
          hashValue?: boolean;
          hasher?: Hasher;
      } = ...
      • Optional hashValue?: boolean
      • Optional hasher?: Hasher

    Returns Promise<MerkleTree<V>>

  • Import a merkle tree via existing store.

    Static

    Returns

    {Promise<MerkleTree>}

    Memberof

    MerkleTree

    Type Parameters

    • V

    Parameters

    • store: Store<V>
    • height: number
    • valueType: Provable<V>
    • Optional options: {
          hashValue?: boolean;
          hasher?: Hasher;
      } = ...
      • Optional hashValue?: boolean
      • Optional hasher?: Hasher

    Returns Promise<MerkleTree<V>>

Generated using TypeDoc