1

Based on the format of a coinbase transaction described here: What is the format of the coinbase transaction?, I don't see how the all the coinbase transactions for a given miner do not all have the same hash assuming the miner was just using a single pubkey and the block rewards were the same. If they all have the same hash then when you spend one of them, you effectively use them all because that transaction hash has now been used as an input. Clearly that wouldn't make sense, so how are they ensured to be unique transaction hashes?

1

1 Answer 1

3

The script of the input to a coinbase transaction can hold up to 100 bytes of arbitrary data. After BIP 34, the block height must be the first thing in that script. Since each block has a different height, this rule ensures that each coinbase transaction is unique as the block heights will always be different.

Furthermore, since miners can put whatever arbitrary data they want in that input script, they frequently use that as an extra nonce. Instead of reselecting transactions when all of the nonces are exhausted, miners will increment a value known as the extranonce which is put in the input script.


Also, before BIP 34 activated, there were in fact cases of identical coinbase transactions in different blocks. Only the outputs from the most recent of these identical coinbase transactions are spendable. Spending outputs from these transactions does not spend all of the outputs, only the ones from the most recent one. This means that the outputs from the earlier coinbases are unspendable and those coins are provably lost forever.

2
  • I see, that makes sense. Just to clarify one thing, block heights are only guaranteed to be different for a coinbase transactions for the same miner because coinbase transactions for different miners could potentially have the same block height in the case of a temporary fork? Commented Aug 21, 2018 at 20:11
  • Yes, block heights are only different for the same miner.
    – Ava Chow
    Commented Aug 21, 2018 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.