Skip to main content

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

References

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrchain-0.1.5.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrchain-0.1.5-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file pyrchain-0.1.5.tar.gz.

File metadata

  • Download URL: pyrchain-0.1.5.tar.gz
  • Upload date:
  • Size: 34.9 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.28.1 CPython/3.7.3

File hashes

Hashes for pyrchain-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1072f33f14e26f70a98057dc79d43b3f298de0257d81ee00ed213dbc2e8738f7
MD5 60bba37dc266cc27df08f06f58d01be9
BLAKE2b-256 bc3e16208bb39b7eaf7821427f5001f1be6b1155cccc08bdf663134bb1ec04d3

See more details on using hashes here.

File details

Details for the file pyrchain-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyrchain-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 54.8 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.28.1 CPython/3.7.3

File hashes

Hashes for pyrchain-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e9fac03f15272f081ccd4ab1e0ccfc434453fbc7b3e303b2f1323c63e284d69
MD5 e75cfcd0edb45904a7a5ad5b021a847e
BLAKE2b-256 b3fdcdc503a9bca0c6f5b8ce29f41d5b8b19d770e9ba917105a7116337fdfbd6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.12

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.6

2 files

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page