MerkleMap
Class: MerkleMap
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new MerkleMap()
Creates a new, empty Merkle Map.
Defined in
Properties
tree
• tree: MerkleTree
Defined in
Methods
_keyToIndex
▸ _keyToIndex(key
): bigint
Parameters
Name | Type |
---|---|
key | Field |
Returns
bigint
Defined in
get
▸ get(key
): Field
Returns a value given a key. Values are by default Field(0).
Parameters
Name | Type | Description |
---|---|---|
key | Field | The key to get the value from. |
Returns
The value stored at the key.
Defined in
getRoot
▸ getRoot(): Field
Returns the root of the Merkle Map.
Returns
The root of the Merkle Map.
Defined in
getWitness
▸ getWitness(key
): MerkleMapWitness
Returns a circuit-compatible witness (also known as Merkle Proof or Merkle Witness) for the given key.
Parameters
Name | Type | Description |
---|---|---|
key | Field | The key to make a witness for. |
Returns
A MerkleMapWitness, which can be used to assert changes to the MerkleMap, and the witness's key.
Defined in
set
▸ set(key
, value
): void
Sets a key of the merkle map to a given value.
Parameters
Name | Type | Description |
---|---|---|
key | Field | The key to set in the map. |
value | Field | - |
Returns
void