The flaw in your reasoning is here:
Assuming that within the ~4 billion values there is one that validates the block
That assumption is incorrect. The key property of hashes is that the hash of any piece of data behaves like a random number uniformly distributed between 0 and 2^256 - 1
, and hashes of different data sets behave like independent random variables. With the current difficulty level of about 5.07e12
, each of your nonce values has probability about 4.5e-23
of yielding a hash which is small enough to be a valid solution. So among 4 billion nonces, the probability that any one of them "wins" is about 1.97e-13
. In other words, for any given block header, most likely there is no nonce that "wins". So then you just change something else in the block, as Raghav Sood explains, and start over.
How you do it is totally irrelevant for mining efficiency. All that matters is how many block/nonce combinations you try, and that you don't ever try the same one twice (because that would be wasteful). There's no particular advantage to actually exhausting the nonce space for a given header.
Incidentally, miners might be designed in different ways, and they don't necessarily try all possible nonces in a given block sequentially before starting over. Typically an ASIC miner has a large number of cores, each of which performs hashing at a relatively slow speed. One possible design would be to pass a different block header to each core (varying extraNonce or what have you), and let it exhaust the nonces for that particular header. If so, your 1 TH/s miner might take a lot longer than 4 ms to exhaust all the nonces for any given block. If it has 1000 cores each doing 1 GH/s, it takes 4 seconds to exhaust the nonces - but it does so for 1000 different headers.