3

What would happened if two transactions have the same hash?
Would it make the Unspent Transaction Outputs(UTXO) in the old transaction not spendable?
I think it would make the outputs in the new transaction spendable and the outputs in the old transaction not spendable.

2

1 Answer 1

4

Per BIP 30, transactions are not allowed to have the same TXID as another transaction which has unspent outputs.

This means that there can be transactions that have the same TXID, but only after the first transaction's outputs are already spent. So in this case, the duplicate TXID does not matter.

For transactions that do have duplicated TXIDs (there are a few of them), only the most recent of those transactions can have its outputs spent. The earlier transactions with the same TXID cannot be spent from and their Bitcoin are lost forever.

5
  • I was about to answer the question, but I was not sure about some details. Does that means that if the old transaction has unspent outputs, all will be evicted from the UTXO set, and the new ones will be included?
    – sr_gi
    May 18, 2018 at 16:01
  • Moreover, will that getrawtransaction will return more than one result?
    – sr_gi
    May 18, 2018 at 16:02
  • 1
    No, the new transaction will be rejected entirely for having a duplicate txid. There are just special cases for the few duplicate txid transactions that occurred before BIP 30's introduction.
    – Andrew Chow
    May 18, 2018 at 16:02
  • 2
    getrawtransaction will return the same thing because the duplicate txid transactions are literally the same transaction (everything about them is the same except for the block that they are a part of). it will only return data for the most recent of the duplicates.
    – Andrew Chow
    May 18, 2018 at 16:03
  • Note that disckjet's examples predate BIP30's activation. In the current consensus rules, such a duplicate txid wouldn't be permitted anymore. Also note that it isn't a case of an actual collision; just the same transaction issued twice. May 18, 2018 at 17:45

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