MerkleProof2019 module for python
Project description
lds-merkle-proof-2019-py
MerkleProof2019 implementation in python
Installation
pip install lds-merkle-proof-2019
Usage
Encoding
from lds_merkle_proof_2019.merkle_proof_2019 import MerkleProof2019
mp2019 = MerkleProof2019()
json_proof = {
"path": [
{ "right": "51b4e22ed024ec7f38dc68b0bf78c87eda525ab0896b75d2064bdb9fc60b2698" },
{ "right": "61c56cca660b2e616d0bd62775e728f50275ae44adf12d1bfb9b9c507a14766b" }
],
"merkleRoot": "3c9ee831b8705f2fbe09f8b3a92247eed88cdc90418c024924be668fdc92e781",
"targetHash": "c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f20",
"anchors": [
"blink:btc:testnet:582733d7cef8035d87cecc9ebbe13b3a2f6cc52583fbcd2b9709f20a6b8b56b3"
]
}
encoded_value = mp2019.encode(json_proof)
print(encoded_value) # b'zmz7LKNSJbePX9eJWLTaNA3X69vbLSiaJWJPVpFWznKg19Aeug3PQHFrkySKFvvGJhECwPMn947tzUFYnVMxbS428oLi5tw2HLKP9szAArV3TbfDSKXddpfV6fPBde6XN8FDbri2wGtYrgyzDXEaGu6QzzUd1GDMTcZ7c9FVFTb8k5v6crug5aLt2Sevap1gE9DS7ZUpfRMv8TQHiktNnQBGgc74g8soERFuziTDWoPGTu3Xb6bAs431DJpGGKHDenmFjkQFUJnwQ9nFKKowYnf9h8Gp8gcQmE78aoWhtEG4qV6Jaik8HhPTQX3dD7MQrXzY8GAHh8tKWQfscyGWb6w4FMpok13jBpZWpaPTVR5fMXsa1garazbMRL7xssnwEJ2gzrCDrGkFXb3JyDGoXMffAYKHUetADrCd3sZKW9k5jC5d6bMA5zSwbyeZE9BjaD27mTrJXSzguAZ1pKsghFztG5u5h6jLgBGMp2aPFopvESSnCA'
Decoding
from lds_merkle_proof_2019.merkle_proof_2019 import MerkleProof2019
mp2019 = MerkleProof2019()
encoded_value = b'zmz7LKNSJbePX9eJWLTaNA3X69vbLSiaJWJPVpFWznKg19Aeug3PQHFrkySKFvvGJhECwPMn947tzUFYnVMxbS428oLi5tw2HLKP9szAArV3TbfDSKXddpfV6fPBde6XN8FDbri2wGtYrgyzDXEaGu6QzzUd1GDMTcZ7c9FVFTb8k5v6crug5aLt2Sevap1gE9DS7ZUpfRMv8TQHiktNnQBGgc74g8soERFuziTDWoPGTu3Xb6bAs431DJpGGKHDenmFjkQFUJnwQ9nFKKowYnf9h8Gp8gcQmE78aoWhtEG4qV6Jaik8HhPTQX3dD7MQrXzY8GAHh8tKWQfscyGWb6w4FMpok13jBpZWpaPTVR5fMXsa1garazbMRL7xssnwEJ2gzrCDrGkFXb3JyDGoXMffAYKHUetADrCd3sZKW9k5jC5d6bMA5zSwbyeZE9BjaD27mTrJXSzguAZ1pKsghFztG5u5h6jLgBGMp2aPFopvESSnCA'
decoded_json = mp2019.decode(encoded_value)
print(decoded_json) # {'path': [{'right': '51b4e22ed024ec7f38dc68b0bf78c87eda525ab0896b75d2064bdb9fc60b2698'}, {'right': '61c56cca660b2e616d0bd62775e728f50275ae44adf12d1bfb9b9c507a14766b'}], 'merkleRoot': '3c9ee831b8705f2fbe09f8b3a92247eed88cdc90418c024924be668fdc92e781', 'targetHash': 'c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f20', 'anchors': ['blink:btc:testnet:582733d7cef8035d87cecc9ebbe13b3a2f6cc52583fbcd2b9709f20a6b8b56b3']}
Development
Run tests
./run_tests.sh
Publishing To Pypi
- Create an account for pypi & pypi test
- Install twine -
pip install twine
- Increment version in
__init__.py
- Remove current items in dist -
rm -rf dist/*
- Build package -
python setup.py install
- Build sdist -
python setup.py sdist
- Run pypi test upload -
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- Upload to pypi -
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
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
Built Distribution
File details
Details for the file lds-merkle-proof-2019-0.1.0.tar.gz
.
File metadata
- Download URL: lds-merkle-proof-2019-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.28.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a29ceaaeee586debc9171c9d345bf4ab97f99975b02941226e8871bc416faf22 |
|
MD5 | 4d34e6e4650510c6a71b0b0409a9bde1 |
|
BLAKE2b-256 | 2cc052d413be031bdedaff4f41d2cc4498ec48916519f252bc6ef32d17c13992 |
File details
Details for the file lds_merkle_proof_2019-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: lds_merkle_proof_2019-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.28.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44557de81c4e270a9a9a7c35b2cdf074af2b01d02b8faf8a7db8250afe733934 |
|
MD5 | 234b7aa02c95d122f642de640ed7ef7c |
|
BLAKE2b-256 | 460154be3fbe47e0b2afd70bf5dd9ed51f04e95879fa61e231ee06588c87cd6a |