Skip to main content

Python wrapper for Chia blockchain node APIs

Project description

About

Python-chianode is a Python wrapper for Chia blockchain full node APIs.

The package supports the official RPC API for Chia nodes running on localhost, as well as the Mojonode API. Calls are made asynchronously, and it is possible to receive streaming responses.

Mojonode provides advanced REST calls not available via the official RPC interface, blockchain data via SQL query, and an event stream for blockchain and mempool events. Note that Mojonode does not implement all official RPCs. The get_routes endpoint returns a list of available endpoints.

Installation

To install python-chianode, run

pip install python-chianode

Quick start

Import and instantiate the Chia node client in your Python file as follows

from chianode.mojoclient import MojoClient

node = MojoClient()

By default, both MojoClient and RpcClient connect to Mojonode. To connect to a local node only, do

from chianode.rpcclient import RpcClient
from chianode.constants import LOCALHOST

node = RpcClient(base_url=LOCALHOST)

To use Mojonode in conjunction with a local node, do

from chianode.mojoclient import MojoClient
from chianode.constants import LOCALHOST

node = MojoClient(base_url=LOCALHOST)

More detailed examples on how to use the wrapper can be found in example_rpc.py and example_events.py files.

Project details


Download files

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

Source Distribution

python_chianode-0.1.1.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

python_chianode-0.1.1-py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page