Class ProvableSMTUtils

Collection of utility functions for sparse merkle tree in the circuit.

Hierarchy

  • ProvableSMTUtils

Constructors

Properties

EMPTY_VALUE: Field = EMPTY_VALUE

Empty value for sparse merkle tree

Static

Memberof

ProvableSMTUtils

computeRootByField: ((sideNodes: Field[], keyHashOrKeyField: Field, valueHashOrValueField: Field, hasher??: Hasher) => Field) = computeRootByFieldInCircuit

Type declaration

    • (sideNodes: Field[], keyHashOrKeyField: Field, valueHashOrValueField: Field, hasher??: Hasher): Field
    • Calculate new root based on sideNodes, keyHashOrKeyField and valueHashOrValueField in circuit.

      Returns

      {Field}

      Parameters

      • sideNodes: Field[]
      • keyHashOrKeyField: Field
      • valueHashOrValueField: Field
      • Optional hasher: Hasher = Poseidon.hash

      Returns Field

verifyProofByField: ((proof: SparseMerkleProof, expectedRoot: Field, keyHashOrKeyField: Field, valueHashOrValueField: Field, hasher??: Hasher) => Bool) = verifyProofByFieldInCircuit

Type declaration

    • (proof: SparseMerkleProof, expectedRoot: Field, keyHashOrKeyField: Field, valueHashOrValueField: Field, hasher??: Hasher): Bool
    • Verify a merkle proof by root, keyHashOrKeyField and valueHashOrValueField in circuit.

      Returns

      {Bool}

      Parameters

      • proof: SparseMerkleProof
      • expectedRoot: Field
      • keyHashOrKeyField: Field
      • valueHashOrValueField: Field
      • Optional hasher: Hasher = Poseidon.hash

      Returns Bool

Methods

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

    Static

    Returns

    {Bool}

    Memberof

    ProvableSMTUtils

    Type Parameters

    • K

    • V

    Parameters

    • proof: SparseMerkleProof
    • expectedRoot: Field
    • key: K
    • keyType: Provable<K>
    • value: V
    • valueType: Provable<V>
    • Optional options: {
          hashKey: boolean;
          hashValue: boolean;
          hasher?: Hasher;
      } = ...
      • hashKey: boolean
      • hashValue: boolean
      • Optional hasher?: Hasher

    Returns Bool

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

    Static

    Returns

    {Bool}

    Memberof

    ProvableSMTUtils

    Type Parameters

    • K

    Parameters

    • proof: SparseMerkleProof
    • expectedRoot: Field
    • key: K
    • keyType: Provable<K>
    • Optional options: {
          hashKey: boolean;
          hasher?: Hasher;
      } = ...
      • hashKey: boolean
      • Optional hasher?: Hasher

    Returns Bool

  • Calculate new root based on sideNodes, key and value

    Static

    Returns

    {Field}

    Memberof

    ProvableSMTUtils

    Type Parameters

    • K

    • V

    Parameters

    • sideNodes: Field[]
    • key: K
    • keyType: Provable<K>
    • value: V
    • valueType: Provable<V>
    • Optional options: {
          hashKey: boolean;
          hashValue: boolean;
          hasher?: Hasher;
      } = ...
      • hashKey: boolean
      • hashValue: boolean
      • Optional hasher?: Hasher

    Returns Field

Generated using TypeDoc