🌳 The simple and easy implementation of Merkle Tree
Project description
🌳 Merkly
The simple and easy implementation of Python Merkle Tree
Table of Contents
Credits
How to install
poetry add merkly
pip install merkly
How to works
- We use keccak-256 under-the-hood
This library provides a clean and easy to use implementation of the Merkle Tree with the following features:
- Create Leaf
- Create Root
- Create Proof
- Verify Proof
How to Use
Create a Merkle Tree
from merkly.mtree import MerkleTree
# create a Merkle Tree
mtree = MerkleTree(['a', 'b', 'c', 'd']
# show original input
assert mtree.raw_leafs == ['a', 'b', 'c', 'd']
# show leafs
assert mtree.leafs == []
Create a Root
from merkly.mtree import MerkleTree
# create a Merkle Tree
mtree = MerkleTree(['a', 'b', 'c', 'd'])
# get root of tree
assert mtree.root == ""
Create Proof of a leaf
from merkly.mtree import MerkleTree
# create a Merkle Tree
mtree = MerkleTree(['a', 'b', 'c', 'd'])
# get proof of a leaf
assert mtree.proof("b") == []
Verify Proof of a leaf
from merkly.mtree import MerkleTree
# create a Merkle Tree
mtree = MerkleTree(['a', 'b', 'c', 'd'])
# get proof of a leaf
p = mtree.proof("b")
# verify your proof
assert mtree.verify(p) == True
Roadmap
Feature | Status | Priority |
---|---|---|
Create Root | ✅ | 🔥 |
Create Proof | ✅ | 🔥 |
Verify Proof | ✅ | 🔥 |
Support OpenZeppelin | ⏰ | 🔥 |
Compatible with MerkleTreeJs | ⏰ | 🔥 |
Use any Hash function | ⏰ | 🧐 |
Leafs of any size | ⏰ | 🧐 |
Contributing
- Before read a code of conduct: CODE_OF_CONDUCT
- Follow the guide of development: CONTRIBUTING
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
merkly-0.5.1.tar.gz
(6.0 kB
view hashes)
Built Distribution
merkly-0.5.1-py3-none-any.whl
(6.5 kB
view hashes)