Discovering a new block is a task about generation of millions of hashes in order to find one valid hash, which is a hash less than the current target.

The question is: Are there more than 1 valid hash? Is it possible to find more than 1 hash valid for the same block? Maybe there are multiple nonce suitable to valid block hashes.

  • What do you mean by "for the same block"? A block has one, and only one, hash, which is the hash of that block. – David Schwartz Jul 11 '17 at 0:18
  • There is slight confusion in the question. The nonce is a part of the block. So, a given block will have only 1 hash. If you mean, can there be different nonces such that block hash is different but still meets the difficulty, then yes. – sanket1729 Jul 11 '17 at 5:41

Yes, its possible for there to be more than one valid hash. I don't know what the mathematical probability of this is, but if you were to exhaust the entire nonce spectrum, there are likely to be several valid blocks. Most blocks, however, stop when they get a valid hash, so it seldom is an issue. Though occasionally, two miners might come up with different valid hashes at the same time, and this results in one of them being rejected.

As for a collision, well, that's effectively impossible. First, yes, it's possible that the same hash could be found for two different blocks, but that's not a collision. It's also highly unlikely. Unlikely to the point of there being no point in dealing with it.

Yes, it could screw up certain software that assumes hashes are indexable and unique, but it shouldn't really be an issue for the blockchain itself to have duplicate hashes.

The only real "collision" would be if an attacker were trying to come up with his own block of transactions, with the same parent that would somehow hash to the same value and trying to "take over" the other block, and that is astronomically unlikely to the point of absurdity.

  • Ok, you replied my mainly question but: Why is not an issue for blockchain to have duplicate hashes? Each block point to the previous block... Maybe in order to follow the blockchain you get lost(?). And I read about ntime and extranonce, how these affect to producing hashes? It's not the nonce the only thing that can change, right? Thanks!! – mikiasda Jul 11 '17 at 9:53
  • @mikiasda - Can't get lost because each block points to the previous block, not the previous hash. The previous hash is included in the block, but it's not a pointer. – Mr.Nobody Jul 11 '17 at 14:30

Since changing a single byte of the block results in a different hash, a block can only have a unique hash. A block cannot have several hashes.

However, for a given previous block header, there's an quasi infinite number of new blocks that can be mined on top. The role of miners is to generate as many new blocks as they can on top of the current chain head, and then check if the hash of this new block is less than the current target.

To generate these new blocks, they pick a set of valid transactions that doesn't contradict previous transactions, compute the merkle tree of that set of transactions which they include in the block header. That block header contains the nonce field which they increment until they find a valid block or run out of nonce space, in which case, they start the process anew.

  • thanks for your reply, but WHY is not possible to produce multiple valid hashes? The only condition is to be less than the target. And I have another question: Could happen a colission? Producing the same valid hash with same block header and two (or more) different nonces. – mikiasda Jul 10 '17 at 15:53
  • For a given ordered set of transaction and a parent block, there can be only one byte representation of it as a new block and hence only a single hash for it. But if you change the order of the transactions, or the transactions themselves, you can find different valid solutions for a given parent. Indeed, it's mathematically possible to have collisions where two or more headers have the same valid hash, but it's incredibly unlikely and would most certainly break most Bitcoin software. – alcio Jul 10 '17 at 21:33
  • @alcio - that's simply not true. Mining is essentially a process in which brute force hashing is performed against a block, the hash of the parent block, and an ever changing nonce value. When you mine, you increment this nonce value, looking for a hash value below the current difficulty. As such, different nonce values for the same block result in different hashes, and it's VERY possible for there to be multiple valid hashes for the same block/parent with different nonces. So yes, there are multiple valid hashes for a given block. – Mr.Nobody Jul 10 '17 at 23:38
  • @ErikFunkenbusch Since the nonce is part of the block, you cannot have "different nonce values for the same block". – David Schwartz Jul 11 '17 at 0:18
  • That's like @ErikFunkenbusch said. I mean, all the block header the same except the nonce and multiple nonce values could produce more than 1 valid hash block. – mikiasda Jul 11 '17 at 9:50

Certainly. Multiple miners can find a valid block hash for a specific block height and both would be valid blocks. In cases like this, the one that other miners decide to extend upon (usually by receiving the block first) becomes the "real" block and other block becomes stale (or orphaned). This happens fairly frequently.

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.