1

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?

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).

  • Hey a quick clarification on the base difficulty -- you listed it as (2^256-1), which would be "FFFFFFFFFFFFFFFF" in hex, is that right? The code you listed defines the base difficulty as "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" , which seems substantially greater. – Dave Jun 6 '18 at 16:26
  • format(2**256-1,'02X') 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' – jtgrassie Jun 6 '18 at 16:33
  • 2^256-1 is 32 bytes (64 characters) which is what is used in the code. Your calculation of 2^256-1 is incorrect. – jtgrassie Jun 6 '18 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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