lds-merkle-proof-2019


Namelds-merkle-proof-2019 JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/blockchain-certificates/lds-merkle-proof-2019-py
SummaryMerkleProof2019 module for python
upload_time2022-07-12 18:03:42
maintainer
docs_urlNone
authorBlockcerts
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements py-multibase cbor2
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/lds-merkle-proof-2019.svg)](https://badge.fury.io/py/lds-merkle-proof-2019)

# lds-merkle-proof-2019-py
[MerkleProof2019](https://w3c-ccg.github.io/lds-merkle-proof-2019/) implementation in python

## Installation

```
pip install lds-merkle-proof-2019
```

## Usage

### Encoding
```python
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
```python
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](https://pypi.org) & [pypi test](https://test.pypi.org)
- Install [twine](github.com/pypa/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/*`



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/blockchain-certificates/lds-merkle-proof-2019-py",
    "name": "lds-merkle-proof-2019",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Blockcerts",
    "author_email": "info@blockcerts.org",
    "download_url": "https://files.pythonhosted.org/packages/2c/c0/52d413be031bdedaff4f41d2cc4498ec48916519f252bc6ef32d17c13992/lds-merkle-proof-2019-0.1.0.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/lds-merkle-proof-2019.svg)](https://badge.fury.io/py/lds-merkle-proof-2019)\n\n# lds-merkle-proof-2019-py\n[MerkleProof2019](https://w3c-ccg.github.io/lds-merkle-proof-2019/) implementation in python\n\n## Installation\n\n```\npip install lds-merkle-proof-2019\n```\n\n## Usage\n\n### Encoding\n```python\nfrom lds_merkle_proof_2019.merkle_proof_2019 import MerkleProof2019\n\nmp2019 = MerkleProof2019()\n\njson_proof = {\n  \"path\": [\n    { \"right\": \"51b4e22ed024ec7f38dc68b0bf78c87eda525ab0896b75d2064bdb9fc60b2698\" },\n    { \"right\": \"61c56cca660b2e616d0bd62775e728f50275ae44adf12d1bfb9b9c507a14766b\" }\n  ],\n  \"merkleRoot\": \"3c9ee831b8705f2fbe09f8b3a92247eed88cdc90418c024924be668fdc92e781\",\n  \"targetHash\": \"c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f20\",\n  \"anchors\": [\n    \"blink:btc:testnet:582733d7cef8035d87cecc9ebbe13b3a2f6cc52583fbcd2b9709f20a6b8b56b3\"\n  ]\n}\n\nencoded_value = mp2019.encode(json_proof)\nprint(encoded_value) # b'zmz7LKNSJbePX9eJWLTaNA3X69vbLSiaJWJPVpFWznKg19Aeug3PQHFrkySKFvvGJhECwPMn947tzUFYnVMxbS428oLi5tw2HLKP9szAArV3TbfDSKXddpfV6fPBde6XN8FDbri2wGtYrgyzDXEaGu6QzzUd1GDMTcZ7c9FVFTb8k5v6crug5aLt2Sevap1gE9DS7ZUpfRMv8TQHiktNnQBGgc74g8soERFuziTDWoPGTu3Xb6bAs431DJpGGKHDenmFjkQFUJnwQ9nFKKowYnf9h8Gp8gcQmE78aoWhtEG4qV6Jaik8HhPTQX3dD7MQrXzY8GAHh8tKWQfscyGWb6w4FMpok13jBpZWpaPTVR5fMXsa1garazbMRL7xssnwEJ2gzrCDrGkFXb3JyDGoXMffAYKHUetADrCd3sZKW9k5jC5d6bMA5zSwbyeZE9BjaD27mTrJXSzguAZ1pKsghFztG5u5h6jLgBGMp2aPFopvESSnCA'\n```\n\n### Decoding\n```python\nfrom lds_merkle_proof_2019.merkle_proof_2019 import MerkleProof2019\n\nmp2019 = MerkleProof2019()\n\nencoded_value = b'zmz7LKNSJbePX9eJWLTaNA3X69vbLSiaJWJPVpFWznKg19Aeug3PQHFrkySKFvvGJhECwPMn947tzUFYnVMxbS428oLi5tw2HLKP9szAArV3TbfDSKXddpfV6fPBde6XN8FDbri2wGtYrgyzDXEaGu6QzzUd1GDMTcZ7c9FVFTb8k5v6crug5aLt2Sevap1gE9DS7ZUpfRMv8TQHiktNnQBGgc74g8soERFuziTDWoPGTu3Xb6bAs431DJpGGKHDenmFjkQFUJnwQ9nFKKowYnf9h8Gp8gcQmE78aoWhtEG4qV6Jaik8HhPTQX3dD7MQrXzY8GAHh8tKWQfscyGWb6w4FMpok13jBpZWpaPTVR5fMXsa1garazbMRL7xssnwEJ2gzrCDrGkFXb3JyDGoXMffAYKHUetADrCd3sZKW9k5jC5d6bMA5zSwbyeZE9BjaD27mTrJXSzguAZ1pKsghFztG5u5h6jLgBGMp2aPFopvESSnCA'\n\ndecoded_json = mp2019.decode(encoded_value)\nprint(decoded_json) # {'path': [{'right': '51b4e22ed024ec7f38dc68b0bf78c87eda525ab0896b75d2064bdb9fc60b2698'}, {'right': '61c56cca660b2e616d0bd62775e728f50275ae44adf12d1bfb9b9c507a14766b'}], 'merkleRoot': '3c9ee831b8705f2fbe09f8b3a92247eed88cdc90418c024924be668fdc92e781', 'targetHash': 'c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f20', 'anchors': ['blink:btc:testnet:582733d7cef8035d87cecc9ebbe13b3a2f6cc52583fbcd2b9709f20a6b8b56b3']}\n\n```\n\n\n# Development\n\n## Run tests\n\n```\n./run_tests.sh\n```\n\n## Publishing To Pypi\n- Create an account for [pypi](https://pypi.org) & [pypi test](https://test.pypi.org)\n- Install [twine](github.com/pypa/twine) - `pip install twine`\n- Increment version in `__init__.py`\n- Remove current items in dist - `rm -rf dist/*`\n- Build package - `python setup.py install`\n- Build sdist - `python setup.py sdist`\n- Run pypi test upload - `twine upload --repository-url https://test.pypi.org/legacy/ dist/*`\n- Upload to pypi - `twine upload --repository-url https://upload.pypi.org/legacy/ dist/*`\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MerkleProof2019 module for python",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/blockchain-certificates/lds-merkle-proof-2019-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "460154be3fbe47e0b2afd70bf5dd9ed51f04e95879fa61e231ee06588c87cd6a",
                "md5": "234b7aa02c95d122f642de640ed7ef7c",
                "sha256": "44557de81c4e270a9a9a7c35b2cdf074af2b01d02b8faf8a7db8250afe733934"
            },
            "downloads": -1,
            "filename": "lds_merkle_proof_2019-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "234b7aa02c95d122f642de640ed7ef7c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5362,
            "upload_time": "2022-07-12T18:03:41",
            "upload_time_iso_8601": "2022-07-12T18:03:41.229677Z",
            "url": "https://files.pythonhosted.org/packages/46/01/54be3fbe47e0b2afd70bf5dd9ed51f04e95879fa61e231ee06588c87cd6a/lds_merkle_proof_2019-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2cc052d413be031bdedaff4f41d2cc4498ec48916519f252bc6ef32d17c13992",
                "md5": "4d34e6e4650510c6a71b0b0409a9bde1",
                "sha256": "a29ceaaeee586debc9171c9d345bf4ab97f99975b02941226e8871bc416faf22"
            },
            "downloads": -1,
            "filename": "lds-merkle-proof-2019-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4d34e6e4650510c6a71b0b0409a9bde1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5136,
            "upload_time": "2022-07-12T18:03:42",
            "upload_time_iso_8601": "2022-07-12T18:03:42.872284Z",
            "url": "https://files.pythonhosted.org/packages/2c/c0/52d413be031bdedaff4f41d2cc4498ec48916519f252bc6ef32d17c13992/lds-merkle-proof-2019-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-12 18:03:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blockchain-certificates",
    "github_project": "lds-merkle-proof-2019-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "py-multibase",
            "specs": [
                [
                    ">=",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "cbor2",
            "specs": [
                [
                    ">=",
                    "4.1.2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "lds-merkle-proof-2019"
}
        
Elapsed time: 0.08012s