In the PoW system you must test different nonce until you found an hash that is compatible with the current difficulty and the current dataset.

There are many miners that test many nonce at the same time.

My questions:

  1. there is a risk of duplicate work? And why? (Two different miners can eventually test the same nonce?)
  2. How nonce are selected in the most popular miner software (ex. genoil's)?

If you look at Genoil source code

    random_device engine;
    uint64_t start_nonce;
    if (_ethStratum) start_nonce = _startN;
    else start_nonce = uniform_int_distribution<uint64_t>()(engine);

In stratum mode (ie when connecting to a pool) the nonce is dictated by the pool, otherwise it is randomly generated.

Since the miner address is included in the block header as part of the proof of work. There's a very little chance that different miners will choose the same nonce.

  • Just a comment that, even if two miners test the same nonce, it does not really matter because the solution is not of any value. In that sense, all the computations that the miners perform to solve the Proof-of-Work puzzle are all just a waste of time, money and resources. The purpose is just to present a barrier to the block-creation process and prevent Sybil attacks. – Ajoy Bhatia Jul 5 '17 at 3:32
  • @AjoyBhatia I do not understand what is your point. In a PoW system it is an stochastic process most of the nonces will not generate a valid block. The important part is that the whole network has to work in order to secure the blockchain, so a malicious actor cannot alterate it by brute force without a huge investment in resources. – Ismael Jul 5 '17 at 4:20
  • And I do not understand how your comment goes against what I said. I agree with everything you say, but I can still maintain that it does not matter whether two or more miners test the same nonce. – Ajoy Bhatia Jul 5 '17 at 17:47
  • After thinking some more, I agree that including the miner's address in the block header will prevent different miners from choosing the same nonce. But, even if it was not, and one miner controlled a lot of different addresses and sent the same solution from all addresses, only one of the addresses' block submission would win the block reward and have the block included in the chain. This is a hypothetical discussion now, and not related to the question. We could continue in chat. – Ajoy Bhatia Jul 5 '17 at 17:54
  • Sorry, but I stil do not understand what is your point, and how it is relevant to the question asked, about what happen when two miner choose the same nonce, and how miner software select a nonce. – Ismael Jul 5 '17 at 17:54

the coin base (address of the receiver of coin on sucesfull hash) is part of a header that the miner will work on, so:

if solo mining, if each of tour miners connected directly to node and pass own coin base address- 0 chance. if each of the miners directly uses node and lets node set its coinbase, chances are very very slim (2^64 range) than youll hit the same nonce as negibour on same node (though this depends on node and miners, node could act as a pool and provide different nonce for each miner if they accept). if mining in a pool, the coinbaise is always pools, and so every pool makes sure the nonce dont collide for each miner (oh and some one mentioned it doesnt matter for miners on pool to hit the same nonce, i think its opposite, because you are doing lower difficulty pow for the pool but still working on the real block hash, and thus the ones produce the actual full difficulty block hash, so very important to not dup work on a pool).

when two miners submit solution at the same time, its never the same solution (of cource if its for same pool on same nonce which all pools will want to prevent) its who finds any solution quicker, or i’ve just convinced so my self )

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.