Skip to main content

nano-rspow-python

Native Nano (XNO) proof-of-work bindings for Python. The extension selects an available GPU backend when possible and otherwise uses the CPU backend. generate_work releases the Python GIL while it searches.

Install

pip install nano-rspow-python

The package also installs a minimal streaming executable named nano-rspow-python. It accepts no options except --help and uses the same line protocol as nano-rspow generate --stream:

<hash_hex>[:0x<threshold_hex>]
<hash_hex>:0x<threshold_hex>:<work_hex>

nano-rspow remains the full-featured CLI provided by the Rust nano-rspow-cli crate; this Python package intentionally exposes only the nano-rspow-python entrypoint.

Usage

import nano_rspow
from nano_rspow import WorkType
from nano_rspow.thresholds import current

root = "718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2"
result = nano_rspow.generate_work(root, WorkType.Send)

print(result.nonce_hex)
assert result.is_valid
assert nano_rspow.validate_work(root, result.nonce_hex, WorkType.Send)
assert current.SEND == 0xfffffff800000000

# Use an arbitrary threshold when a node requires more than the public floor.
threshold = "fffffff900000000"
result = nano_rspow.generate_work_with_threshold(root, threshold)
assert nano_rspow.validate_work_with_threshold(root, result.nonce_hex, threshold)

API reference

generate_work(hash_hex, work_type) -> WorkResult

Generates work for a 32-byte hexadecimal block root. Raises ValueError for invalid hexadecimal input or a root that is not 32 bytes. Raises RuntimeError if generation does not return a result.

validate_work(hash_hex, work_hex, work_type) -> bool

Tests a hexadecimal nonce against a block root and the threshold selected by work_type. Raises ValueError for invalid input.

generate_work_with_threshold(hash_hex, threshold_hex) -> WorkResult

Generates work for any hexadecimal threshold. Use it when a node requires a stricter threshold than the public Nano floor or when handling historical data.

validate_work_with_threshold(hash_hex, work_hex, threshold_hex) -> bool

Validates a nonce against any hexadecimal threshold.

compute_difficulty(hash_hex, nonce_hex) -> str

Returns the raw difficulty as a 16-character lowercase hexadecimal string. Raises ValueError for invalid input.

backend_name() -> str

Returns the selected backend name, such as cpu, wgpu, or opencl.

WorkType

Value Use
Send Current send and change blocks
Receive Current receive, open, and epoch blocks

WorkResult

generate_work returns a read-only result with nonce_hex, difficulty_hex, is_valid, and multiplier properties.

thresholds

The nano_rspow.thresholds submodule separates values by applicability:

  • thresholds.current.SEND and .RECEIVE are the current public mainnet floors.
  • thresholds.legacy.EPOCH1 and .BETA_EPOCH1 are historical values.
  • thresholds.testing.DEV is for tests only.

Nano nodes may require a stricter arbitrary threshold. Use the explicit custom-threshold APIs for that case. See Nano's Work Generation guide for current network requirements.

Metadata

Release files for nano-rspow-python 0.18.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 nano-rspow-python 0.18.0
File Size Uploaded Provenance Actions
nano_rspow_python-0.18.0.tar.gz 56.7 kB Without provenance Details for nano_rspow_python-0.18.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nano-rspow-python 0.18.0
File Actions
nano_rspow_python-0.18.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for nano_rspow_python-0.18.0-cp39-abi3-win_amd64.whl
nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
nano_rspow_python-0.18.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for nano_rspow_python-0.18.0-cp39-abi3-macosx_11_0_arm64.whl
nano_rspow_python-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for nano_rspow_python-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 12.4 MB

Release files / nano_rspow_python-0.18.0.tar.gz

Download URL nano_rspow_python-0.18.0.tar.gz
Size 56.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3ec6c7514a56d3fa8d44be527865fe04732a8427854418c1da065ad948d8a1cb
BLAKE2b-256 checksum
How to use checksums
c0d5248d985aaa300028f7c00240010e14e3844a5afa986dc68a8fac255fc06f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / nano_rspow_python-0.18.0-cp39-abi3-win_amd64.whl

Download URL nano_rspow_python-0.18.0-cp39-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
df8c0152efd28b4f4e3853e88ec0a0a024247d5be4f4a7f373ba9f25edd46dbf
BLAKE2b-256 checksum
How to use checksums
70d7ae39260ea5feb492ebdce4080cd1741940944d9c451cf9105a71f189705c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a28b966a330b30780eb85d4412bf5613b666c5efbeb6918b4eeef0fddd08d8b3
BLAKE2b-256 checksum
How to use checksums
170125ad357394846d69a96020e9b2403819564c5a52bc2e3e208eba13a228e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL nano_rspow_python-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.5 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
75fdf687fd8c887c9e532cf6cb6f311efeabd00c1d780e2a2e1c461c77c61277
BLAKE2b-256 checksum
How to use checksums
96400b800fb9ae7cc0e5bad32ac5ec166ff4638f36c58d5a0b7a0b77aae46825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / nano_rspow_python-0.18.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL nano_rspow_python-0.18.0-cp39-abi3-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
12d9ae975cc801d615977bcdf314cbe7f4993cab1042ab8a24dbddfc13c53c1b
BLAKE2b-256 checksum
How to use checksums
67f88b1986a156589baa00bc59a53770c13b6883a9058ee5d8c529d006d5fe5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / nano_rspow_python-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL nano_rspow_python-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.6 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
939b4df124737fce4d7453a968d9f072a510c2575f96bc9aa8a7c113dc32412f
BLAKE2b-256 checksum
How to use checksums
e6d04de0a534e8d583d8463050124639f2d5b85b877b17a57592e0623b4cfabf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Security for nano-rspow-python 0.18.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