skip to content
[readonly]

sha256d, Bitcoin-style double SHA-256 nonce grinding as a mesh GPU job program (multi-warp nodes), as PTX from C

sh
$ sexc add @ajax/mesh-prog-sha256d
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 03:26v/# 1 version
  • drwxr-xr-x-Oct 27 03:26files/# the files of 0.1.0
latest
0.1.0, published Oct 27 03:26 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-rt ^0.1.0, @ajax/mesh-rt-sim-mailbox ^0.1.0, @ajax/mesh-ref-sha256d ^0.1.0, @ajax/sha256-compress ^0.1.0, @ajax/mesh-check ^0.1.0
dependents
none yet
keywords
mesh alphaos gpu ptx program sha256 bitcoin
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/programs/sha256d
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-prog-sha256d
2
3Bitcoin-style double SHA-256 nonce grinding as a fleet job program: each chunk of 2^param nonces is a
4job item (OP_JOB) ground by a 16-warp node, 2 hashes a thread an iteration on the header's midstate,
5the node's best hash by block reductions, and every share recorded by a rescan when any thread saw a
6candidate. Configuration under a spin lock and a seqlock; a request window for headers, targets and
7status. View layout: `include/mesh/prog/sha256d.h`.
8
9- **Ported from:** alpha-rust-mesh `programs/sha256d/src/lib.rs`.
10- **Tests:** on the simulator against @ajax/mesh-ref-sha256d: the genesis header and its midstate, four
11  chunks at 8 zero bits (time rolled for one) with every share and the best hash equal to hashing each
12  nonce on the CPU, the genesis block's own nonce found as a share with Bitcoin's genesis hash, the
13  config ops, the request window (status, errors, a raw header), and a param out of range.
14- **Differences:** rotates and byte swaps are plain C (`clang` makes them `shf.r.wrap` and `prmt`);
15  rounds 16..48 stay a 2-trip loop (`#pragma clang loop`) as in the Rust.