1

I know I have to somehow implement this spec but other than that I'm not sure.

Any help/resources is appreciated.

1 Answer 1

1

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.

15
  • Thank you so much for your answer. I knew it was something to do with pack_nonce, I'm just not sure how exactly to implement utilizing the given Nicehash nonce byte, regardless, thank you for your answer!
    – PGBRULES
    Feb 2 at 21:36
  • @PGBRULES you would implement like: paste.debian.net/1229411
    – jtgrassie
    Feb 2 at 23:04
  • did that code work for you when you tested with any xmrig-proxy pool in nicehash mode? For me, once I changed the nonce on line 158 to just send the raw nonce instead of what was there before, I only got low difficulty share errors. I'm mining on a 9900K. Line before: 'nonce': binascii.hexlify(struct.pack('<I', nonce)).decode(), Line after: 'nonce': nonce,
    – PGBRULES
    Feb 3 at 0:19
  • Also had to change the nonce equals line to nonce = struct.unpack('I', bin[40:44])[0]
    – PGBRULES
    Feb 3 at 0:21
  • Which is what I just showed you in paste.debian.net/1229411
    – jtgrassie
    Feb 3 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.