1

I have a XMR proxy and check results with the job target before sending it to real pool. If I use mining software with the cryptonight-lite algorithm, my proxy accepts these hashes. Please help me to write function to validate results, so that it accepts only Cryptonight results and rejects Cryptonight-lite results.

In current time I use this function (JavaScript):

function checkResult(result, target) {
    var targetDiff = parseInt(parseInt(target.length > 8 ? 'FFFFFFFFFFFFFFFF' : 'FFFFFFFF', 16) / parseInt(target.split(/(.{2})/).reverse().join(''), 16));
    var resultDiff = parseInt(parseInt('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16) / parseInt(result.split(/(.{2})/).reverse().join(''), 16));
    return resultDiff >= targetDiff;
}

It accepts Cryptonight and Cryptonight-lite hashes for XMR mining. I need this function to accept only Cryptonight hashes. Please help me to change this function. It seems I need other parameters besides target and result hash?

2 Answers 2

2

To accept only a specific hash type at the proxy is pretty simple.

The miner is returning a hash and nonce for the job that was given to it. Therefore, at the proxy, you just set the nonce in the job blob, hash it (with the algorithm you are interested in), then compare the result hash to what the miner submitted. If they match, it's a hash for the algorithm you wanted.

0

Doing so is not possible, since Cryptonight and Cryptonight-lite use the same system for determining whether a hash meets target or not. You can'r tell whether a hash came from hashing with Cryptonight or from hashing with Cryptonight-lite. Being able to tell would mean the hash is broken.

If you want to tell between the hashes, you will have to work upstream, at the hashing code level, not at the difficulty comparison function level.

Note that in practice, most Cryptonight-lite shares will fail as a Cryptonight share, since an arbitrary hash made with Cryptonight-light is very unlikely to meet target for Cryptonight. However, your question implies you want to detect the cases where it does.

1
  • Thanks. Is very sadly. My question implies to reject Cryptonight-lite miners from my XMR proxy.
    – PDZ
    Commented Mar 3, 2018 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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