A Sparse Merkle Tree for a key/value map
Project description
Sparse Merkle Tree
A Sparse Merkle Tree for a key/value map.
This is a Python port of the great work here: celestiaorg
The tree implements the same optimisations specified in the Libra whitepaper, to reduce the number of hash operations required per tree operation to O(k) where k is the number of non-empty elements in the tree.
Example
tree = SparseMerkleTree()
root = tree.update(b"a", b"a1")
assert b"a1" == tree.get(b"a")
proof = tree.prove(b"a")
assert verify_proof(proof, root, b"a", b"a1")
tree.delete(b"a")
assert b"" == tree.get(b"a")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparse-merkle-tree-0.3.0.tar.gz.
File metadata
- Download URL: sparse-merkle-tree-0.3.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06d3824c5a464a2412209ce0e81dfa628f81cd112bb2865afc6c8765a70ea43d
|
|
| MD5 |
1d2ef5396cabff09c7e50682c13fdac2
|
|
| BLAKE2b-256 |
4bd5b95a3bd49e2c6fa6c54ef2a44791cdeb6cd257238b03059f2204853a539b
|
File details
Details for the file sparse_merkle_tree-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sparse_merkle_tree-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e92ac231bec8f8e8993465a110bdb27bc9af08d3bbed364d59322e6ddaae1b6
|
|
| MD5 |
5aa7d4f4965cd7d60a147eba839e9da8
|
|
| BLAKE2b-256 |
58e93defee8f5ed04a8e05b9f578bbfa1b9721dc110fd8043de7b823fb6d71ee
|