<p>In Bitcoin, it is not possible to associate specific inputs with specific outputs within one transaction. </p>

<p>This means that you are required to create multiple transactions to achieve what you want to do.</p>

<p>This <a href="https://en.bitcoin.it/wiki/Raw_Transactions#createrawtransaction_.5B.7B.22txid.22%3atxid.2C.22vout.22%3an.7D.2C....5D_.7Baddress%3aamount.2C....7D" rel="nofollow">wiki article</a> and this <a href="https://bitcointalk.org/index.php?topic=133769.0" rel="nofollow">forum post</a> explain how to do create raw transactions for spending specific outputs.</p>

CC BY-SA 3.0
2014-03-24T11:44:53.807Z
2014-03-24T11:44:53.807Z
Steven Roose
<p>In a bitcoin transaction, the coins from the inputs are added together into a pool, and then sent to the outputs. There isn't a notion of particular coins; just a total number of coins.</p>

CC BY-SA 3.0
2014-03-25T08:34:04.183Z
2014-03-25T08:34:04.183Z
Richard Kiss
<p>For convenience purposes let's say I need to make these payments (and let's pretend that tx fees do not exist):</p>

<ul>
<li>Address A: 1 BTC </li>
<li>Address B: 2 BTC </li>
<li>Address C: 3 BTC</li>
</ul>

<p>My balance is 6 BTC that consists of these spendable inputs:</p>

<ul>
<li>Tx1: 0.5 BTC</li>
<li>Tx2: 0.5 BTC</li>
<li>Tx3: 0.5 BTC</li>
<li>Tx4: 4.5 BTC</li>
</ul>

<p>It's easy now to create a raw tx using <code>createrawtransaction</code> and since the inputs' sum matches the outputs' sum (and we pretend there are no tx fees whatsoever) everything will work as expected.</p>

<p>But what if I must (for business purposes) use specific inputs for each output?</p>

<p>An example would be:</p>

<ul>
<li>Address A will be paid inputs: Tx1 and Tx3</li>
<li>Address B and Address C will be paid by inputs: Tx2 and Tx4</li>
</ul>

<p>These will be batch payments and I plan to be sending batches of 20-30 logical payments per raw tx, so I would like to avoid breaking down the raw tx into small, atomic (per-logical-payments) transactions.</p>

<p>Is that even possible with raw transactions?</p>

CC BY-SA 3.0
2014-03-23T20:40:15.753Z
As far as I know, if you want to tie certain inputs to certain outputs, that's a matter for your internal accounting.  The Bitcoin protocol doesn't provide any way to make such an association, short of breaking them into multiple transactions.
Nate Eldredge
CC BY-SA 3.0
2014-03-23T20:54:00.553Z
Thanks @NateEldredge. So basically you say that if there is only one combinations where distinct inputs fit to the corresponding outputs then this is possible, buthow do we know how the coin selection works in this case?
Doug Peters
<raw-transaction>
Is tighting inputs to specific outputs possible within one transaction?
Doug Peters
# Is tighting inputs to specific outputs possible within one transaction?

(Asked by: username_0 on 2014-03-23)

For convenience purposes let's say I need to make these payments (and let's pretend that tx fees do not exist):

* Address A: 1 BTC
* Address B: 2 BTC
* Address C: 3 BTC

My balance is 6 BTC that consists of these spendable inputs:

* Tx1: 0.5 BTC
* Tx2: 0.5 BTC
* Tx3: 0.5 BTC
* Tx4: 4.5 BTC

It's easy now to create a raw tx using `createrawtransaction` and since the inputs' sum matches the outputs' sum (and we pretend there are no tx fees whatsoever) everything will work as expected.

But what if I must (for business purposes) use specific inputs for each output?

An example would be:

* Address A will be paid inputs: Tx1 and Tx3
* Address B and Address C will be paid by inputs: Tx2 and Tx4

These will be batch payments and I plan to be sending batches of 20-30 logical payments per raw tx, so I would like to avoid breaking down the raw tx into small, atomic (per-logical-payments) transactions.

Is that even possible with raw transactions?

**Tags:** raw-transaction

> **Comments:**
> **username_1**: As far as I know, if you want to tie certain inputs to certain outputs, that's a matter for your internal accounting.  The Bitcoin protocol doesn't provide any way to make such an association, short of breaking them into multiple transactions.  
> **username_0**: Thanks @username_1. So basically you say that if there is only one combinations where distinct inputs fit to the corresponding outputs then this is possible, buthow do we know how the coin selection works in this case?  

---

## 2 answers

### Answer by username_2 on 2014-03-24. Score: 0 | Accepted answer

In Bitcoin, it is not possible to associate specific inputs with specific outputs within one transaction.

This means that you are required to create multiple transactions to achieve what you want to do.

This [wiki article](https://en.bitcoin.it/wiki/Raw_Transactions#createrawtransaction_.5B.7B.22txid.22%3atxid.2C.22vout.22%3an.7D.2C....5D_.7Baddress%3aamount.2C....7D) and this [forum post](https://bitcointalk.org/index.php?topic=133769.0) explain how to do create raw transactions for spending specific outputs.


---

### Answer by username_3 on 2014-03-25. Score: 0

In a bitcoin transaction, the coins from the inputs are added together into a pool, and then sent to the outputs. There isn't a notion of particular coins; just a total number of coins.


---

