MerkleProof2019 module for python
Project description
lds-merkle-proof-2019-py
MerkleProof2019 implementation in python
Installation
pip install lds-merkle-proof-2019-bloxberg
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-bloxberg-0.0.8.9.tar.gz
.
File metadata
- Download URL: lds-merkle-proof-2019-bloxberg-0.0.8.9.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60354c2e596b9ef4e86c251a19e03139270fcd51ae41621911295000e58bf2f3 |
|
MD5 | 6ba9fab6c5e40c98cd0178796736c442 |
|
BLAKE2b-256 | 9eab29fc677c410605d9ca255000b5eb24dbf865e0720ee8c4af324772b4a198 |
File details
Details for the file lds_merkle_proof_2019_bloxberg-0.0.8.9-py3.8.egg
.
File metadata
- Download URL: lds_merkle_proof_2019_bloxberg-0.0.8.9-py3.8.egg
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b81bd7643dd174f51d73520f2ffda962d4d499e10b3b361c29055916cf45ba9 |
|
MD5 | 20ca0129719485d36505cf44d4123f56 |
|
BLAKE2b-256 | 6a8b0b28cd4ae676d8ae25a3b60ed64264a3f88ed1f3d6f540d2988c03665fa7 |