Ledger-SDK
The goal of this repository is to create a simple and common way to interact with the Ledger of Origins that is a part of Project Origin.
This is work in progress, more documentation will be written as the project progresses.
Requirements
The following four libraries are required to be installed.
pkg-config
libsecp256k1-dev
gcc
libzmq3-dev
Installation
Pip package is available at: https://pypi.org/project/Origin-Ledger-SDK/
Install from pip using:
pip install Origin-Ledger-SDK
Keys
TODO: A whole section where there will be info on key management.
Using the SDK
There are a number of request that can be executed to the ledger, these are:
- PublishMeasurementRequest
- IssueGGORequest
- TransferGGORequest
- SplitGGORequest
- RetireGGORequest
The first two are only for issuing bodies, and will be denied if tried.
To execute a request one must first import the ledger, batch and a request type
from origin_ledger_sdk import Ledger, Batch, TransferGGORequest
Transfer request
Next one can create a new TransferGGORequest, This request requires two keys as input. First key should be the private extended key that contains a GGO. Second should be the address where the GGO must be transferred to.
Batch
After the request has been created, we must create a batch using a another key. And then the request is added to the batch. Multiple request can be added to the same batch. Which insures all or none of the transactions are executed.
batch = Batch(signer_key=key)
batch.add_request(request)
BEWARE - everything done in one batch can be seen by anyone as a single batch and therefore know they have been performed by the same entity. So one should be careful about what one bundles in a single batch.
Executing a batch
Last thing to do is to send the batch to the ledger. Create an instance of the Ledger with the url to the public endpoint Everything on the ledger is asynchronous, so a handle is returned, on which a user can request the status of the batch.
ledger = Ledger('https://url-to-ledger')
# Send the batch to the ledger to execute.
handle = ledger.execute_batch(batch)
# Request status of the batch.
status = ledger.get_batch_status(handle)
Source code
Make sure to upgrade your system packages for good measure:
pip install --upgrade --user setuptools pip pipenv
Then install project dependencies:
pipenv install
To run the tests:
pipenv run pytest
Push to pypi
python3 setup.py bdist_wheel
python3 -m twine upload dist/* --repository project_origin
Metadata
Release files for Origin-Ledger-SDK 1.0.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Origin_Ledger_SDK-1.0.20-py3-none-any.whl | Python 3 | none | any | Details for Origin_Ledger_SDK-1.0.20-py3-none-any.whl |
Release files / Origin_Ledger_SDK-1.0.20-py3-none-any.whl
| Download URL | Origin_Ledger_SDK-1.0.20-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fa127edcdd472e091b12806639305159fa50780cc658e1eee07a8455c8b0578
|
|
BLAKE2b-256 checksum How to use checksums |
3ab1f7616f6e6567c53740cc57ac6e34e0b9d5de3a3b15ba6ea75efa7588dff2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
|
Security for Origin-Ledger-SDK 1.0.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.