0

I am a little confused about how doublespending is done. The basic case is basically creating transactions to the seller and yourself and simultaneously broadcasting those. This is the very classic scenario, would I be correct ?

How does sending money to yourself exactly work? How would a typical transaction look like?

My question is could you hypothetically triple spend or spend x times the original amount. Equally, could you send yourself the money back many hundreds of times? So, if you had 3 bitcoins could you send yourself 3 bitcoins back ?

[update after answer was provided]

how does attacker need to modify transaction so that transaction appears valid when he is sending himself money back ? he has to create block where he is just sending himself money back as transaction. How is btc tracked in transaction then to make this possible ?

1

To double spend BTC, you need to make one transaction to the person meant to receive the money, and one transaction to an address you control yourself. This would typically be another address in your wallet. The two transactions would spend the same bitcoins, but send them to different addresses. Those transactions would look like completely normal transactions.

Now, you will not be able to create any new bitcoins. Because the same money is spent twice, only one of the transactions can be accepted into the blockchain. That's why one should wait for confirmations before accepting BTC as payment, as there's no guarantee for which transactions will be accepted in the next block and which transactions won't.

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