Skip to main content

MerkleMap

Constructors

new MerkleMap()

new MerkleMap(): MerkleMap

Creates a new, empty Merkle Map.

Returns

MerkleMap

A new MerkleMap

Source

lib/provable/merkle-map.ts:17

Properties

tree

tree: MerkleTree;

Source

lib/provable/merkle-map.ts:11

Methods

_keyToIndex()

_keyToIndex(key: Field): bigint

Parameters

key: Field

Returns

bigint

Source

lib/provable/merkle-map.ts:21


get()

get(key: Field): Field

Returns a value given a key. Values are by default Field(0).

Parameters

key: Field

The key to get the value from.

Returns

Field

The value stored at the key.

Source

lib/provable/merkle-map.ts:48


getRoot()

getRoot(): Field

Returns the root of the Merkle Map.

Returns

Field

The root of the Merkle Map.

Source

lib/provable/merkle-map.ts:57


getWitness()

getWitness(key: Field): MerkleMapWitness

Returns a circuit-compatible witness (also known as Merkle Proof or Merkle Witness) for the given key.

Parameters

key: Field

The key to make a witness for.

Returns

MerkleMapWitness

A MerkleMapWitness, which can be used to assert changes to the MerkleMap, and the witness's key.

Source

lib/provable/merkle-map.ts:66


set()

set(key: Field, value: Field): void

Sets a key of the merkle map to a given value.

Parameters

key: Field

The key to set in the map.

value: Field

The value to set.

Returns

void

Source

lib/provable/merkle-map.ts:38