ResistancePlatform / resistance-miner

Resistance Miner
Other
13 stars 7 forks source link

Randomize the nonce #1

Open solardiz opened 5 years ago

solardiz commented 5 years ago

cpuminer's 32-bit nonces start in a deterministic range that depends on thread number and count. This leaks thread count into the blockchain on successfully mined blocks, and may result in multiple miners doing duplicate work unnecessarily likely (if the block template is also the same, which depends on the server).

We may want to randomize these values e.g. by adding a random number to all threads' ranges.

Further, we may want to randomize the rest of our 256-bit nonce (we inherited this nonce size increase from Zcash).

solardiz commented 5 years ago

We're now randomizing the 256-bit nonces except for the 32-bit portion that cpuminer used before. So this issue is half-done: we do provide sufficient randomization, but we don't yet prevent the leak of thread count and the miner's effort (how many hashes the thread computed before it found the block).