Skip to main content

NanoRPC

NanoRPC is a Python library for interacting with Nano cryptocurrency nodes via their JSON-RPC API. It provides an easy-to-use interface to execute RPC (Remote Procedure Call) commands supported by different versions of Nano nodes.

Features

  • Compatible with Python 3.7 and higher.
  • Supports asynchronous operations using asyncio and aiohttp.
  • Automatically adjusts available RPC methods based on the version of the connected Nano node.
  • Provides a simple and intuitive API for executing RPC commands.

Requirements

  • Python 3.7 and higher
  • aiohttp library

Installation

You can install NanoRPC using pip:

pip install nanorpc

Usage

Here's a basic example of how to use NanoRPC to interact with a Nano node:

import asyncio
from nanorpc.client import NanoRpcTyped

async def main():
    # Connect to a Nano node
    rpc = NanoRpcTyped(url='http://localhost:7076')

    # Execute an RPC command
    block_count = await rpc.block_count()
    print(f"Current block count: {block_count}")

    # Execute another RPC command
    version_info = await rpc.version()
    print(f"Node version: {version_info}")

    #pass mandatory input as args* and optional as kwargs*
    account = "nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6"
    account_info = await rpc.account_info(account, include_confirmed="true", representative="true", receivable="true", weight="true")
    print(f"Account info: {account_info}")

# Run the main function within an asyncio event loop
asyncio.run(main())

Error Handling

NanoRPC includes several error handling mechanisms. If an RPC command fails or if a network issue is encountered, the library will retry the request for a specified number of times. If all retries are exhausted, the library will raise a MaxRetriesExceededError.

Available RPC Commands

NanoRPC provides access to various RPC commands based on the connected Nano node version. For a complete list of available commands and their parameters, please refer to the versions folder in this repository.

Official RPC Documentation

For detailed documentation on the Nano RPC protocol and available commands, please visit the Nano RPC Documentation page.

Contributing

Contributions to NanoRPC are welcome! If you find any issues, have suggestions, or would like to contribute enhancements or new features, please open an issue or submit a pull request.

License

NanoRPC is licensed under the MIT License. See the LICENSE file for more information.

Metadata

Release files for nanorpc 0.28.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanorpc 0.28.0
File Size Uploaded Provenance Actions
nanorpc-0.28.0.tar.gz 12.7 kB Without provenance Details for nanorpc-0.28.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanorpc 0.28.0
File Interpreter ABI Platform Actions
nanorpc-0.28.0-py3-none-any.whl Python 3 none any Details for nanorpc-0.28.0-py3-none-any.whl

Total release size: 27.3 kB

Release files / nanorpc-0.28.0.tar.gz

Download URL nanorpc-0.28.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
36054c7a4d0d5b3f37d2ca94d7a772af280e705e9c913c5d55212142761b14f8
BLAKE2b-256 checksum
How to use checksums
21124c22d8c41417b7e5fbbe1e5dcbe8223cde456a89f1c645fb36c8f25d0d24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / nanorpc-0.28.0-py3-none-any.whl

Download URL nanorpc-0.28.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7586988183c0a4626a2ab52ada5e5b4ea5ae3bcde69531485142bf95b1bdb367
BLAKE2b-256 checksum
How to use checksums
722d0477535169d23923806612a8b6e2573f96dfce928a0b1bff511300d1fb32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for nanorpc 0.28.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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