<h1>How to Double Spend</h1>

<p>You can double spend using Electrum quite easily. Even without duplicating your wallet, be it on the same or on 2 different machines. Btw.: Duplicating wallets is super easy with Electrum.</p>

<p>Just go to <code>Tools → Preferences → Transactions</code> and check <code>View transaction before signing</code>.</p>

<p><img src="https://i.sstatic.net/R8fVg.png" alt=""></p>

<p>Close the settings, go to the "Send" tab, and enter the first address you want to pay to and the amount to want to send. Click "Send ...".</p>

<p><img src="https://i.sstatic.net/OpDpX.png" alt=""></p>

<p>A window titled "Transaction" opens. Click the button "Sign". This will require you to enter your password to sign the transaction but doesn't already send it.</p>

<p>Note that on my screenshots, it says that the amount sent is 0. This is because Electrum noticed that I used addresses of that same wallet. It will still actually send the transactions out and one of them will (probably) happen but it tells you that you're not sending money to someone else. If you want this to be different, create a second Electrum wallet to send the money to. Don't double spend when paying others.</p>

<p><img src="https://i.sstatic.net/e2VFA.png" alt=""></p>

<p>After pressing the button, the transaction ID is generated, the button "Sign" disappears, and the button "Broadcast" appears. Don't already click that button.</p>

<p><img src="https://i.sstatic.net/eaCsX.png" alt=""></p>

<p>Instead, go back to the main window and enter the second address you want to send to. Leave the amount to send the same.</p>

<p><img src="https://i.sstatic.net/oKHow.png" alt=""></p>

<p>Because the coin selection (if you didn't change it in the mean time, of course ;-) ) and the amount remained the same, the same UTXOs are selected when you press "Send". You can verify this by making sure the inputs are the same. Sign this transaction, too.</p>

<p><img src="https://i.sstatic.net/t0cLj.png" alt=""></p>

<p>You now have 2 transactions spending the same UTXOs:</p>

<p><img src="https://i.sstatic.net/qUngM.png" alt=""></p>

<p>Then, broadcast both transactions quickly after each other.</p>

<p>It doesn't matter whether the addresses you send to belong to the same or a different wallet.</p>

<p>Alternatively, you can duplicate your wallet by simply copying your wallet file (which by default is stored in <code>~/.electrum/wallets</code> or restoring the wallet (even though you still have it) with your seed. Of course, using the same wallet on a different device is possible, too.</p>

<h1>Do Double Spends Happen by Accident?</h1>

<p>Wallets usually try to not spend the same UTXOs twice because when you're not playing with it, it only causes trouble.</p>

<p>If you're using the same wallet on your PC and your smartphone, of course, it can happen that you're spending the same UTXOs twice accidentally because the device you made the first transaction on didn't broadcast it immediately or the device you made the second transaction on didn't know about the first transaction when you made the second one.</p>

<h1>How do Online Services Accepting Unconfirmed Transactions Stay in Business?</h1>

<p>How do restaurants which serve food without the customers having paid that food first, stay in business would be a much better question.</p>

<p>If you buy something online, it's usually something that's delivered to your home or at least connected to an account of yours you plan on using. You have an interest of not defrauding the people or companies providing the services you use because you don't want to be sued for not paying for what you ordered or having an account of yours closed.</p>

<p>In the case of restaurants, it's merely that people usually feel a moral obligation to pay for what they consumed much more than fearing to get caught because the chance of the latter happening as rather small. Restaurants can't sue you because they don't know your name or your address and they can't close an account containing stuff that's valuable to you, either.</p>

<p>And besides, what's with all the online services accepting payments via direct debit? How do they know that you're even the owner of that account? They don't, they just hope for it. If there is an unconfirmed transactions to the address they asked you to pay to, they at least know that the payment was authorized by the person owning the funds it uses and can't get in trouble with other people and their banks.</p>

<h1>Detecting Double Spending</h1>

<p>Businesses can't avoid it because they don't have power over it happening. But they can detect it. They can simply not process an order if, within relatively short period of time, a second transaction spending the same funds as the one they received first appears, and only process the order when the transaction sending sufficient funds to them has 3 confirmations. If someone tried to defraud a business, letting them wait a bit more than they usually would is only fair. If it the double spending happened by accident, the consequences aren't bad anyways so no one is really harmed significantly.</p>

CC BY-SA 3.0
2016-12-26T21:10:25.493Z
Would you be able to provide screenshots of how its done in electrum? thanks.
Patoshi パトシ
CC BY-SA 3.0
2016-12-26T22:24:56.597Z
@duckx I screenshotted pretty much everything that can be screenshotted.
UTF-8
CC BY-SA 3.0
2016-12-26T18:26:57.230Z
2016-12-26T22:29:54.043Z
2016-12-26T22:29:54.043Z
UTF-8
<p>Everyone talks about preventing a double spend transaction, but how does one do one to yourself in order to better understand the steps involved by the attacker?</p>

<ul>
<li>What is required to do a double spend? Two phones running the same btc wallet?</li>
<li>Do you send at the same exact time?</li>
<li>Is it random a double spend happens when sending to multiple addresses? </li>
<li>How do certain online services that don't wait for the 1st confirmation stay in business? Wouldn't every attacker want to scam that no-confirmation service?</li>
<li>What are some preventive measures a business can use to prevent a double spend aside from waiting for 1-confirmation. </li>
</ul>

<doublespend><attack>
Understanding a Bitcoin Double Spending Transaction by Performing one on yourself
Patoshi パトシ
# Understanding a Bitcoin Double Spending Transaction by Performing one on yourself

(Asked by: username_0 on 2016-12-26)

Everyone talks about preventing a double spend transaction, but how does one do one to yourself in order to better understand the steps involved by the attacker?

* What is required to do a double spend? Two phones running the same btc wallet?
* Do you send at the same exact time?
* Is it random a double spend happens when sending to multiple addresses?
* How do certain online services that don't wait for the 1st confirmation stay in business? Wouldn't every attacker want to scam that no-confirmation service?
* What are some preventive measures a business can use to prevent a double spend aside from waiting for 1-confirmation.

**Tags:** doublespend, attack


---

## 1 answers

### Answer by username_1 on 2016-12-26. Score: 9 | Accepted answer

# How to Double Spend

You can double spend using Electrum quite easily. Even without duplicating your wallet, be it on the same or on 2 different machines. Btw.: Duplicating wallets is super easy with Electrum.

Just go to `Tools → Preferences → Transactions` and check `View transaction before signing`.

![](https://i.sstatic.net/R8fVg.png)

Close the settings, go to the "Send" tab, and enter the first address you want to pay to and the amount to want to send. Click "Send ...".

![](https://i.sstatic.net/OpDpX.png)

A window titled "Transaction" opens. Click the button "Sign". This will require you to enter your password to sign the transaction but doesn't already send it.

Note that on my screenshots, it says that the amount sent is 0. This is because Electrum noticed that I used addresses of that same wallet. It will still actually send the transactions out and one of them will (probably) happen but it tells you that you're not sending money to someone else. If you want this to be different, create a second Electrum wallet to send the money to. Don't double spend when paying others.

![](https://i.sstatic.net/e2VFA.png)

After pressing the button, the transaction ID is generated, the button "Sign" disappears, and the button "Broadcast" appears. Don't already click that button.

![](https://i.sstatic.net/eaCsX.png)

Instead, go back to the main window and enter the second address you want to send to. Leave the amount to send the same.

![](https://i.sstatic.net/oKHow.png)

Because the coin selection (if you didn't change it in the mean time, of course ;-) ) and the amount remained the same, the same UTXOs are selected when you press "Send". You can verify this by making sure the inputs are the same. Sign this transaction, too.

![](https://i.sstatic.net/t0cLj.png)

You now have 2 transactions spending the same UTXOs:

![](https://i.sstatic.net/qUngM.png)

Then, broadcast both transactions quickly after each other.

It doesn't matter whether the addresses you send to belong to the same or a different wallet.

Alternatively, you can duplicate your wallet by simply copying your wallet file (which by default is stored in `~/.electrum/wallets` or restoring the wallet (even though you still have it) with your seed. Of course, using the same wallet on a different device is possible, too.

# Do Double Spends Happen by Accident?

Wallets usually try to not spend the same UTXOs twice because when you're not playing with it, it only causes trouble.

If you're using the same wallet on your PC and your smartphone, of course, it can happen that you're spending the same UTXOs twice accidentally because the device you made the first transaction on didn't broadcast it immediately or the device you made the second transaction on didn't know about the first transaction when you made the second one.

# How do Online Services Accepting Unconfirmed Transactions Stay in Business?

How do restaurants which serve food without the customers having paid that food first, stay in business would be a much better question.

If you buy something online, it's usually something that's delivered to your home or at least connected to an account of yours you plan on using. You have an interest of not defrauding the people or companies providing the services you use because you don't want to be sued for not paying for what you ordered or having an account of yours closed.

In the case of restaurants, it's merely that people usually feel a moral obligation to pay for what they consumed much more than fearing to get caught because the chance of the latter happening as rather small. Restaurants can't sue you because they don't know your name or your address and they can't close an account containing stuff that's valuable to you, either.

And besides, what's with all the online services accepting payments via direct debit? How do they know that you're even the owner of that account? They don't, they just hope for it. If there is an unconfirmed transactions to the address they asked you to pay to, they at least know that the payment was authorized by the person owning the funds it uses and can't get in trouble with other people and their banks.

# Detecting Double Spending

Businesses can't avoid it because they don't have power over it happening. But they can detect it. They can simply not process an order if, within relatively short period of time, a second transaction spending the same funds as the one they received first appears, and only process the order when the transaction sending sufficient funds to them has 3 confirmations. If someone tried to defraud a business, letting them wait a bit more than they usually would is only fair. If it the double spending happened by accident, the consequences aren't bad anyways so no one is really harmed significantly.

> **Comments:**
> **username_0**: Would you be able to provide screenshots of how its done in electrum? thanks.  
> **username_1**: @duckx I screenshotted pretty much everything that can be screenshotted.  

---

