Simple Merkle Tree
Project description
# pymerkletools
[![PyPI version](https://badge.fury.io/py/merkletools.svg)](https://badge.fury.io/py/merkletools)
[![Build Status](https://travis-ci.org/aliciawyy/pymerkletools.svg?branch=master)](https://travis-ci.org/aliciawyy/pymerkletools)
[![codecov](https://codecov.io/gh/aliciawyy/pymerkletools/branch/master/graph/badge.svg)](https://codecov.io/gh/aliciawyy/pymerkletools)
[![Maintainability](https://api.codeclimate.com/v1/badges/cfa9766c9537f10f72f1/maintainability)](https://codeclimate.com/github/aliciawyy/pymerkletools/maintainability)
This project is adapted from the [pymerkletools](https://github.com/aliciawyy/pymerkletools) of Tierion.
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
[![PyPI version](https://badge.fury.io/py/merkletools.svg)](https://badge.fury.io/py/merkletools)
[![Build Status](https://travis-ci.org/aliciawyy/pymerkletools.svg?branch=master)](https://travis-ci.org/aliciawyy/pymerkletools)
[![codecov](https://codecov.io/gh/aliciawyy/pymerkletools/branch/master/graph/badge.svg)](https://codecov.io/gh/aliciawyy/pymerkletools)
[![Maintainability](https://api.codeclimate.com/v1/badges/cfa9766c9537f10f72f1/maintainability)](https://codeclimate.com/github/aliciawyy/pymerkletools/maintainability)
This project is adapted from the [pymerkletools](https://github.com/aliciawyy/pymerkletools) of Tierion.
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
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
pymerkletree-1.0.5.tar.gz
(5.1 kB
view hashes)
Built Distributions
Close
Hashes for pymerkletree-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9ab024ad845b0718ea5c3c3afb466459a3224025cd7e168b788900ec497d314 |
|
MD5 | c69ef90f63aec434814751ccfbdf41e4 |
|
BLAKE2b-256 | 763989bebecbb13e02e537bbb1df1a6359b2a6f7ae92965a38a09a6b488523f6 |
Close
Hashes for pymerkletree-1.0.5-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46331dcc4f01fe87d598aeb306ce228fb85fbbebc06a7ad9a5fa36f71c64b76b |
|
MD5 | 74b5079f7539582cce6894158c998510 |
|
BLAKE2b-256 | 6abec8fd7ec6e594aeb1f8049c91cd980fdd5d9d07026548bf3a2cb04732bdd0 |