I am making an attempt to find out easy methods to correctly convert problem from a mining.set_difficulty
message to focus on for Litecoin, much like the way it’s performed for Bitcoin.
For Bitcoin, the method I take advantage of is as follows:
- I begin with the genesis
nbits
worth:0x1d00ffff
- I convert this to the max goal:
0x00000000ffff0000000000000000000000000000000000000000000000000000
- Then, I calculate the goal utilizing this formulation:
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:
- The genesis
nbits
for Litecoin is0x1e0ffff0
- I convert this to the identical max goal as in Bitcoin:
0x00000000ffff0000000000000000000000000000000000000000000000000000
- I take advantage of the formulation
max_target / 524288
, which ends up in the identical goal as in Bitcoin:goal = 0x0000000000001fffe00000000000000000000000000000000000000000000000
Nonetheless, after I carry out this calculation and evaluate it with the shares I obtain on the pool aspect, I discover that some shares have a better goal, resembling:
0x0000000005713013fcbf8bf0dcc329a5f56b856c2dbe64603e34b47169eaaa50
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 needs to be multiplied by 65535. My query is:
- Ought to the goal be scaled by 65535 in the identical manner?
- Why is that this adjustment vital for Scrypt (Litecoin) however not for Bitcoin?
- How do I accurately calculate the goal for Litecoin to keep away from getting shares increased than the calculated goal?
Any steering on this could be appreciated!