PNRW: Python Nanocurrency RPC Wrapper
PNRW is a Python Wrapper for the Nano RPC protocol.
PNRW supports Banano as well!
Installation
PNRW can be installed using PyPI
pip install pnrw
Looking to install from source code?
pip install .
Documentation
PNRW uses the same variable and function names as the RPC Protocol, this means that you can use the official documentation for this library.
(There are some differences, please check the difference guide below)
pnrw.Node
The node class handles all node connections.
import pnrw
node = pnrw.Node("nodeIp") # Create a new node instance
Arguments
ip (str): The node IP address
Optional arguments
port (int): The node's RPC port, default value is 7076
dontUseHTTPS (bool): Disables HTTPS, default value if False
headers (dict): Custom headers that are sent with each request, default value is "Default"
banano (bool): Ensures correct configuration when using PNRW for Banano, default is False
Examples
Starting code
import pnrw
node = pnrw.Node("mynano.ninja/api/node") # Create a new node instance
Starting code for Banano
import pnrw
node = pnrw.Node("kaliumapi.appditto.com/api", banano=True) # Create a new node instance
Getting basic node information
import pnrw
node = pnrw.Node("mynano.ninja/api/node") # Create a new node instance
print(node.block_count()) # Check node block count
print(node.version()["protocol_version"]) # Print protocol version of node
print(node.uptime()) # Print node uptime in seconds
Showing current account balance
import pnrw
node = pnrw.Node("mynano.ninja/api/node") # Create a new node instance
balance = node.account_balance("nano_396phmigwi883hk4x3teedtjk1ejskckmqe7xz3ymfnhe58p9o8gzmkygx91") # Get balance of an account
myBalance = node.rai_from_raw(balance["balance"]) # Convert from raw to Nano
print(f"I currently have {myBalance} Nano!")
Convert units
from pnrw import convert
print(convert.convert(123,"nano","knano")) # convert 123 Nano to kNano
print(convert.convert(456,"ban","banoshi")) # convert 456 Banano to banoshi
Differences from official commands
Node.sign
Official documentation: https://docs.nano.org/commands/rpc-protocol/#sign
Changed to: sign_private() & sign_acount() & sign_block_hash()
Changes
Use sign_private() when signing a block with a private key, sign_account() when signing a block with an account from wallet and sign_block_hash() when signing a block hash.
Donations
All donations and contributions are welcome! <3
Nano: nano_396phmigwi883hk4x3teedtjk1ejskckmqe7xz3ymfnhe58p9o8gzmkygx91
Banano: ban_1aws637mb3qnuf9j8swzufq3nj3fttuzkixbd817nmmhyms6a6kt1zyptq87
Metadata
Release files for pnrw 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pnrw-0.1.4.tar.gz | 21.6 kB | Without provenance | Details for pnrw-0.1.4.tar.gz |
Release files / pnrw-0.1.4.tar.gz
| Download URL | pnrw-0.1.4.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e67d528f9513311185ef87cb1a325a212d7a484d0a17a84a3d8094afd310f1ab
|
|
BLAKE2b-256 checksum How to use checksums |
cb88bd18d0474347e5f0c34ab85730b5877526d98db77b57a47461ef35fa39ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Security for pnrw 0.1.4
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.