2

For educational purposes I wrote a program which performs the Cryptonight hash on some input. I verified my results using this "online-hasher" https://xmr.llcoins.net/slowhash.html .

Since I had some fun with this project I wanted to go one step further and try to let my program connect to a pool and do some work there. From the pool I get "id", "blob", "job_id" and "target". My superior packet-inspection skills suggest that the pool wants a "nonce" and a "result". However, I fail to fully understand how exactly these values are calculated.

I appreciate any help.

2 Answers 2

1

The nonce is a 32 bit counter in the hashed data, situated at offset 39. The miner will increment that nonce until the hash of the resulting data is less than the requested target (from a pool, that target will be well below the network difficulty). In the miner's reply to the pool, the nonce is the value which leads to a hash below target.

The result is the hash of the original data, modified by the nonce. While you'd expect this is redundant, since the pool can calculate the hash given the initial data and the nonce returned by the miner, pools typically only check some of the results miners supply, for efficiency reasons. Thus, sometimes the pool checks the claimed hash corresponds to the claimed result, and sometimes not.

1
0

The nonce is, well, the nonce. It's just a field in the block header which lets you change a bit of data to get a different resulting hash.

I would assume that the "result" means the resulting hash.

Now, I'm not sure but the "blob" is probably the block header data. A miner would then add his "nonce" somewhere into the blob and hash the entire thing. If the resulting hash is bigger than difficulty, it should be accepted when you send it back to the pool. Change the nonce to get a different hash until you get a "winning" hash.

As I'm not 100% with the exact details, I'm hoping that someone will give you a better answer but in the meantime this should give you an idea where to look and what to expect.

1
  • Thank you very much for the general idea. I'am searching for information what exactly needs to get calculated. The miner source codes are often heavily optimized and hard to understand.
    – notgiven
    Commented Sep 22, 2017 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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