Can you tell me whether or not the answers in this thread explain your question sufficiently;
https://bitcointalksearch.org/topic/nonce-and-extranonce-algorithm-1040859 (And more specifically Danny's post, but it's really too big to quote in good faith here.)
I've got one more question. When I first thought of the nonce and the hashing algo I was under the assumption that once all the hashing is done there is then a calculation made with the nonce and then we get our block hash result.
This to me doesn't know look right. If it isn't please could someone tell me at what stage does the nonce come in when the calculations are being made?
The nonce is part of the data that is hashed for the blockhash. Thus it influences the result of the hashing function. Once you have the hash it is compared to the target. If your hash is below the traget value we have a new block, if not you change the data (e.g. nonce = nonce +1), hash and compare again. Once you have tried all possible nonces you have to change something different in order to get hash values for the block you did not try yet. There are several options, e.g. the transactions to include, the timestamp of the block or what is called the extranonce.
As i understand it, the extranonce is the amount of times a nonce had to "reset"/"increment" itself because no valid hash was found, but since i also just ever heard about this term, this is probably
not the correct understanding of it.
https://medium.freecodecamp.org/how-bitcoin-mining-really-works-38563ec38c87<...
The solution to this is to add a field to the coinbase (the transaction contents of a block, stored as the merkle tree) called the extraNonce. The size of this extraNonce is only limited by the size of block itself, and so it can be as large as miners wish as long as the block size is within protocol limits.
If all 4 billion possible values of the nonce are exhausted, the extraNonce is added and incremented to the coinbase. A new merkle root and subsequently new block header are calculated, and the nonce is iterated over once again. This process is repeated until a sufficient hash is found.
It’s best to avoid adding the extraNonce until the nonce is exhausted, because any change to the extraNonce changes the merkle tree. This requires extra computation in order to propagate the change upwards until a new root of the merkle tree is calculated.
...>