2

Given I can receive a double spend and potentially re-spend it after 1 confirmation, what happens to that transaction once the double spend is detected during a blockchain reorg?

  • I'm not sure I understand your scenario fully. Let me try to paraphrase: there are two transactions A1 and B1 that are mutually exclusive because they are spending the same UTXO ("a doublespend"). First, A1 gets included in the best chain, but then there is a reorg and B1 is part of the best chain now. You had spent the output of A1 previously while A1 was part of the best chain in transaction A2. What happens to A2 after the reorg? -- Is that what you're asking? – Murch Oct 27 at 17:38
1

A transaction's input parameter has to include the outpoint (txid and vout) of the transaction from which you have got the bitcoins. These outpoints helps nodes verify that the transaction is consuming inputs that have not been spent before. Full nodes maintain a UTXO set of all such outpoints so that they can easily verify the transaction when they get one. Since you are claiming that you have received a double spend transaction, I am assuming it means that there is another transaction that is consuming the same outpoint as the transaction from which you have got your bitcoins.

In a general case, when a chain re-org happens, transactions that were in the blocks of the previous version of the chain but not present in the current active chain are removed and moved to the mempool (provided it is valid), where it will wait until it is confirmed. But since the transaction from which you got the bitcoins is consuming the same outpoint as the transaction that is confirmed in the active chain, the double spend transaction will be discarded by the nodes as it will be invalid. Since, your spending of the double spend is pointing to a transaction that is invalid, your transaction is invalid as well.

That is the very reason it is recommended to wait for a few blocks (6 blocks ideally) before considering that you have got the bitcoins from the other person/machine. If the amount is really sizable, it would be prudent to wait for tens of block confirmations.

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.