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.1.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.1-cp39-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

nano_rspow_python-0.17.1-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.1-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.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: nano_rspow_python-0.17.1.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.1.tar.gz
Algorithm Hash digest
SHA256 17a3558088e5821dd7016ccc76cbff48be978b971a22b5c9ffe8147a7fa5b2c9
MD5 cca136205c68021c4d638c96def1bc19
BLAKE2b-256 ff3799bdf8e25b5e32aebd64240b408bcfa66d4fea38ec35d1b974db8953224d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_rspow_python-0.17.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 18f43093a03e1f04aa2b626a0d7379749f75b799f3bd380b4e07a44bd5701de5
MD5 2373cb2cea9c6bd8f3e83689d379adc2
BLAKE2b-256 fd57f9e59f1ea7866ca12027ac7d9a8158a52596ba59f71e813675515b33de01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_rspow_python-0.17.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51fdfaad1d6235668bb299302bfb7cca39ad6dad82f74d5b686fc7b7cb2c0fcc
MD5 7329f5b901cd5ff454a7bafb403ccc80
BLAKE2b-256 4e2b312379606efa7f1187aeb776afc0e36cd04d33d667515a46c1b3486e7c2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_rspow_python-0.17.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d87f8774098744589b4e20ff2500f8d3975bf434f86a5b8fa0ffc838933bce20
MD5 d7d745575fa349551337f898b4688f32
BLAKE2b-256 c508beae7af7cf54125b5512282b4b99065935e0594095190d2c92b7f80e2a0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_rspow_python-0.17.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 939b94622f94148f5573477f6d9e2142f97d458e5e25ecf20a70df5ad18324bc
MD5 9604063af7eb8634888ce45179182d6b
BLAKE2b-256 5bf2e0703bb2d81f21292cc2fe83f7ad0754c9ffbab4bf9da520b8bc1d29954d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_rspow_python-0.17.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d640abcf1d393ee5bced8441c1f650729a6c93b5e14e6458500c90ff09d502c
MD5 7f0cc2cb8cd4d30c2c78b62c4b94021d
BLAKE2b-256 525ecd98f845648eeeb8676d04372f85851d48cf9c6cde31aece7ff80afe27d8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.17.1 This release

6 files

0.17.0

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