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.

Download files

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

Source Distribution

nano_rspow_python-0.17.0.tar.gz (55.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nano_rspow_python-0.17.0-cp39-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

nano_rspow_python-0.17.0-cp39-abi3-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

nano_rspow_python-0.17.0-cp39-abi3-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file nano_rspow_python-0.17.0.tar.gz.

File metadata

  • Download URL: nano_rspow_python-0.17.0.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for nano_rspow_python-0.17.0.tar.gz
Algorithm Hash digest
SHA256 298dd9902848d4d20dde2b9227ef658c65ddd095205f06afec38a2a849a1da14
MD5 a89a05e3ad008c434f0f450fc6e3aed9
BLAKE2b-256 50809726c3f58908fae5104564346018b909408c8b16161aaba160ea8e4a16dc

See more details on using hashes here.

File details

Details for the file nano_rspow_python-0.17.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nano_rspow_python-0.17.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9ff0c291492a378847d4b6ac15322bb76f94ed5a4e5e1e7f67dfb143e1fce014
MD5 0568e8a987eacc2af4bb3f93ad48af65
BLAKE2b-256 c1286afb2fb2b4477206c346013ec67a7efb2e32d9bd2730f4484aac0d034ff6

See more details on using hashes here.

File details

Details for the file nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b94a878348c6c8ca281ae46c68317eaf915d967be3379d8e277f05ba4ff663b1
MD5 6ed9eae91421a288d20f0594576e7bf5
BLAKE2b-256 7f23c7f8cad0cf28f6e4d9ab97f5e5f72cc5c2462bd1c3e836cd97719c6d00db

See more details on using hashes here.

File details

Details for the file nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nano_rspow_python-0.17.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b92f348f7409d56335414c03f2afbcdaf9480bb9c45ab6db9563b7014f0ae520
MD5 6d8cc8c9ad15d1ed2a4ceada66f942cf
BLAKE2b-256 9a4567fe4ebedf53f2ecd968515829a6d102204459aba6c8a0ade65801cfd250

See more details on using hashes here.

File details

Details for the file nano_rspow_python-0.17.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nano_rspow_python-0.17.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cc793de248970f25aebc8e10613ecab32ed42c9420a2cfa3ff3f8fdb516d227
MD5 ca18956ac510e62a939bc44ce9ebc987
BLAKE2b-256 210f9082d47acdebeab1724527cee485705a5738a21a3360e90ad891e37f371a

See more details on using hashes here.

File details

Details for the file nano_rspow_python-0.17.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nano_rspow_python-0.17.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 42462c25a93f41f9d987fc5d4aa30f68f80c88ffb44e5f146719bec5b6a996c6
MD5 43de5ae1bafcc8e05981a0f0265f54e2
BLAKE2b-256 db802835311f97e16b23ab1ce7673baa36d60ec19dd08dc1ddafb11aef101a10

See more details on using hashes here.

Release history Release notifications | RSS feed

0.17.1

6 files

This release

0.17.0 This release

6 files

0.16.0

6 files

0.13.1

6 files

0.13.0

6 files

0.12.1

6 files

0.12.0

6 files

0.11.3

6 files

0.11.2

6 files

0.11.1

6 files

0.11.0

6 files

0.10.0

6 files

0.9.0

6 files

0.8.0

6 files

0.7.0

6 files

0.6.0

6 files

0.5.14

6 files

0.5.13

6 files

0.5.12

6 files

0.5.11

6 files

0.5.10

6 files

0.5.7

6 files

0.5.0

6 files

0.2.5

6 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