A Buffer representing the root hash of the tree. Always 256-bits (32 bytes).
The root hash of the tree, as a bigint. Reading this property is more efficient than obtaining a buffer.
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.
An array of put operations on the tree, of type BatchPut.
An optional array of keys to delete from the tree.
The root that results from this set of operations.
Execute a batch of put and delete operations. The execution of batch operations are performed in a copy on write (cow) fashion.
An array of put operations on the tree, of type BatchPut.
An optional array of keys to delete from the tree.
A new MerklePatriciaTree updated in a cow manner.
Updates CachedMerklePatriciaTree in a copy-on-write fashion
Key value pairs to be updated
Nodes in the nodeBags that become stale due to the updates
A list of maps indexing MerkleNodes with their hashes
Reads multiple keys and returns a concise reply of witnesses
: bulk keys to be read
: Array of witnesses
CopyTreePaths Copies paths that are marked for copy
Given a key, delete any mapping that exists for that key.
The key to unmap.
getFromCache returns the value corresponding to the key using nodeMap
: key to get from the CachedMerklePatriciaTree
: Bag of recent MerklePatriciaTree nodes from the client
value corresponding to the key if present; null if otherwise
Copies only the node; leaving its successors the same
: Node for copy
Returns the maxCacheDepth
Insert a node with the given value after a search.
The stack as a result of the search
The remainder as a result of the search
The value to insert.
multiSearch searches the tree for all keys and marks nodes for copy
: List of key, value pairs
: List of keys
: True if we want to mark the nodes for copy
Counts the number of nodes in the tree
Recursively prunes the cachedStateTree to maxCacheDepth by adding HashNodes
current node at a depth, starting from rootNode at depth = 1
Ranges from 1 to maxCacheDepth
Insert a new mapping into the tree. If the key is already mapped in the tree, it is updated with the new value.
The key to insert.
A Buffer representing the value.
putWithNodeBag inserts k,v pairs and rebuilds the pruned CachedMerklePatriciaTree if needed
: key to insert or modify
: value corresponding to the key
: A list of nodes used from the nodeBag for rebuilding the cached tree The usedNodes hashes change due to the insertion of the k, v pair into the tree
: A Map of nodes indexed by their hashes
Serialize a witness into RLP format.
A witness returned from a get() operation on a Merkle Patricia Tree
An RLP serialized witness, with non-essential nodes removed.
Given the rlpEncoded serialization of the node and a valueConverter
function, rlpToMerkleNode returns the decoded MerklePatriciaTreeNode
: rlpEncoded serialized MerklePatriciaNode
: Converts a Buffer value into type V
MerkleNode : Decoded MerklePatriciaNode
Search for the given key, returning a SearchResult which contains the path traversed to search for the key.
The key to search for.
A SearchResult containing the path to the key, and the value if it was present.
Returns the sum of lengths of rlpEncodings of all the nodes in the tree
Generated using TypeDoc
The root node of the tree.