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.4.tar.gz (35.0 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.4-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrchain-0.1.4.tar.gz
  • Upload date:
  • Size: 35.0 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.4.tar.gz
Algorithm Hash digest
SHA256 c92a51b4af175557bce22a8646789242b3b764870823506fafc75fe1d51f554e
MD5 ce146aa6aa9d7871ef24d5ebebe38f6a
BLAKE2b-256 34056248156d3d5486d46a7710ef7199157e00aa59dbb1c029922e473162c238

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyrchain-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 901e98376658d703a690a5f1d776f3f69e64253f701c9e3d6e75abfb07199259
MD5 49b97f69ba86a1630c6617015c98acbc
BLAKE2b-256 331eeec3892fe36111ef3a1bf2801f7f95e06390e0e02713a808cf4dbe698be3

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

0.1.5

2 files

This release

0.1.4 This release

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