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.2.0.tar.gz (42.8 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.2.0-py3-none-any.whl (79.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrchain-0.2.0.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5+

File hashes

Hashes for pyrchain-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0491e4c6b84f1e92e824bfdcc169786c9264e462277a385d309fa0c9983fe451
MD5 1be4e02b016b32d013168bc369597cac
BLAKE2b-256 a6d4d5080833cd045bf646f7a719235448592d6cb68e4c8938b16de582300b67

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyrchain-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 79.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5+

File hashes

Hashes for pyrchain-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f48522dd23e293240ebcc3f3c8035f0ee4e4f85973eb6c7b2273af5ef569a3b0
MD5 7739efb75f7b7606e55b212ed7d8cd1b
BLAKE2b-256 fb975eb883ed5032dc8ee182ef5af6856f8140ebbd01b9c1db6725f26b4f7e1b

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

This release

0.2.0 This release

2 files

0.1.6

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