Skip to main content

Native SHA3-256 PoW nonce scanner for the Animica CPU miner

Project description

animica-fastpow

Native SHA3-256 proof-of-work nonce scanner for the Animica CPU miner.

The Animica CPU miner's hot loop is otherwise pure Python, which caps multi-core hashrate (the per-nonce Python overhead dominates). This package runs the loop in C with the GIL released, so each miner worker gets native hashrate.

import animica_fastpow as fp
assert fp.available()

# digest = SHA3-256(prefix || mix_seed || nonce.to_bytes(8, "little"))
# returns the first (nonce, digest) with int(digest, "big") <= target, else None
res = fp.scan(prefix, mix_seed, target_32_be, start_nonce, iterations)

The miner (animica.animica_cpu_miner_repoexact) imports this automatically and falls back to its pure-Python loop if the extension isn't installed — so it's an optional accelerator, never a hard requirement.

Install

pip install animica-fastpow         # prebuilt wheel (Linux/macOS/Windows)
pip install "animica[fast]"          # via the animica miner extra

From source (needs a C compiler — gcc/clang, or MSVC Build Tools on Windows):

pip install ./mining/native

Correctness

The C SHA3-256 is the public-domain tiny_sha3 (NIST SHA3, 0x06 padding) and is verified at build/test time to be byte-identical to Python's hashlib.sha3_256 and to the miner's digest_from_sign_bytes. A wrong hash would get every share rejected, so parity is checked, not assumed.

Performance

The self-contained keccak is portable (no OpenSSL dependency, so it ships as a single .pyd/.so with no external DLLs). A follow-up AVX2 4-way batched keccak is the path to a further ~4× per core.

Project details


Download files

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

Source Distribution

animica_fastpow-1.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

animica_fastpow-1.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl (22.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.5+ x86-64

File details

Details for the file animica_fastpow-1.0.0.tar.gz.

File metadata

  • Download URL: animica_fastpow-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for animica_fastpow-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fe32b6a6b0642de3894eb15e748d7c2b15ef6f62da409090d680ead3f8715461
MD5 b194aa229da452544034d320ea39acb1
BLAKE2b-256 86bc4cc0247200e15d1b90dd1b6adf9a1ef14a9b8cf1687e9114fab700be528a

See more details on using hashes here.

File details

Details for the file animica_fastpow-1.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for animica_fastpow-1.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 f8df44934f645b9c1cbbe4207a2a74cf3f9a06fe9a3ef4b5ffdbaf2262a43f90
MD5 156a29a55801f433e0b051ece36614f7
BLAKE2b-256 c12f6f7969f2d4ef3118014d9267fa7037ce77e59d37f324dd7449111a91c16b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page