Skip to main content

A Merkle tree supporting append, update, remove operations.

Project description

Mutable Merkle

image image image style tests codecov

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 =[b"a", b"b", b"c", b"e", b"f"], hash_type="sha256")
  m2 =[b"a", b"b", b"c", b"d", b"e", b"f"], hash_type="sha256")
  m3 = mutable_merkle.tree.MerkleTree(hash_type="sha256")

  for value in [b"a", b"b", b"c", b"e", b"f"]:

  assert m1.root == m2.root
  assert m1.root == m3.root


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 =
      [b"a", b"b", b"c", b"d", b"e", b"f", b"g", b"h", b"i", b"j"],

  payload = mt.marshal()

  mt_reload = mutable_merkle.tree.MerkleTree.unmarshal(payload)

  assert mt == mt_reload

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mutable_merkle-0.1.1.tar.gz (8.0 kB view hashes)

Uploaded source

Built Distribution

mutable_merkle-0.1.1-py3-none-any.whl (8.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page