Custom miner shares rejected by the pool as low difficulty
Hello,
I am trying to develop a custom miner mainly as a proof of concept and I am stuck at the stage when the miner submit a share of difficulty superior to the job difficulty. The miner rejects the shares as low difficulty and after a couple of submissions the miner is disconnected and suspended for 10 minutes
The issue is the same connecting to different ports of the pool and regardless of the submitted share difficulty which is sometimes much higher than the job's one. The miner hashrate is 40 H/s on a single thread and 190 H/s with 8 threads. The RandomX library has been compiled with no particular flags, the miner is written in C++ and connects to the pool via a custom javascript stratum. The miner does not appear in the workers list and I expect that to be due to the fact that no shares are accepted as valid by the pool.
// Build login payload using the wallet and the pool's configured password.
const payload = {
id: 1,
method: "login",
params: {
login: wallet,
pass: global.config.pool.password,
algo: ["rx/0"]
}
};
Difficulty Calculation:
We extract the effective share difficulty using the last 4 bytes of the hash (with toDiff32Last) and compare it against the job difficulty (also computed using the last 4 bytes of the target, swapped via toDiff32). A share is accepted only if the computed share difficulty is at least 115% of the job difficulty.
Share Submission:
The JSON submitted to the pool now includes the "login" field (populated with the wallet address) for proper authentication. The nonce is formatted as an 8-digit hex string, and the result hash is a 64-digit hex string in its native (big‑endian) order.
Nonce Management:
The nonce counter is reset on new jobs and incremented atomically.
cat ReceivedJobs.txt
[2025-02-25 22:03:38] New job received, job_id: 6324336, blob length: 77, target (dec): 3695575808, job diff: 20000 | Blob:
[2025-02-25 22:03:55] New job received, job_id: 63238176, blob length: 77, target (dec): 3695575808, job diff: 20000 | Blob:
[2025-02-25 22:04:25] New job received, job_id: 63241047, blob length: 77, target (dec): 3695575808, job diff: 20000 | Blob:
[2025-02-25 22:04:55] New job received, job_id: 63244007, blob length: 77, target (dec): 3695575808, job diff: 20000 | Blob:
cat ValidShares.txt
[2025-02-25 21:42:08] Share found: nonce: 5b000000, hash: 28a8e522f487bd1cf1b2269470c5fd76386a9476a435a372dcc716c200039798 | Computed share diff: 18244, job diff: 12910, delta: 5334
[2025-02-25 21:42:08] Share assessment result: VALID for nonce: 5b000000
[2025-02-25 21:43:17] Share found: nonce: 102e0000, hash: 5040fad612a27b4c988401b89f5b6eb8878234c89c6f60a450dea07c000277e5 | Computed share diff: 26550, job diff: 12910, delta: 13640
[2025-02-25 21:43:17] Share assessment result: VALID for nonce: 102e0000
[2025-02-25 21:43:35] Share found: nonce: 97380000, hash: 15eb836cbcbcd6dd3f709ab7ced5b0c5ea36d5f2cea42200a23f04140003e7d7 | Computed share diff: 16779, job diff: 12910, delta: 3869
[2025-02-25 21:43:35] Share assessment result: VALID for nonce: 97380000
cat error.log
[2025-02-25T21:04:56.481Z] Pool error for agent CPPMiner-1740517448186-9492: {"code":-1,"message":"Low difficulty share"}
[2025-02-25T21:05:51.854Z] Pool error for agent CPPMiner-1740517448186-9492: {"code":-1,"message":"Unauthenticated"}
[2025-02-25T21:06:05.882Z] Login rejected for agent CPPMiner-1740517448186-9492: New connections from this IP address are temporarily suspended from mining (10 minutes max)
[2025-02-25T21:06:05.882Z] Agent CPPMiner-1740517448186-9492 is suspended. Will not reconnect for 10 minutes.
Thanks for your help in advance
0 条评论