dummy_header = ( "01000000" + # version "0000000000000000000000000000000000000000000000000000000000000000" + # prev hash "3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a" + # merkle root (coinbase) "29ab5f49" + # timestamp (2017-ish) "ffff001d" + # bits (very low difficulty) "00000000" # nonce (zero) )
__kernel void mine(__global const uint *fixed_block, // first 14 words (448 bits) __global uint *results, // nonce, hash0, hash1 (or zeros) const uint start_nonce, const uint target_high) // target for hash[0] (MSW)
""" Helper: prepare block header (Bitcoin-style, 80 bytes) ------------------------------ def make_block_header(version, prev_hash, merkle_root, timestamp, bits, nonce=0): """Pack 80-byte Bitcoin block header (little-endian for each field except nonce)""" header = (pack("<I", version) + pack("<32s", bytes.fromhex(prev_hash)[::-1]) + pack("<32s", bytes.fromhex(merkle_root)[::-1]) + pack("<I", timestamp) + pack("<I", bits) + pack("<I", nonce)) return header