<p>Each node in the Bitcoin network tracks every single piece of bitcoin. This body is called the "Unspent Transaction Output Set" or UTXO Set for short. Every UTXO is uniquely identifiable and can only be spent once. If two transactions try to spend the same UTXO, only one of the two transactions can become part of the best chain. Including both transactions into one block would make the block invalid as the second transaction spends funds that no longer exist. So, as pinhead already said, if someone attempts a so called <a href="/questions/tagged/doublespend" class="post-tag" title="show questions tagged &#39;doublespend&#39;" rel="tag">doublespend</a>, the two unconfirmed transactions are only competing in the network until one of the two gets confirmed. The other is evicted from the queue, because the funds it is attempting to spend are no longer spendable. Even before, most full nodes will only relay the first of two competing transactions they've seen.</p>

<blockquote>
  <p>"Party A submits a transaction saying Party B gave him 3 BTC and Party B submits a transaction saying he gave Party A only 1 BTC."</p>
</blockquote>

<p>There is another practical issue with your scenario here: most UTXO require the spender to authenticate themselves as the owner by providing a cryptographic signature corresponding to the locking script the funds were originally received to. As Party B is sending to A, in most cases only Party B would be privy to the necessary private key to provide such a signature. Unless Party A somehow got access to Party B's key material, they would simply be unable to create a valid transaction spending Party B's funds. Without a valid signature, Party A's transaction would simply be discarded by any other network participant as invalid.</p>

CC BY-SA 4.0
2020-04-26T06:45:11.520Z
2020-04-26T06:45:11.520Z
Murch
<p>If two transactions spend the same coin (utxo) only one is allowed in each node's mempool. That may not be the tx that gets actually confirmed by a miner though and inserted into a block. In that case, the confirmed transaction "evicts" the double-spend from the mempool. </p>

<p>It is possible that two competing miners each mine different blocks at the same height with conflicting transactions. This is a split blockchain and a split network, but it's not a problem. Eventually one of these blockchain branches will be extended by an additional block. The chain with the most accumulated proof of work is the only one that matters, and the other branch (with the conflicting TX) will again be wiped out. </p>

<p>If you are running your own full node you don't need to trust any other source of truth. If you are a vendor accepting bitcoin, this is why "waiting six confirmations" is generally accepted as best practice.</p>

CC BY-SA 4.0
2020-04-26T00:26:55.810Z
2020-04-26T00:26:55.810Z
pinhead
<p>Let’s say you’re making purchases from Amazon.</p>

<p>Instead of using your actual name, your purchase is recorded without any identifying information using a unique “digital signature”, sort of like a username.</p>

<p>Blocks store information that distinguishes them from other blocks. Much like you and I have names to distinguish us from one another, each block stores a unique code called a “hash” that allows us to tell it apart from every other block. Hashes are cryptographic codes created by special algorithms. Let’s say you splurge purchased on Amazon, but while it’s in transit, you decide you just can’t resist and need a second one. Even though the details of your new transaction would look nearly identical to your earlier purchase, we can still tell the blocks apart because of their unique codes.</p>

<p>Then again Double-spending is a potential flaw in a digital cash scam in which the same single digital token can unfortunately be spent more than once. Unlike physical cash, a digital token consists of a digital file that can be duplicated and/or falsified. </p>

CC BY-SA 4.0
2020-04-26T07:09:18.467Z
2020-04-26T08:28:53.210Z
2020-04-26T08:28:53.210Z
Lilmighty
<p>The network doesn't have to. (In reality it does, but it doesn't have to)</p>

<p>The miner who finds the next block does have to choose one, if it receives both. We don't really care which one the miner chooses. If it's the one Party B doesn't want, well, that's Party B's fault for creating two transactions in the first place.</p>

<p>The miner has to choose one, though, because otherwise its block is invalid and it doesn't get paid. It will probably choose the one with the highest transaction fee or the one it received first.</p>

CC BY-SA 4.0
2020-04-26T11:06:23.130Z
2020-04-26T11:06:23.130Z
Criticize SE actions means ban
<p>Let's say parties A and B both submit a transaction to the blockchain with a different version of what happened. Party A submits a transaction saying Party B gave him 3 BTC and Party B submits a transaction saying he gave Party A only 1 BTC. How does the network decide which one to put in the next block? </p>

<p>Don't you have to trust a third party? A wallet or some kind of transaction application? How does that work?</p>

<doublespend><transaction-verification>
If two parties submit a conflicting transaction between each other, how does the network decide which one is correct?
bitsearch
# If two parties submit a conflicting transaction between each other, how does the network decide which one is correct?

(Asked by: username_0 on 2020-04-25)

Let's say parties A and B both submit a transaction to the blockchain with a different version of what happened. Party A submits a transaction saying Party B gave him 3 BTC and Party B submits a transaction saying he gave Party A only 1 BTC. How does the network decide which one to put in the next block?

Don't you have to trust a third party? A wallet or some kind of transaction application? How does that work?

**Tags:** doublespend, transaction-verification


---

## 4 answers

### Answer by username_1 on 2020-04-26. Score: 1 | Accepted answer

Each node in the Bitcoin network tracks every single piece of bitcoin. This body is called the "Unspent Transaction Output Set" or UTXO Set for short. Every UTXO is uniquely identifiable and can only be spent once. If two transactions try to spend the same UTXO, only one of the two transactions can become part of the best chain. Including both transactions into one block would make the block invalid as the second transaction spends funds that no longer exist. So, as username_2 already said, if someone attempts a so called [doublespend](/questions/tagged/doublespend "show questions tagged 'doublespend'"), the two unconfirmed transactions are only competing in the network until one of the two gets confirmed. The other is evicted from the queue, because the funds it is attempting to spend are no longer spendable. Even before, most full nodes will only relay the first of two competing transactions they've seen.

> "Party A submits a transaction saying Party B gave him 3 BTC and Party B submits a transaction saying he gave Party A only 1 BTC."

There is another practical issue with your scenario here: most UTXO require the spender to authenticate themselves as the owner by providing a cryptographic signature corresponding to the locking script the funds were originally received to. As Party B is sending to A, in most cases only Party B would be privy to the necessary private key to provide such a signature. Unless Party A somehow got access to Party B's key material, they would simply be unable to create a valid transaction spending Party B's funds. Without a valid signature, Party A's transaction would simply be discarded by any other network participant as invalid.


---

### Answer by username_2 on 2020-04-26. Score: 2

If two transactions spend the same coin (utxo) only one is allowed in each node's mempool. That may not be the tx that gets actually confirmed by a miner though and inserted into a block. In that case, the confirmed transaction "evicts" the double-spend from the mempool.

It is possible that two competing miners each mine different blocks at the same height with conflicting transactions. This is a split blockchain and a split network, but it's not a problem. Eventually one of these blockchain branches will be extended by an additional block. The chain with the most accumulated proof of work is the only one that matters, and the other branch (with the conflicting TX) will again be wiped out.

If you are running your own full node you don't need to trust any other source of truth. If you are a vendor accepting bitcoin, this is why "waiting six confirmations" is generally accepted as best practice.


---

### Answer by username_3 on 2020-04-26. Score: 0

Let’s say you’re making purchases from Amazon.

Instead of using your actual name, your purchase is recorded without any identifying information using a unique “digital signature”, sort of like a username.

Blocks store information that distinguishes them from other blocks. Much like you and I have names to distinguish us from one another, each block stores a unique code called a “hash” that allows us to tell it apart from every other block. Hashes are cryptographic codes created by special algorithms. Let’s say you splurge purchased on Amazon, but while it’s in transit, you decide you just can’t resist and need a second one. Even though the details of your new transaction would look nearly identical to your earlier purchase, we can still tell the blocks apart because of their unique codes.

Then again Double-spending is a potential flaw in a digital cash scam in which the same single digital token can unfortunately be spent more than once. Unlike physical cash, a digital token consists of a digital file that can be duplicated and/or falsified.


---

### Answer by username_4 on 2020-04-26. Score: -1

The network doesn't have to. (In reality it does, but it doesn't have to)

The miner who finds the next block does have to choose one, if it receives both. We don't really care which one the miner chooses. If it's the one Party B doesn't want, well, that's Party B's fault for creating two transactions in the first place.

The miner has to choose one, though, because otherwise its block is invalid and it doesn't get paid. It will probably choose the one with the highest transaction fee or the one it received first.


---

