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?


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 Mar 26 '18 at 17:26
  • 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 Mar 26 '18 at 17:35
  • 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 Mar 26 '18 at 17:53
  • 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 Mar 27 '18 at 10:24

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.