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.

Files for mutable-merkle, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size mutable_merkle-0.1.1-py3-none-any.whl (8.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mutable_merkle-0.1.1.tar.gz (8.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page