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")
Release files for sparse-merkle-tree 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sparse-merkle-tree-0.3.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sparse_merkle_tree-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / sparse-merkle-tree-0.3.0.tar.gz
| Download URL | sparse-merkle-tree-0.3.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06d3824c5a464a2412209ce0e81dfa628f81cd112bb2865afc6c8765a70ea43d
|
|
BLAKE2b-256 checksum How to use checksums |
4bd5b95a3bd49e2c6fa6c54ef2a44791cdeb6cd257238b03059f2204853a539b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sparse_merkle_tree-0.3.0-py3-none-any.whl
| Download URL | sparse_merkle_tree-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e92ac231bec8f8e8993465a110bdb27bc9af08d3bbed364d59322e6ddaae1b6
|
|
BLAKE2b-256 checksum How to use checksums |
58e93defee8f5ed04a8e05b9f578bbfa1b9721dc110fd8043de7b823fb6d71ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|