2

I read that sometimes a pool will report a "Low difficulty share" error if the solution indeed did not match the specified difficulty but it could also be reported if someone had already found a nonce that hashed the block and you were too late submitting yours. So for example, my pool sent me

{"jsonrpc":"2.0","method":"job","params":{"blob":"0707eb98d1d8058f35da5374c2ce3a22dfe0b13517a1545230a15a9f64b28af3f8ad14f254f02900000000c25dab02b54a81ddb25b3874bfd361a3081057eb5e0c38d748373b620a89d0d314","job_id":"L0Nx52ZKaq878cIhlGEXRueUnJAl","target":"37894100","id":"242737ff-d36a-4a32-9886-cb7031d6e126"}}

I then submitted

{"type":"submit","params":{"job_id":"L0Nx52ZKaq878cIhlGEXRueUnJAl","nonce":"6e00d22b","result":"6146867498517f1a431aabf4a0ff3f5e8643b3051775ec0877cb1fc82a8f3900"}}

to which I got the response

{"id":"c018e089ab7e70a54232623d","jsonrpc":"2.0","error":{"code":-1,"message":"Low difficulty share"}}

I'm pretty bad with the calculations. How can I tell if my share (based on the information I've provided here) indeed didn't match the difficulty target or is it possible that someone else already submitted a nonce that hashed the block?

Dave
  • 277
  • 3
  • 9

1 Answers1

2

You can find the difficulty of a submitted hash (which is just a big endian hex encoded string) by dividing the base difficulty (2^256-1) by your hash.

As such, nodejs-pool (the most common pool software), checks your submitted hash difficulty as follows:

let hashArray = hash.toByteArray().reverse();
let hashNum = bignum.fromBuffer(new Buffer(hashArray));
let hashDiff = baseDiff.div(hashNum);

if (hashDiff.ge(blockTemplate.difficulty)) {
    // valid here against block, so mined a block
} else if (hashDiff.lt(job.difficulty)) {
    // invalid here (this is where you are failing the test)
} else {
    // valid, record share
}

Using your supplied hash and target (which is also BE encoded hex string) you would yield:

job.difficulty = 4294967
hashDiff = 472

Hence it is of low difficulty (thus an invalid, low difficulty, share).

jtgrassie
  • 19,601
  • 4
  • 17
  • 54