3

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.

  • i'm feeling like i should rephrase that to "what is vout". specifying all vout:0 works just fine. – kanojo Aug 19 '13 at 13:17
  • I agree, "What is the 'vout' parameter and what value should it for createrawtransaction?" would be a much better title for this question. :) – Murch Aug 19 '13 at 14:34
  • The answer to "In getrawtransaction, what is the vout integer in the vin list?" might be helpful to answer this question. – Murch Aug 22 '13 at 16:47
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:

  • @Murch

this is a manual for original satoshi client.

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.

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}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.