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.6.tar.gz (37.2 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.6-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrchain-0.1.6.tar.gz
  • Upload date:
  • Size: 37.2 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.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for pyrchain-0.1.6.tar.gz
Algorithm Hash digest
SHA256 49fa1cc1124a82bd295a760bc307a7227e6e933bd9d8a13cd7880ea6e465f61a
MD5 3c058d3e44ed9b0f82f2248c59387204
BLAKE2b-256 1890b47b81195d43784023dc0211180f80b1919ae17df76fe50f53523963e51b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyrchain-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 58.1 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.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for pyrchain-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5e9851c2889e546d0579c34592fc272266117df508c5a1ff8dfc9d80b5419f1e
MD5 0640fedb89c4731e12f492649bc37025
BLAKE2b-256 d60a7f8944a7fbf61f8cc93a58076c4fad276cf7a7d89631f124037192cb3793

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

This release

0.1.6 This release

2 files

0.1.5

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