We are building a mining pool for Decred and we've decided to target Gominer as our officially supported mining client, since it's the officially supported miner by the Decred Team.
I have found that Gominer has a very serious bug, which is causing duplicate work. Gominer is rolling through the ExtraNonce1, which should remain static for the duration of mining.
For background, when subscribing to a pool, the pool provides the miner with an extraNonce1, which must stay unique across miners. If this value is ever shared between miners, they are potentially calculating hashes for the exact same header, which is a waste of resources.
While building the pool, I found that Gominer submits the whole ExtraNonce (ExtraNonce1 + ExtraNonce2). Miners should typically just submit the ExtraNonce2, and let the pool provide its half of the ExtraNonce to verify the share. This keeps the pool from paying out for duplicate work.
Example
When subscribing to the pool, we provide the miner with the following ExtraNonce1
ExtraNonce1: (string) (len=8) "00000066"
Along with some other pieces, this results in this header for work. I've added brackets around the ExtraNonce1. 0500000049887819145bee46129d22d91b38ffbdadf0a35ab0662a09070000000000000030afe9c20d79d9f1ab7d01e94e51076a6ca0f0631d1fa21a751069842da36bc56591cfb88c0d35997acf5fb191dfaef0b89b76870449b48b77991ce377ebe67e010007e222f07242050007003da00000fecc001a7d2a25bf010000007add0200c3240000ac2f125a00000000[00000066]0000000000000000000000000000000000000000000000000000000005000000000000000000000000000000
Gominer then starts rolling through nonces. We get to a solution:
Found candidate 1 nonce 0003eef5, extraNonce 44430002, workID 01000000, timestamp ac2f125a
Which results in the following header:
0500000049887819145bee46129d22d91b38ffbdadf0a35ab0662a09070000000000000030afe9c20d79d9f1ab7d01e94e51076a6ca0f0631d1fa21a751069842da36bc56591cfb88c0d35997acf5fb191dfaef0b89b76870449b48b77991ce377ebe67e010007e222f07242050007003da00000fecc001a7d2a25bf010000007add0200c3240000ac2f125a0003eef5444300020100000000000000000000000000000000000000000000000000000005000000000000000000000000000000
ExtraNonce1 has been overridden and this miner is now calculating the same hash that every other Gominer is calculating.
The miner then submits these values in it's mining.submit:
Submitting xNonce: 444300020100000000000000. nonce: f5ee0300
We are building a mining pool for Decred and we've decided to target Gominer as our officially supported mining client, since it's the officially supported miner by the Decred Team.
I have found that Gominer has a very serious bug, which is causing duplicate work. Gominer is rolling through the ExtraNonce1, which should remain static for the duration of mining.
For background, when subscribing to a pool, the pool provides the miner with an
extraNonce1
, which must stay unique across miners. If this value is ever shared between miners, they are potentially calculating hashes for the exact same header, which is a waste of resources.While building the pool, I found that Gominer submits the whole ExtraNonce (ExtraNonce1 + ExtraNonce2). Miners should typically just submit the ExtraNonce2, and let the pool provide its half of the ExtraNonce to verify the share. This keeps the pool from paying out for duplicate work.
Example
When subscribing to the pool, we provide the miner with the following ExtraNonce1
ExtraNonce1: (string) (len=8) "00000066"
Along with some other pieces, this results in this header for work. I've added brackets around the ExtraNonce1.
0500000049887819145bee46129d22d91b38ffbdadf0a35ab0662a09070000000000000030afe9c20d79d9f1ab7d01e94e51076a6ca0f0631d1fa21a751069842da36bc56591cfb88c0d35997acf5fb191dfaef0b89b76870449b48b77991ce377ebe67e010007e222f07242050007003da00000fecc001a7d2a25bf010000007add0200c3240000ac2f125a00000000[00000066]0000000000000000000000000000000000000000000000000000000005000000000000000000000000000000
Gominer then starts rolling through nonces. We get to a solution:
Found candidate 1 nonce 0003eef5, extraNonce 44430002, workID 01000000, timestamp ac2f125a
Which results in the following header:
0500000049887819145bee46129d22d91b38ffbdadf0a35ab0662a09070000000000000030afe9c20d79d9f1ab7d01e94e51076a6ca0f0631d1fa21a751069842da36bc56591cfb88c0d35997acf5fb191dfaef0b89b76870449b48b77991ce377ebe67e010007e222f07242050007003da00000fecc001a7d2a25bf010000007add0200c3240000ac2f125a0003eef5444300020100000000000000000000000000000000000000000000000000000005000000000000000000000000000000
ExtraNonce1 has been overridden and this miner is now calculating the same hash that every other Gominer is calculating.
The miner then submits these values in it's
mining.submit
:Submitting xNonce: 444300020100000000000000. nonce: f5ee0300
We can see again that the ExtraNonce1 is gone.