What values are hashed in the SHA-256 algorithm, and what would be the next iteration until a possible header is found?



I've been doing a lot of reading on mining and software related to mining but I can't quite get my head wrapped around the specific nature of what is being hashed together. So far I feel like the current block header, and a nonce are hashed together in hopes of finding a hash that is less than the current target, if it is, you get 25BTC. Here's where I am confused, according to the psuedocode https://bitcoin.stackexchange.com/a/3047 . The only value that changes is the nonce, and that is a fixed possible hex/integer ex: from 0 to 0xFFFFFFFF.

How is it that the difficulty can increase if there are a finite number of attempts to change the nonce?

Am I right about hashing together the block header with the nonce?

I referenced this https://en.bitcoin.it/wiki/Proof_of_work and it makes perfect sense.. except for the fact that I still feel like the nonce is the only value that changes.

Maybe the 32-bit nonce yields way more possibilities that I can fathom and hashing together every possible nonce value is actually what is done.



Posted 2013-11-12T20:45:06.583

Reputation: 31



When the nonce range is exhausted, miners change the extraNonce field of the generation transaction. This changes the Merkle root in the header and allows a new range of nonces to be attempted.

Since the Merkle root is 256 bits, this can be repeated indefinitely.

Meni Rosenfeld

Posted 2013-11-12T20:45:06.583

Reputation: 19 132

Don't the transactions in the block also change the hash? So, whenever you add another transaction couldn't you just start over at 0 with the nonce? – Murch – 2013-11-13T19:38:50.813

1@Murch: Of course. But getting a new transaction is generally rarer than exhausting a nonce range. – Meni Rosenfeld – 2013-11-13T21:21:49.233