<p>ok, i figured it out. the correct answer to the following example will look this way:</p>

<pre><code># get your unspent transactions
listunspent
# select the ones you want to pour BTC from, please also note their 'vout', it is an output of a transaction you own a private key to and therefore able to spend.
createrawtransaction '[{"txid":"aaaa...","vout":0},{"txid":"bbbb...","vout":0}]' '{"1mainaddr...":0.02}'
# explained: you are using two outputs, of total 0.0205 BTC. you give away 0.0005 fee and you keep 0.02 at your 1mainaddr...
# you can dump the resulting transaction draft to see how it'll look like
decoderawtransaction &lt;...result_from_createrawtransaction...&gt;
# sign it with your private keys
signrawtransaction &lt;...result_from_createrawtransaction...&gt;
# if it returns you a hex with "complete" : true, you can now send it off to network
# if it returns "complete" : false, you either don't have a private key for signing, or you might have specified invalid 'vout'. google for more possible problems, those were two i experienced.
sendrawtransaction &lt;...result_from_signrawtransaction_hex...&gt;
</code></pre>

<p><strong>references</strong>:</p>

<ul>
<li>people.xiph.org/~greg/signdemo.txt</li>
<li>bitcointalk.org/index.php?topic=101525.0</li>
</ul>

<p><strong>thanks</strong>:</p>

<ul>
<li>@Murch</li>
</ul>

<p>this is a manual for original satoshi client.</p>

CC BY-SA 3.0
2013-08-19T21:12:38.217Z
2013-08-19T21:12:38.217Z
kanojo
<p>From the command line, you need to add commas around the parameters and format the JSON correctly.</p>

<p>For example:</p>

<pre><code>bitcoind createrawtransaction '[{"txid":"aaaa"...,"vout"=0},{"txid":"bbbb"...,"vout"=1}]' '{"1mainaddr"...=0.02}'
</code></pre>

CC BY-SA 3.0
2014-10-29T18:12:30.087Z
2015-05-19T06:02:22.807Z
2015-05-19T06:02:22.807Z
ethought
<p>vout is the serial number of the output you're redeeming in its transaction.</p>

<p>For example, if you want to redeem the first output in the transaction with hash X, you specify X for txid and 0 for vout. If you want the second output in that transaction, you specify 1 for vout instead, etc.</p>

CC BY-SA 3.0
2013-08-19T15:35:07.867Z
2013-08-19T15:35:07.867Z
Meni Rosenfeld
<p>following the manual on <a href="https://bitcointalk.org/index.php?topic=101525.0" rel="nofollow">https://bitcointalk.org/index.php?topic=101525.0</a> , i would like to merge multiple fractions of BTC <strong>from multiple</strong> addresses i own, <strong>to</strong> another <strong>single</strong> address i own(reassemble, sort of, organize stuff). how will my approach look like? i still don't get what does "vout" value mean in the <em>createrawtransaction</em>? i think it's about this:</p>

<pre><code># assume i would like to merge transactions "aaaa..." and "bbbb..." to address "1mainaddr..."
# "aaaa..." has 0.01  btc unspent
# "bbbb..." has 0.0105 btc unspent
# "1mainaddr..." is emtpy
# i would like to pay 0.0005 btc as a fee

createrawtransaction [{txid:aaaa...,vout=0},{txid:bbbb...,vout=1}] {1mainaddr...=0.02}
</code></pre>

<p>is that correct?
i would like to first test this on testnet but still waiting on block confirmations. i'd appreciate 1-2 testnet BTC on <em>moBHB5euzHyKtcabpD3UND9PYB994cisqb</em> and will return it to you once block 101602 is confirmed.</p>

CC BY-SA 3.0
2013-08-19T13:17:43.670Z
i'm feeling like i should rephrase that to "what is vout". specifying all vout:0 works just fine.
kanojo
CC BY-SA 3.0
2013-08-19T14:34:14.660Z
I agree, "What is the 'vout' parameter and what value should it for createrawtransaction?" would be a much better title for this question. :)
Murch
CC BY-SA 3.0
2013-08-22T16:47:53.320Z
The answer to ["In getrawtransaction, what is the vout integer in the vin list?"](http://bitcoin.stackexchange.com/q/11411/5406) might be helpful to answer this question.
Murch
<transactions><address><transaction-fees>
createrawtransaction, multiple outputs, single input?
kanojo
# createrawtransaction, multiple outputs, single input?

(Asked by: username_0 on 2013-08-19)

following the manual on <https://bitcointalk.org/index.php?topic=101525.0> , i would like to merge multiple fractions of BTC **from multiple** addresses i own, **to** another **single** address i own(reassemble, sort of, organize stuff). how will my approach look like? i still don't get what does "vout" value mean in the *createrawtransaction*? i think it's about this:

```
# assume i would like to merge transactions "aaaa..." and "bbbb..." to address "1mainaddr..."
# "aaaa..." has 0.01  btc unspent
# "bbbb..." has 0.0105 btc unspent
# "1mainaddr..." is emtpy
# i would like to pay 0.0005 btc as a fee

createrawtransaction [{txid:aaaa...,vout=0},{txid:bbbb...,vout=1}] {1mainaddr...=0.02}

```

is that correct?
i would like to first test this on testnet but still waiting on block confirmations. i'd appreciate 1-2 testnet BTC on *moBHB5euzHyKtcabpD3UND9PYB994cisqb* and will return it to you once block 101602 is confirmed.

**Tags:** transactions, address, transaction-fees

> **Comments:**
> **username_0**: i'm feeling like i should rephrase that to "what is vout". specifying all vout:0 works just fine.  
> **username_1**: I agree, "What is the 'vout' parameter and what value should it for createrawtransaction?" would be a much better title for this question. :)  
> **username_1**: The answer to ["In getrawtransaction, what is the vout integer in the vin list?"](http://bitcoin.stackexchange.com/q/11411/5406) might be helpful to answer this question.  

---

## 3 answers

### Answer by username_0 on 2013-08-19. Score: 4

ok, i figured it out. the correct answer to the following example will look this way:

```
# get your unspent transactions
listunspent
# select the ones you want to pour BTC from, please also note their 'vout', it is an output of a transaction you own a private key to and therefore able to spend.
createrawtransaction '[{"txid":"aaaa...","vout":0},{"txid":"bbbb...","vout":0}]' '{"1mainaddr...":0.02}'
# explained: you are using two outputs, of total 0.0205 BTC. you give away 0.0005 fee and you keep 0.02 at your 1mainaddr...
# you can dump the resulting transaction draft to see how it'll look like
decoderawtransaction <...result_from_createrawtransaction...>
# sign it with your private keys
signrawtransaction <...result_from_createrawtransaction...>
# if it returns you a hex with "complete" : true, you can now send it off to network
# if it returns "complete" : false, you either don't have a private key for signing, or you might have specified invalid 'vout'. google for more possible problems, those were two i experienced.
sendrawtransaction <...result_from_signrawtransaction_hex...>

```

**references**:

* people.xiph.org/~greg/signdemo.txt
* bitcointalk.org/index.php?topic=101525.0

**thanks**:

* @username_1

this is a manual for original satoshi client.


---

### Answer by username_2 on 2014-10-29. Score: 2

From the command line, you need to add commas around the parameters and format the JSON correctly.

For example:

```
bitcoind createrawtransaction '[{"txid":"aaaa"...,"vout"=0},{"txid":"bbbb"...,"vout"=1}]' '{"1mainaddr"...=0.02}'

```


---

### Answer by username_3 on 2013-08-19. Score: 2

vout is the serial number of the output you're redeeming in its transaction.

For example, if you want to redeem the first output in the transaction with hash X, you specify X for txid and 0 for vout. If you want the second output in that transaction, you specify 1 for vout instead, etc.


---

