2

Mining is usually about taking the double sha. most if not all mining machines such as bitminer's machines usually give some indications for example 1TH/sec per second. Do they count the double sha as one hash operation or does it mean that they count the double sha as two operations.

Wait, even more interestingly, 1 TH/sec means literally 1 terahash per second. Meaning that we can do 1 trillion operations per second ! Does that not mean that I could exhaust a given nonce in less than a second ?! given that we are dealing with only ~4 billion values ? Assuming that within the ~4 billion values there is one that validates the block, we find a solution in less than a second ! So it aint making sense to me that it takes so long and is so difficult to be a successful solo miner.

4

According to the Bitcoin wiki, it refers to:

Hash per second is an SI derived unit representing the number of double SHA-256 computations performed in one second, referred to as hash rate. It is usually symbolized as h/s (with an appropriate SI prefix).

You are correct in noting that the nonce space is quickly exhausted with modern miners.

This is solved by updating the so-called "extraNonce" in the coinbase transaction. This has the effect of changing the hash of the coinbase transaction, which in turn changes the merkle root included in the block header. This essentially provides an additional 32 bytes of nonce space, since the coinbase tx can be modified as many times as required.

Additionally, but not nearly as relevant with today's hashrate, the timestamp field of the block updates every second and allows for all nonces to be recalculated with the new timestamp as well.

4

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.

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.