<p>It works just fine.</p>

<p>Bitcoin transactions can have multiple inputs and outputs; each input is a "pointer" to an output of a previous transaction (specifically, it consists of a transaction id and output index). So you  would create a new transaction with two inputs:</p>

<ul>
<li><p>the A1->A3 transaction (or more properly, the particular output of this transaction that credited A3)</p></li>
<li><p>the A2->A3 transaction (again, the particular output).</p></li>
</ul>

<p>It's not necessary to include amounts in the inputs, since the rule is that each input must be consumed completely.  So we now have 3 BTC worth of inputs in our transaction. </p>

<p>An output consists of an amount and a destination address. (One can also have a script which directs the payment in more elaborate ways, requiring multiple signatures, etc, but let's ignore that for now.)  You would want to have two outputs:</p>

<ul>
<li><p>An output paying 2.5 BTC to the desired destination address, call it A4</p></li>
<li><p>An output paying the "change", 0.5 BTC, to some address of yours.  You could use A3 again, but it is generally better to use a newly generated address; call it A5.</p></li>
</ul>

<p>(Actually, in real life, the second output would more likely be something like 0.4995 BTC.  The leftover 0.0005 BTC wouldn't appear in any output; it would be a transaction fee, collected by whichever miner includes this transaction in a block.)</p>

<p>For an end user, this is all done under the hood by their wallet software.  The user just specifies that they want to pay 2.5 BTS to A4, and the software takes care of identifying appropriate transactions to use as inputs and creating the necessary change output.  Sometimes this confuses people when they see that after the transaction, the balance in A3 has dropped from 3 to 0, if they don't know that the remaining 0.5 BTC has gone to a new address A5 which is still theirs. </p>

CC BY-SA 3.0
2017-10-03T14:52:43.350Z
Thanks indeed Steven. It is a very ellaborated answer. However I still have doubts at the protocol level. Let me explain, the first transaction (A1->A3) is saved in block 444,444 of teh blockchain, and the second transaction (A2->A3) is saved in block 444,555 (111 blocks later). When I try to move the balance, there are two different blocks with two different balnces fo rthe same address (A3). DOes it men then that the protocol adds up all unspent balances for a given address? (reviewing then the whole blockchain).
PlatoWright
CC BY-SA 3.0
2017-10-03T15:13:58.580Z
On the contrary - the blocks don't contain balance information at all, so there is no inconsistency.  There is a transaction with amount 2 BTC, and another transaction with amount 1 BTC.  Nowhere in the blockchain are these numbers added to make 3 BTC; in fact, the blockchain doesn't form any connection between multiple transactions with the same address. It's up to your client software to keep track of all the unspent outputs in the chain that correspond to your addresses, and sum them to show your total balance.
Nate Eldredge
CC BY-SA 3.0
2017-12-01T12:35:08.457Z
The system doesn't care that the same key happens to be able to claim both unspent outputs. As far as it's concerned, they're just two unspent outputs in a pool of many, many unspent outputs.
David Schwartz
CC BY-SA 3.0
2017-10-03T13:42:57.280Z
2017-10-03T13:42:57.280Z
Nate Eldredge
<p>I would like to know the consequences of sending bitcoin several times to the same address. Let us say I send 1 BTC from Address1 to Address3 and later I send 2 BTC from Address2 to Address3 again.
The blockchain will have both, 1 BTC and 2 BTC transactions registered. So, What hapens when I want to send 2.5 NTC from Address3 to a new address? </p>

<transactions><bitcoin-core><change><transaction-input>
What happens when two transactions send to the same address?
PlatoWright
# What happens when two transactions send to the same address?

(Asked by: username_0 on 2017-10-03)

I would like to know the consequences of sending bitcoin several times to the same address. Let us say I send 1 BTC from Address1 to Address3 and later I send 2 BTC from Address2 to Address3 again.
The blockchain will have both, 1 BTC and 2 BTC transactions registered. So, What hapens when I want to send 2.5 NTC from Address3 to a new address?

**Tags:** transactions, bitcoin-core, change, transaction-input


---

## 1 answers

### Answer by username_1 on 2017-10-03. Score: 4

It works just fine.

Bitcoin transactions can have multiple inputs and outputs; each input is a "pointer" to an output of a previous transaction (specifically, it consists of a transaction id and output index). So you would create a new transaction with two inputs:

* the A1->A3 transaction (or more properly, the particular output of this transaction that credited A3)
* the A2->A3 transaction (again, the particular output).

It's not necessary to include amounts in the inputs, since the rule is that each input must be consumed completely. So we now have 3 BTC worth of inputs in our transaction.

An output consists of an amount and a destination address. (One can also have a script which directs the payment in more elaborate ways, requiring multiple signatures, etc, but let's ignore that for now.) You would want to have two outputs:

* An output paying 2.5 BTC to the desired destination address, call it A4
* An output paying the "change", 0.5 BTC, to some address of yours. You could use A3 again, but it is generally better to use a newly generated address; call it A5.

(Actually, in real life, the second output would more likely be something like 0.4995 BTC. The leftover 0.0005 BTC wouldn't appear in any output; it would be a transaction fee, collected by whichever miner includes this transaction in a block.)

For an end user, this is all done under the hood by their wallet software. The user just specifies that they want to pay 2.5 BTS to A4, and the software takes care of identifying appropriate transactions to use as inputs and creating the necessary change output. Sometimes this confuses people when they see that after the transaction, the balance in A3 has dropped from 3 to 0, if they don't know that the remaining 0.5 BTC has gone to a new address A5 which is still theirs.

> **Comments:**
> **username_0**: Thanks indeed Steven. It is a very ellaborated answer. However I still have doubts at the protocol level. Let me explain, the first transaction (A1->A3) is saved in block 444,444 of teh blockchain, and the second transaction (A2->A3) is saved in block 444,555 (111 blocks later). When I try to move the balance, there are two different blocks with two different balnces fo rthe same address (A3). DOes it men then that the protocol adds up all unspent balances for a given address? (reviewing then the whole blockchain).  
> **username_1**: On the contrary - the blocks don't contain balance information at all, so there is no inconsistency.  There is a transaction with amount 2 BTC, and another transaction with amount 1 BTC.  Nowhere in the blockchain are these numbers added to make 3 BTC; in fact, the blockchain doesn't form any connection between multiple transactions with the same address. It's up to your client software to keep track of all the unspent outputs in the chain that correspond to your addresses, and sum them to show your total balance.  
> **username_2**: The system doesn't care that the same key happens to be able to claim both unspent outputs. As far as it's concerned, they're just two unspent outputs in a pool of many, many unspent outputs.  

---

