2

This question already has an answer here:

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.

marked as duplicate by Willtech, Community May 18 '18 at 19:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.

  • 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 '18 at 16:01
  • Moreover, will that getrawtransaction will return more than one result? – sr-gi May 18 '18 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 '18 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 '18 at 16:03
  • Just to mention an example, the coinbase transactions of blocks [#91722][1] and [#91880][2] have the same hash, and they both have an UTXO. [1]: blockchain.info/block/… [2]: blockchain.info/block/… – cpsola May 18 '18 at 16:23

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