8000 GitHub - aliciawyy/pymerkletools: Python Merkle Tree implementation to Merkle proofs' generation and verification · GitHub
[go: up one dir, main page]

Skip to content

About

Python Merkle Tree implementation to Merkle proofs' generation and verification

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

pymerkletree

PyPI version Build Status codecov Maintainability Updates

This project is adapted from the pymerkletools of Tierion.

I have refactored and simplified most part of the code so it can be easier for development or for the understanding of MerkleTree.

It includes a MerkleTree class for creating Merkle trees, generating merkle proofs, and verification of merkle proofs.

Installation

pip install pymerkletree

Examples

The source code is simple by itself and examples can be found in the folder demo.

Notes

About tree generation

  1. Internally, leaves are stored as bytearray. When the tree is built, it is generated by hashing together the bytearray values.

  2. Lonely leaf nodes are promoted to the next level up, as depicted below.

                      ROOT=Hash(H+E)
                      /        \
                     /          \
              H=Hash(F+G)        E
              /       \           \
             /         \           \
      F=Hash(A+B)    G=Hash(C+D)    E
       /     \        /     \        \
      /       \      /       \        \
     A         B    C         D        E
    

About

Python Merkle Tree implementation to Merkle proofs' generation and verification

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0