<blockquote>
<p>Does the first transaction to hit the network win and the later one just never get confirmed?</p>
</blockquote>
<p>Almost however it's not as simple as the &quot;first&quot; transaction, but it is essentially a race.</p>
<p>When a new transaction is broadcast to other nodes it enters what is known as the mempool. Using the phrase &quot;the mempool&quot; can be confusing since there isn't a single mempool, every node has its own mempool and it may not be the same as another nodes mempool.</p>
<p>In your scenario, two identical wallets different sides of the world, the one that broadcasts a transaction with a higher fee may &quot;win&quot;, or the one that broadcasts to nodes that are better connected for propagation across the network may &quot;win&quot;.</p>
<p>Once the transaction is in the mempool and other nodes know about it, you will likely receive a &quot;missing inputs&quot; error when trying to broadcast inputs that have already been spent. The transaction does not have to be confirmed in a block in order for the double-spend to be noticed; it only needs to be in the mempool. Some transactions can sit in the mempool for hours or even days if network use is high and the transaction fee for that transaction are low making it important that transactions in the mempool are checked for double-spends.</p>
<p>In any event a transaction does not have any degree of permanence until it is confirmed in a block. Even with 1 confirmation a transaction may not be permanent in the event of competing longest chains, the losing chain will have orphaned blocks.</p>
<p>Back when bitcoin was younger many people would wait for 6 confirmations before considering a transaction permanent.  Today a few confirmations is likely enough for most transactions to be considered permanent.</p>

CC BY-SA 4.0
2021-03-14T19:52:42.537Z
2021-03-18T02:05:14.700Z
2021-03-18T02:05:14.700Z
m1xolyd1an
<p>I'm trying to understand Bitcoin a bit more and I'm struggling to find an answer for this scenario. Say for example I have access to a wallet and I have give a person on the other side of the world access to the same wallet (both using bitcoin core wallet and bitcoin-cli sendtoaddress). We are on our phones and we both have the exact same balance and are at the exact same block height. How does bitcoin prevent the scenario where I send money to one address and a person with access to the same wallets sends money to another address at approximately the same time?  Does the first transaction to hit the network win and the later one just never get confirmed? How does the  decentralized network decide?</p>

CC BY-SA 4.0
2021-03-14T16:24:10.560Z
Does this answer your question? [Bitcoin fork resolution - Fork losers download previous blocks 'til common block?](https://bitcoin.stackexchange.com/questions/85607/bitcoin-fork-resolution-fork-losers-download-previous-blocks-til-common-block)
RedGrittyBrick
CC BY-SA 4.0
2021-03-14T17:04:57.553Z
No. I'm trying to figure out why when I have two wallets on different devices in different locations and the wallet gets sent money, one wallet receives the transaction before the other.
Jonathan
<doublespend><transaction-propagation>
Duplicate Transaction Prevention
Jonathan
# Duplicate Transaction Prevention

(Asked by: username_0 on 2021-03-14)

I'm trying to understand Bitcoin a bit more and I'm struggling to find an answer for this scenario. Say for example I have access to a wallet and I have give a person on the other side of the world access to the same wallet (both using bitcoin core wallet and bitcoin-cli sendtoaddress). We are on our phones and we both have the exact same balance and are at the exact same block height. How does bitcoin prevent the scenario where I send money to one address and a person with access to the same wallets sends money to another address at approximately the same time? Does the first transaction to hit the network win and the later one just never get confirmed? How does the decentralized network decide?

**Tags:** doublespend, transaction-propagation

> **Comments:**
> **username_1**: Does this answer your question? [Bitcoin fork resolution - Fork losers download previous blocks 'til common block?](https://bitcoin.stackexchange.com/questions/85607/bitcoin-fork-resolution-fork-losers-download-previous-blocks-til-common-block)  
> **username_0**: No. I'm trying to figure out why when I have two wallets on different devices in different locations and the wallet gets sent money, one wallet receives the transaction before the other.  

---

## 1 answers

### Answer by username_2 on 2021-03-14. Score: 1 | Accepted answer

> Does the first transaction to hit the network win and the later one just never get confirmed?

Almost however it's not as simple as the "first" transaction, but it is essentially a race.

When a new transaction is broadcast to other nodes it enters what is known as the mempool. Using the phrase "the mempool" can be confusing since there isn't a single mempool, every node has its own mempool and it may not be the same as another nodes mempool.

In your scenario, two identical wallets different sides of the world, the one that broadcasts a transaction with a higher fee may "win", or the one that broadcasts to nodes that are better connected for propagation across the network may "win".

Once the transaction is in the mempool and other nodes know about it, you will likely receive a "missing inputs" error when trying to broadcast inputs that have already been spent. The transaction does not have to be confirmed in a block in order for the double-spend to be noticed; it only needs to be in the mempool. Some transactions can sit in the mempool for hours or even days if network use is high and the transaction fee for that transaction are low making it important that transactions in the mempool are checked for double-spends.

In any event a transaction does not have any degree of permanence until it is confirmed in a block. Even with 1 confirmation a transaction may not be permanent in the event of competing longest chains, the losing chain will have orphaned blocks.

Back when bitcoin was younger many people would wait for 6 confirmations before considering a transaction permanent. Today a few confirmations is likely enough for most transactions to be considered permanent.


---

