pyrchain
Interface to RChain RNode RPC.
Usage
Pyrchain is Python 3 library for interfacing with RChain RNode gRPC API. The library is distributed via PyPI (https://pypi.org/project/pyrchain/). You can install it for current user by running:
pip3 install --user pyrchain
See setup.py for information about 3rd party library dependencies.
The following snippet shows example usage of the API the library provides. It
assumes that you have access to a running RNode instance on localhost with
gRPC service listening on TCP port 40401 (default).
import grpc
from rchain.crypto import PrivateKey
from rchain.client import RClient
from rchain.vault import VaultAPI
admin_key = PrivateKey.generate()
alice_key = PrivateKey.generate()
with grpc.insecure_channel('localhost:40401') as channel:
client = RClient(channel)
admin_vault_api = VaultAPI(client, admin_key)
alice_vault_api = VaultAPI(client, alice_key)
admin_vault_api.create_genesis_vault(None, 100_000)
admin_vault_api.transfer(None, alice_key.get_public_key().get_address(), 1000)
assert alice_vault_api.get_balance() == 1000
See ./examples/vaults.py for complete example of vault API usage. See
rchain.client.RClient class for available RPC API.
To run the example from this Git repository run:
pipenv install
pipenv run python examples/vaults.py
Development
To update protocol buffers from upstream run:
./update-protobufs
./update-generated
This first command will fetch latest RChain *.proto files from dev branch
into ./protobuf directory. The second command will generate gRPC Python code
corresponding to the protcol buffers into rchain.pb package (./rchain/pb).
To run unit tests run:
pipenv run python -m unittest rchain/*_test.py
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrchain-0.1.3.tar.gz.
File metadata
- Download URL: pyrchain-0.1.3.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b15e5764ce5c86a8aecb3edc853c9041818595599f91ddc7ab5843062950d49
|
|
| MD5 |
c6dd5ea03f987f9d1d1af8bedf233f56
|
|
| BLAKE2b-256 |
2605d58e2562406eb8e13acc1728d9f909afe616bf8c27b3cc9ebfccc6e87471
|
File details
Details for the file pyrchain-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pyrchain-0.1.3-py3-none-any.whl
- Upload date:
- Size: 54.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c30b49e4915e45c90e47c713e779c7b3f9ff7728d6096af577b5f993da75c57
|
|
| MD5 |
6752f8f89c1ecbc919fcb8d937302ef8
|
|
| BLAKE2b-256 |
4410c0672056f82a7922a4248c31d145e309867fd914588004c1820a28098a88
|