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.17.2

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.17.2
File Size Uploaded
nano_rspow_python-0.17.2.tar.gz 56.5 kB Details

Built distributions (wheels)

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

Total release size: 12.4 MB

Release files / nano_rspow_python-0.17.2.tar.gz

Download URL nano_rspow_python-0.17.2.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4517a2fca651f6116aa71c042ce9ee6ac3d0578495028d28d45f6abb985f04fc
BLAKE2b-256 checksum
How to use checksums
640d37c17f3e90906cd754ce396d2ce730681428dea52857bf7bbde3e374eddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

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

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

Download URL nano_rspow_python-0.17.2-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
c6ee54917d7681ee286a1549e9eebd18fc5683eb084be7eae817852bab48d314
BLAKE2b-256 checksum
How to use checksums
69a9bb302cc76cca682870facc25806843ab5404ff09231f775f6d0c3899f28b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL nano_rspow_python-0.17.2-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
f6dd5458c633498b20acc8de7bd11679bdfd50153db25754fb9d2c677bea8465
BLAKE2b-256 checksum
How to use checksums
46d071c3b1455c43ff25c965556eff2f7b4e08c7cee7a17edda5a366e07e3f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL nano_rspow_python-0.17.2-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
787b9a22ccd03dae2b683ce2e029a1a075f2833574dce78cb5d8b6c50e0f7d24
BLAKE2b-256 checksum
How to use checksums
4747f3e01632380832ce4447ebd9a8f57923191595332ead0c2da7e33db52105
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL nano_rspow_python-0.17.2-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
3db6e4d02ed5f0a181083df5031ab801489d678c1868694f25361ec27b3d8774
BLAKE2b-256 checksum
How to use checksums
c60ca229673a60eb31de9b81c81f8750a1eeebeb2c77c3f99cec791992a3bc61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

0.17.2 This release

6 release files

0.17.1

6 release files

0.17.0

6 release files

0.16.0

6 release files

0.13.1

6 release files

0.13.0

6 release files

0.12.1

6 release files

0.12.0

6 release files

0.11.3

6 release files

0.11.2

6 release files

0.11.1

6 release files

0.11.0

6 release files

0.10.0

6 release files

0.9.0

6 release files

0.8.0

6 release files

0.7.0

6 release files

0.6.0

6 release files

0.5.14

6 release files

0.5.13

6 release files

0.5.12

6 release files

0.5.11

6 release files

0.5.10

6 release files

0.5.7

6 release files

0.5.0

6 release files

0.2.5

6 release files

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