1
1
How does my wallet allow me to double spend? As soon as I make a payment, shouldn't my wallet delete those bitcoins or does it leave them until the transaction is added into the blockchain?
1
1
How does my wallet allow me to double spend? As soon as I make a payment, shouldn't my wallet delete those bitcoins or does it leave them until the transaction is added into the blockchain?
0
Your wallet itself doesn't delete or spent any bitcoins. It rather verifies/spends a UTXO.
If your transaction isn't confirmed it simply means that you are still in possesion of that UTXO/( that the UTXO hasn't been spend yet), which means you can simply rebroadcast it to another adress if you'd wish to.
As the network ( rightfully) thinks the money is still in your possesion.
The transaction ID that gets confirmed first will be valid, and your other broadcast that spents the same UTXO's ( or partly the same UTXO's) will be invalided automatically ( as the coins have already been spent).
Thanks! So once the transaction is confirmed, do the contents of that address change to 0? – rahs – 2018-03-26T17:26:47.757
If all the unspent transaction outputs that were previously at adress X all have been used in a transaction that is now confirmed, then yes, there'll be no UTXO's left in said adress, which means there also will be no balance/no bitcoin in said adress. – Rutger Versteegden – 2018-03-26T17:35:37.690
In that case, could the double spending attack have been prevented, had the unspent transaction be 'deactivated' until the transaction is verified and added to the blockchain and returned or 'activated' if the transaction were not verified (or if the person making the payment decided to cancel the transaction) before it got added to the chain? – rahs – 2018-03-26T17:53:55.730
The double spending attack could have been prevented by simply not broadcasting the second tx. Once 1 transaction is broadcasted it usually takes days for it to leave the mempool, you can't simply "cancel" a transaction once you broadcasted it. – Rutger Versteegden – 2018-03-27T10:24:14.007