Skip to main content

RaiBlocks Python RPC client for rai_node

Project description Documentation Status

This library contains a python wrapper for the RaiBlocks RPC server which tries to make it a little easier to work with by converting RPC responses to native python ones and exposing a pythonic api for making RPC calls.

Also included are utilities such as converting rai/xrb and interesting accounts


pip install raiblocks

RPC client

You can browse the available RPC methods list or check the RPC Client API documentation for examples of usage.


The RPC client DOES NOT handle timeouts or retries automatically since this could lead to unwanted retries of requests causing double spends. Keep this in mind when implementing retries.

>>> from raiblocks import RPCClient
>>> rpc = RPCClient('http://localhost:7076')
>>> rpc.version()
    'rpc_version': 1,
    'store_version': 10,
    'node_vendor': 'RaiBlocks 9.0'
>>> rpc.peers()
    '[::ffff:]:7075': 4,
    '[::ffff:]:1032': 4


>>> from raiblocks import convert
>>> convert(12, from_unit='XRB', to_unit='raw')

>>> convert(0.4, from_unit='krai', to_unit='XRB')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: float values can lead to unexpected
precision loss, please use a Decimal or string
eg. convert('0.4', 'krai', 'XRB')

>>> convert('0.4', from_unit='krai', to_unit='XRB')

Known Accounts / Constants

>>> from raiblocks import GENESIS_BLOCK_HASH
>>> from raiblocks import KNOWN_ACCOUNT_IDS
>>> KNOWN_ACCOUNT_IDS['xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est']
'Developer Fund'
>>> from raiblocks import KNOWN_ACCOUNT_NAMES



virtualenv venv
source venv/bin/activate
pip install -r requirements.pip -r requirements-dev.pip
python develop

Running tests

# regular

# coverage

Building docs

cd docs

# generate once
make html

# live building
make live

Making a release

  • Update CHANGELOG.rst
  • bumpversion [major|minor|patch]
  • python upload

Download files

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

Files for raiblocks, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size raiblocks-1.1.0-py2.py3-none-any.whl (24.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size raiblocks-1.1.0.tar.gz (23.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page