12

Would a block containing a transaction with an identical hash as a previous transaction be considered valid? That is, if someone made a transaction for generating Bitcoins and solve two blocks with the same coinbase transaction, would the second block using that transaction valid?

1

2 Answers 2

8

The transaction would be valid - there is nothing in the protocol that forbids this.

This is also the cause of the "duplicate coinbase" bug in the Satoshi client which I discovered a few months ago. If you create a block with a duplicate coinbase and that block then becomes orphaned it will cause the both the original and duplicate tx to be removed from the database.

4
  • Isnt the probability in this happening make it almost not worth consider fixing? Not that im saying any bugs are a good thing. Just others should have priority.
    – MaxSan
    Feb 28, 2012 at 15:41
  • 2
    @MaxSan: A miner could have, in the past, intentionally triggered this bug. It's very, very hard to do that now, since the mining difficulty is so much higher. Essentially, though, it's just an attack on themselves. They've carefully created coins they can't spend with, and which won't be accepted by, the standard client. Feb 28, 2012 at 16:34
  • 2
    They can use it to make other people's coinbase transactions unspendable as well. For example If I mine a copy of the genesis transaction and that block was orphaned it would make the genesis transaction unspendable (from all clients with the corrupted database). When P2SH hits the problem will be exacerbated as you can mine a block which you can pretty much guarantee will be orphaned.
    – user418
    Feb 28, 2012 at 17:28
  • Seems counter productive. More fool them I guess.
    – MaxSan
    Feb 29, 2012 at 9:21
4

That's valid (and has happened) for coinbase transactions and transactions built off of coinbase transactions. Other than those strange cases, putting the same transaction in the chain twice isn't allowed.

Coinbase duplicates are only allowed due to an oversight. It will be corrected soon.

1
  • 1
    "Other than those strange cases ... isn't allowed" -> It is allowed, just incredibly hard to do (preimage attack on SHA256). Feb 28, 2012 at 22:17

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.