I know I have to somehow implement this spec but other than that I'm not sure.
Any help/resources is appreciated.
You'd modify def pack_nonce to account for the Nicehash nonce byte. I.e. only pack 3 bytes.
E.g.
diff --git a/stratum-miner.py b/stratum-miner.py
index 486e877..ec3ae5f 100644
--- a/stratum-miner.py
+++ b/stratum-miner.py
@@ -99,8 +99,8 @@ def main():
def pack_nonce(blob, nonce):
b = binascii.unhexlify(blob)
bin = struct.pack('39B', *bytearray(b[:39]))
- bin += struct.pack('I', nonce)
- bin += struct.pack('{}B'.format(len(b)-43), *bytearray(b[43:]))
+ bin += struct.pack('I', nonce & 0x00ffffff)[:3]
+ bin += struct.pack('{}B'.format(len(b)-42), *bytearray(b[42:]))
return bin
@@ -146,6 +146,7 @@ def worker(q, s):
elapsed = time.time() - started
hr = int(hash_count / elapsed)
print('{}Hashrate: {} H/s'.format(os.linesep, hr))
nonce = struct.unpack('I', bin[39:43])[0]
submit = {
'method':'submit',
'params': {
Or simply using the latest version with the --nicehash flag.