Status | |
---|---|
Stability | stable |
Component Type | library |
This library introduces a Patricia Merkle tree implementation.
It can be backed in memory or using a key-value store.
The library offers a few methods to define a trie in memory quickly:
MerklePatriaTrie.storingStrings()
defines a trie using keys and values as Strings.MerklePatriaTrie.storingBytes()
defines a trie using keys and values as Bytes.The same approach works with a stored trie:
StoredMerklePatriciaTrie.storingStrings(storage: MerkleStorage)
StoredMerklePatriciaTrie.storingBytes(storage: MerkleStorage)
You will need to provide a storage in this case, which you will define by implementing MerkleStorage
.
Note in Java, you should use AsyncMerkleStorage
instead to avoid dealing with coroutines.
An easy way to provide storage is to rely on a key-value store as defined in the kv library.