<p>For more technical details: </p>

<p>The thing to understand is that <a href="https://bitcoin.stackexchange.com/questions/4301/what-is-an-unspent-output">'bitcoins' actually exist as 'unspent transaction ouputs' (UTXO)s</a>. <a href="https://bitcoin.stackexchange.com/questions/49853/utxo-model-vs-account-balance-model">Here is some info comparing the UTXO model, to the 'accounts model'</a>.</p>

<p>In your first example, Bob would create a transaction that 'consumes' some UTXOs in his wallet that sum to a total ≥5 BTC, and send it to Alice. If the total was more than exactly 5, then <a href="https://bitcoin.stackexchange.com/questions/736/how-does-change-work-in-a-bitcoin-transaction">Bob's transaction would include a change address</a> that pays the extra back to himself. Bob creates and broadcasts this transaction.</p>

<p>Now, assuming he had exactly 10 BTC in his wallet (and ignoring tx fees), in order for Bob to send Uncle Tom 5 BTC immediately, he will need to make a transaction that includes the change UTXO created in the transaction sent to Alice. He does this, and broadcasts it to the network.</p>

<p>Both of these transactions can be mined in the same block, or they can be mined in separate blocks, <em>but the important thing is</em>: Alice's transaction must come first, since it creates a UTXO that is spent in Uncle Tom's transaction. Even within a block, the order of transactions matters in this way. First Alice's, then Uncle Tom's. The other way around would create an invalid block that the network would reject.</p>

<hr>

<p>In the second example, Bob would sum up all the UTXOs in his wallet, and create a 10 BTC transaction to send to Alice, but he would also use the <strong>same UTXOs</strong> to create a transaction to send to Uncle Tom. </p>

<p>Lets say that Bob strategically broadcast these two transactions to the network, so that about half the network heard about Alice's transaction first, and the other half heard about Uncle Tom's transaction first. </p>

<p>In this case, only one transaction will eventually be 'confirmed' by being included in a block, because all of Bob's UTXOs can only be consumed once! A second attempt would be rejected by the network as invalid. So whichever transaction is included in a block first will be the winner, <a href="https://bitcoin.stackexchange.com/questions/1170/why-is-6-the-number-of-confirms-that-is-considered-secure">though you may want to wait a few confirmations to be completely sure</a>. Any nodes that heard about the other transaction first will simply discard it once they hear about the winning transaction being included in a block. </p>

CC BY-SA 4.0
2018-12-04T11:33:34.433Z
2018-12-04T11:39:12.730Z
2018-12-04T11:39:12.730Z
chytrik
<blockquote>
  <p><strong>Will both Bob's transactions be confirmed in the same block?</strong></p>
</blockquote>

<p>This cannot be guaranteed. They might or might not.</p>

<blockquote>
  <p><strong>consider the case when Bob sends all 10 bitcoins to Alice in one transaction and simultaneously issues another transaction to send Uncle Tom the same 10 bitcoins.</strong></p>
</blockquote>

<p>Bob's wallet will not allow him to double-spend. If Bob circumvents this, one of the transactions will be rejected by the network. In the worst case there may be a short period where it is unclear which transaction will win.</p>

<p>Each node in the network, whether a miner or a wallet will verify incoming transactions and mined blocks and will reject any that attempt to spend TXOs that are not UTXOs - i.e. which that node knows are already spent. </p>

<p>It can be that one miner selects the payment to Alice for inclusion in a block and another miner selects the payment to Tom. Other nodes will reject the second of such blocks that they receive, eventually the blocks with the most proof of work will be the only ones accepted, including by both miners.</p>

<hr>

<p>Related questions:</p>

<ul>
<li><a href="https://bitcoin.stackexchange.com/q/73701/13866">How to return Tx to mem pool from orphan block</a></li>
<li><a href="https://bitcoin.stackexchange.com/q/4082/13866">What&#39;s the longest chain of orphan blocks? (How many confirmations have been necessary?)</a></li>
<li><a href="https://bitcoin.stackexchange.com/q/37273/13866">How is a blockchain split resolved?</a></li>
<li><a href="https://bitcoin.stackexchange.com/q/38614/13866">Selfish Mining: stale or orphan?</a></li>
<li><a href="https://bitcoin.stackexchange.com/q/32110/13866">Is there a correct way to refer to &quot;orphan&quot; blocks?</a></li>
</ul>

<p>and </p>

<ul>
<li><a href="https://bitcoin.stackexchange.com/q/4301/13866">What is an &quot;unspent output&quot;?</a></li>
</ul>

CC BY-SA 4.0
2018-12-04T10:39:54.683Z
From a technical point of view, how will one of the transactions be rejected by the network?
anonuser1
CC BY-SA 4.0
2018-12-04T10:59:35.187Z
@anonuser1: See links at  end of answer for more details
RedGrittyBrick
CC BY-SA 4.0
2018-12-04T11:01:27.210Z
Once a transaction A is added to a block to be mined, will the node that is doing the mining for that block keep track of the output of that transaction A, so that if a new transaction B comes from the same address of transaction A, than it would know the eventual output of both the transactions and decide whether to accept both or reject one of these transactions?
anonuser1
CC BY-SA 4.0
2018-12-04T11:23:55.613Z
@anonuser: No single node will ever simultaneously accept two transactions, for different recipients, which use the same UTXOs as inputs. It isn't just a matter of the address, there can be many UTXOs associated with an address.
RedGrittyBrick
CC BY-SA 4.0
2018-12-04T10:37:51.840Z
2018-12-04T11:22:13.097Z
2018-12-04T11:22:13.097Z
RedGrittyBrick
<p>Imagine a person Bob has 10 bitcoins in his wallet. He wants to send 5 bitcoins to Alice and another 5 bitcoins to Uncle Tom simultaneously (in separate transactions). Will both Bob's transactions be confirmed in the same block?</p>

<p>If yes, than consider the case when Bob sends all 10 bitcoins to Alice in one transaction and simultaneously issues another transaction to send Uncle Tom the same 10 bitcoins. How is the double spending problem prevented in this case (I would like a technical answer for this one)?</p>

<transactions><doublespend>
Can two or more transactions sent from the same address be mined in the same block in Bitcoin's blockchain?
anonuser1
# Can two or more transactions sent from the same address be mined in the same block in Bitcoin's blockchain?

(Asked by: username_0 on 2018-12-04)

Imagine a person Bob has 10 bitcoins in his wallet. He wants to send 5 bitcoins to Alice and another 5 bitcoins to Uncle Tom simultaneously (in separate transactions). Will both Bob's transactions be confirmed in the same block?

If yes, than consider the case when Bob sends all 10 bitcoins to Alice in one transaction and simultaneously issues another transaction to send Uncle Tom the same 10 bitcoins. How is the double spending problem prevented in this case (I would like a technical answer for this one)?

**Tags:** transactions, doublespend


---

## 2 answers

### Answer by username_1 on 2018-12-04. Score: 2 | Accepted answer

For more technical details:

The thing to understand is that ['bitcoins' actually exist as 'unspent transaction ouputs' (UTXO)s](https://bitcoin.stackexchange.com/questions/4301/what-is-an-unspent-output). [Here is some info comparing the UTXO model, to the 'accounts model'](https://bitcoin.stackexchange.com/questions/49853/utxo-model-vs-account-balance-model).

In your first example, Bob would create a transaction that 'consumes' some UTXOs in his wallet that sum to a total ≥5 BTC, and send it to Alice. If the total was more than exactly 5, then [Bob's transaction would include a change address](https://bitcoin.stackexchange.com/questions/736/how-does-change-work-in-a-bitcoin-transaction) that pays the extra back to himself. Bob creates and broadcasts this transaction.

Now, assuming he had exactly 10 BTC in his wallet (and ignoring tx fees), in order for Bob to send Uncle Tom 5 BTC immediately, he will need to make a transaction that includes the change UTXO created in the transaction sent to Alice. He does this, and broadcasts it to the network.

Both of these transactions can be mined in the same block, or they can be mined in separate blocks, *but the important thing is*: Alice's transaction must come first, since it creates a UTXO that is spent in Uncle Tom's transaction. Even within a block, the order of transactions matters in this way. First Alice's, then Uncle Tom's. The other way around would create an invalid block that the network would reject.

---

In the second example, Bob would sum up all the UTXOs in his wallet, and create a 10 BTC transaction to send to Alice, but he would also use the **same UTXOs** to create a transaction to send to Uncle Tom.

Lets say that Bob strategically broadcast these two transactions to the network, so that about half the network heard about Alice's transaction first, and the other half heard about Uncle Tom's transaction first.

In this case, only one transaction will eventually be 'confirmed' by being included in a block, because all of Bob's UTXOs can only be consumed once! A second attempt would be rejected by the network as invalid. So whichever transaction is included in a block first will be the winner, [though you may want to wait a few confirmations to be completely sure](https://bitcoin.stackexchange.com/questions/1170/why-is-6-the-number-of-confirms-that-is-considered-secure). Any nodes that heard about the other transaction first will simply discard it once they hear about the winning transaction being included in a block.


---

### Answer by username_2 on 2018-12-04. Score: 4

> **Will both Bob's transactions be confirmed in the same block?**

This cannot be guaranteed. They might or might not.

> **consider the case when Bob sends all 10 bitcoins to Alice in one transaction and simultaneously issues another transaction to send Uncle Tom the same 10 bitcoins.**

Bob's wallet will not allow him to double-spend. If Bob circumvents this, one of the transactions will be rejected by the network. In the worst case there may be a short period where it is unclear which transaction will win.

Each node in the network, whether a miner or a wallet will verify incoming transactions and mined blocks and will reject any that attempt to spend TXOs that are not UTXOs - i.e. which that node knows are already spent.

It can be that one miner selects the payment to Alice for inclusion in a block and another miner selects the payment to Tom. Other nodes will reject the second of such blocks that they receive, eventually the blocks with the most proof of work will be the only ones accepted, including by both miners.

---

Related questions:

* [How to return Tx to mem pool from orphan block](https://bitcoin.stackexchange.com/q/73701/13866)
* [What's the longest chain of orphan blocks? (How many confirmations have been necessary?)](https://bitcoin.stackexchange.com/q/4082/13866)
* [How is a blockchain split resolved?](https://bitcoin.stackexchange.com/q/37273/13866)
* [Selfish Mining: stale or orphan?](https://bitcoin.stackexchange.com/q/38614/13866)
* [Is there a correct way to refer to "orphan" blocks?](https://bitcoin.stackexchange.com/q/32110/13866)

and

* [What is an "unspent output"?](https://bitcoin.stackexchange.com/q/4301/13866)

> **Comments:**
> **username_0**: From a technical point of view, how will one of the transactions be rejected by the network?  
> **username_2**: @username_0: See links at  end of answer for more details  
> **username_0**: Once a transaction A is added to a block to be mined, will the node that is doing the mining for that block keep track of the output of that transaction A, so that if a new transaction B comes from the same address of transaction A, than it would know the eventual output of both the transactions and decide whether to accept both or reject one of these transactions?  
> **username_2**: @anonuser: No single node will ever simultaneously accept two transactions, for different recipients, which use the same UTXOs as inputs. It isn't just a matter of the address, there can be many UTXOs associated with an address.  

---

