I'm writing my own proxy pool implementation. I have problem with share verification.

I received a job from upsteam mining pool:

  "blob": "0c0ccdb490f2053f393023bdc102f7bf4c63be5c64569dc0b57ab94e9881fd66157995b679adc700000000767cb11fc62b2bde9fb8eae21058d99ad317482bfdbcc1956d766888dd4d475709",
  "job_id": "333",
  "target": "dc460300",
  "seed_hash": "154eb7a21cd32a597f985644187297607bad491650091620550877239c4178e1",
  "next_seed_hash": "",
  "height": 2032062

Sent this work to the miner. And miner submitted work with following result:

  'id': '1',
  'job_id': '333',
  'nonce': '38870000',
  'result': 'f54a858a87f0f5bc9f3e75fba670a11cfdaf87b650d4189f50601597c8650200'

I want verify if the solution is correct. I'm using python and pyrx. The steps that I take to complete the verification:

Insert share['nonce'] from miner into job['blob'] to 39...43 bytes:



Hash this blob:

In [24]: blob = '0c0ccdb490f2053f393023bdc102f7bf4c63be5c64569dc0b57ab94e9881fd66157995b679adc738870000767cb11fc62b2bde9fb8eae21058d99ad317482bfdbcc1956d766888dd4d475709'              

In [25]: hashing_blob = pyrx.get_rx_hash(blob, job['seed_hash'], job['height']).hex()                                                                                                         

But I got unequal results with share['result']. I am sure that the answer is correct. The original pool accepted this work. Where am i wrong?

In [37]: hashing_blob == share['result']                                                                                                                                                
Out[37]: False

In [38]: hashing_blob                                                                                                                                                                   
Out[38]: '4fa368b991c8320c9c2ad1b80566f67439e789b329e0c33119b072aa7f2782e9'

In [39]: share['result']                                                                                                                                                                
Out[39]: 'f54a858a87f0f5bc9f3e75fba670a11cfdaf87b650d4189f50601597c8650200'

1 Answer 1


You are trying to hash a hex string not binary data.

Working example:

import pyrx
import binascii
import struct

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:]))
    return bin

seed = binascii.unhexlify('154eb7a21cd32a597f985644187297607bad491650091620550877239c4178e1');
nonce = struct.unpack('I',binascii.unhexlify('38870000'))[0]
blob = "0c0ccdb490f2053f393023bdc102f7bf4c63be5c64569dc0b57ab94e9881fd66157995b679adc700000000767cb11fc62b2bde9fb8eae21058d99ad317482bfdbcc1956d766888dd4d475709"
bin = pack_nonce(blob, nonce)
height = 2032062
hash = binascii.hexlify( pyrx.get_rx_hash(bin, seed, height) )

Which results in: f54a858a87f0f5bc9f3e75fba670a11cfdaf87b650d4189f50601597c8650200

  • In my code I should use hashing_blob = pyrx.get_rx_hash(bytes.fromhex(blob), bytes.fromhex(job['seed_hash']), job['height']).hex() instead of hashing_blob = pyrx.get_rx_hash(blob, job['seed_hash'], job['height']).hex(). Thank you!
    – Andrei
    Feb 15, 2020 at 17:56
  • Can I ask you another question? How to check if my miner solution f54a858a87f0f5bc9f3e75fba670a11cfdaf87b650d4189f50601597c8650200corresponds to job's target dc460300?
    – Andrei
    Feb 15, 2020 at 18:29
  • 1
    See this Q/A and / or this code (which I put together based on the sheer amount of questions like this).
    – jtgrassie
    Feb 15, 2020 at 18:35

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.