Mutable Merkle
mutable_merkle provides a merkle tree with append, update and remove leaf functionality. This
is intended to support solutions that are not just append only.
m1 = mutable_merkle.tree.MerkleTree.new([b"a", b"b", b"c", b"e", b"f"], hash_type="sha256")
m2 = mutable_merkle.tree.MerkleTree.new([b"a", b"b", b"c", b"d", b"e", b"f"], hash_type="sha256")
m3 = mutable_merkle.tree.MerkleTree(hash_type="sha256")
m2.remove_leaf(3)
for value in [b"a", b"b", b"c", b"e", b"f"]:
m3.add_leaf(value)
assert m1.root == m2.root
assert m1.root == m3.root
Serialization
Along with update and remove leaf functionality, mutable_merkle has been designed
around being serializable as well. This supports storage of the merkle tree as well
as transmission of the proofs.
mt = mutable_merkle.tree.MerkleTree.new(
[b"a", b"b", b"c", b"d", b"e", b"f", b"g", b"h", b"i", b"j"],
hash_type=hash_type,
)
payload = mt.marshal()
mt_reload = mutable_merkle.tree.MerkleTree.unmarshal(payload)
assert mt == mt_reload
Release files for mutable-merkle 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mutable_merkle-0.1.1.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mutable_merkle-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / mutable_merkle-0.1.1.tar.gz
| Download URL | mutable_merkle-0.1.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
392a3cf26bae21ceeaf4696fe91071d13070bf3acdd8854bb734ed6c7210ec6c
|
|
BLAKE2b-256 checksum How to use checksums |
1aaae27be73d4e0c209072e2b5d8fa4ca6ff30b4c79365a4997ba4977b00035f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Linux/5.0.0-37-generic
|
Release files / mutable_merkle-0.1.1-py3-none-any.whl
| Download URL | mutable_merkle-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c31c574d4708a8ff8c86d8688c43bff21034223f90946bf3b8c9b45ac5fb4a3
|
|
BLAKE2b-256 checksum How to use checksums |
5f8beac3b7345f34ad7326799d85b643b84e7a449456e94373d5fa4c179b459d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Linux/5.0.0-37-generic
|