Skip to main content

Class: MerkleMap

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new MerkleMap()

Creates a new, empty Merkle Map.

Defined in

lib/merkle_map.ts:18

Properties

tree

tree: MerkleTree

Defined in

lib/merkle_map.ts:10

Methods

_keyToIndex

_keyToIndex(key): bigint

Parameters

NameType
keyField

Returns

bigint

Defined in

lib/merkle_map.ts:33


get

get(key): Field

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

Parameters

NameTypeDescription
keyFieldThe key to get the value from.

Returns

Field

The value stored at the key.

Defined in

lib/merkle_map.ts:69


getRoot

getRoot(): Field

Returns the root of the Merkle Map.

Returns

Field

The root of the Merkle Map.

Defined in

lib/merkle_map.ts:80


getWitness

getWitness(key): MerkleMapWitness

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

Parameters

NameTypeDescription
keyFieldThe 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.

Defined in

lib/merkle_map.ts:89


set

set(key, value): void

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

Parameters

NameTypeDescription
keyFieldThe key to set in the map.
valueField-

Returns

void

Defined in

lib/merkle_map.ts:57