python – Learn how to calculate the pool problem primarily based on mining.set_difficulty methodology from Stratum protocol?

0
54


I’m attempting to construct a easy python cpu miner and I’ve referenced just a few different github repos (for studying functions not for cash functions). I’ve seen that lots of them merely ignore the mining.set_difficulty methodology after they authorize. I do know that is the norm for a CPU miner as a CPU miner can solely deal with extraordinarily low difficulties.

Many of those python cpu miners are utilizing the block problem because the goal with a line of code that appears one thing like this: goal = (curr_block.pool_diff[2:] + '00' * (int(curr_block.pool_diff[:2], 16) - 3)).zfill(64)

after which checking to see in the event that they meet that concentrate on with this line:
if hash < goal: after hashing and earlier than submitting. I perceive that is less complicated for lottery mining on a cpu which is a fantasy of an endeavour (as CPU mining typically is I perceive)

However my query is that this, given this response: b'{"id":2,"consequence":true,"error":null}n{"id":null,"methodology":"mining.set_difficulty","params":[16384]} for my mining.authorize request from an precise pool how would I modify the goal variable to dynamically mine on the problem steered? Is that this 16384 quantity an element of what number of occasions the unique genesis block problem I must be mining and is it encoded in hex or one thing? How ought to I reformat the goal variable and account for this in my code?

Thanks to your endurance, I’m new to this and there are nonetheless a whole lot of issues I do not know or perceive.

LEAVE A REPLY

Please enter your comment!
Please enter your name here