Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MerkleTree<K, V>

The interface for a merkle tree.

Type parameters

  • K

  • V

Hierarchy

  • MerkleTree

Implemented by

Index

Properties

batch

batch: function

Execute a batch of put and delete operations. The execution is batched, so calling this function with multiple updates provides more opportunities for optimization and can be faster than call put() and del() multiple times.

param

An array of put operations on the tree, of type BatchPut.

param

An optional array of keys to delete from the tree.

returns

The root that results from this set of operations.

Type declaration

    • (putOps: Array<BatchPut<K, V>>, delOps?: K[]): Buffer
    • Parameters

      • putOps: Array<BatchPut<K, V>>
      • Optional delOps: K[]

      Returns Buffer

del

del: function

Given a key, delete any mapping that exists for that key.

param

The key to unmap.

Type declaration

    • (key: K): void
    • Parameters

      • key: K

      Returns void

get

get: function

Given a key, retrieve a Witness for the mapping.

param

The key to retrieve the Witness for.

returns

A Witness, with a proof of the value read (or a null value, with a proof of the value's nonexistence).

Type declaration

put

put: function

Insert a new mapping into the tree. If the key is already mapped in the tree, it is updated with the new value.

param

The key to insert.

param

A Buffer representing the value.

Type declaration

    • (key: K, val: V): void
    • Parameters

      • key: K
      • val: V

      Returns void

root

root: Buffer

The root hash of the tree.

rootHash

rootHash: bigint

The root hash of the tree, as a bigint. Reading this property is more efficient than obtaining a buffer.

search

search: function

Search for the given key, returning a SearchResult which contains the path traversed to search for the key.

param

The key to search for.

returns

A SearchResult containing the path to the key, and the value if it was present.

Type declaration

Generated using TypeDoc