Find out how to convert problem from `mining.set_difficulty` message for Litecoin?

0
15


I am making an attempt to find out tips on how to correctly convert problem from a mining.set_difficulty message to focus on for Litecoin, just like the way it’s finished for Bitcoin.

For Bitcoin, the method I exploit is as follows:

  1. I begin with the genesis nbits worth: 0x1d00ffff
  2. I convert this to the max goal:
    0x00000000ffff0000000000000000000000000000000000000000000000000000
    
  3. Then, I calculate the goal utilizing this method:
    goal = max_target / problem
    

    For instance, with an issue of 524288, the goal turns into:

    goal = max_target / 524288 = 0x0000000000001fffe00000000000000000000000000000000000000000000000
    

Now, I am making an attempt to use an identical algorithm to Litecoin. Here is what I’ve up to now:

  1. The genesis nbits for Litecoin is 0x1e0ffff0
  2. I convert this to the identical max goal as in Bitcoin:
    0x00000ffff0000000000000000000000000000000000000000000000000000000
    
  3. I exploit the method max_target / 524288, which ends up in the identical goal as in Bitcoin:
    goal = 0x0000000001fffe00000000000000000000000000000000000000000000000000
    

Nonetheless, once I carry out this calculation and examine it with the shares I obtain on the pool facet, I discover that shares have a better goal, corresponding to:

0x0000000005713013fcbf8bf0dcc329a5f56b856c2dbe64603e34b47169eaaa50 (pow)
>
0x0000000001fffe00000000000000000000000000000000000000000000000000 (goal)

Upon additional investigation, I discovered this code snippet, which introduces a coefficient of 65535:

if (opt_algo == ALGO_SCRYPT)
    diff_to_target(work->goal, sctx->job.diff / 65536.0);
else
    diff_to_target(work->goal, sctx->job.diff);

This means that the goal for Litecoin must be multiplied by 65535. My query is:

  • Ought to the goal be scaled by 65535 in the identical manner?
  • Why is that this adjustment mandatory for Scrypt (Litecoin) however not for Bitcoin?
  • How do I accurately calculate the goal for Litecoin to keep away from getting shares greater than the calculated goal?

Any steering on this may be appreciated!

LEAVE A REPLY

Please enter your comment!
Please enter your name here