Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Merkle Mountain Range in python

Project description

Merkle Mountain Range


pip3 install -U git+


from mmr import MMR

def test_mmr():
    def serialize(i):
        return i.to_bytes(4, 'little')

    mmr = MMR()
    # push 0..11 into MMR, and record MMR positions
    positions = [mmr.add(serialize(i)) for i in range(0, 11)]
    merkle_root = mmr.get_root()
    # proof
    elem = 5
    pos = positions[elem]
    # generate proof for 5
    proof = mmr.gen_proof(pos)
    # verify proof
    result = proof.verify(root=merkle_root, pos=pos,


See tests to learn more.



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, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page