Bitcoin Forum
May 22, 2024, 02:59:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting error when using createrawtransaction  (Read 807 times)
oshirowanen (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 10


View Profile
June 07, 2014, 05:21:43 PM
 #1

Anyone know why the following command is not working for me in bitcoin-qt [testnet] > debug window > console?

createrawtransaction [{"txid":d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262,"vout":1}]{mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g:0.05}

Error: Error parsing JSON:[{"txid":d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262,"vout":1}]{mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g:0.05}

I got the txid and vout values from listunspent:

listunspent
[
{
"txid" : "d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262",
"vout" : 1,
"address" : "mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1",
"account" : "From http://faucet.xeno-genesis.com/",
"scriptPubKey" : "76a914a134b5919d09350f6232260ed1313f73ac6b7bae88ac",
"amount" : 1.25004817,
"confirmations" : 2
}
]
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
June 08, 2014, 12:37:04 AM
 #2

Anyone know why the following command is not working for me in bitcoin-qt [testnet] > debug window > console?

createrawtransaction [{"txid":d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262,"vout":1}]{mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g:0.05}

Error: Error parsing JSON:[{"txid":d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262,"vout":1}]{mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g:0.05}

I got the txid and vout values from listunspent:

listunspent
[
{
"txid" : "d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262",
"vout" : 1,
"address" : "mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1",
"account" : "From http://faucet.xeno-genesis.com/",
"scriptPubKey" : "76a914a134b5919d09350f6232260ed1313f73ac6b7bae88ac",
"amount" : 1.25004817,
"confirmations" : 2
}
]


Does this work?

Code:
createrawtransaction '[{"txid":"d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262","vout":1}]' '{"mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g":0.05000000,"mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1":1.19994817}'

Huh
oshirowanen (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 10


View Profile
June 08, 2014, 08:17:16 AM
 #3

Does this work?

Code:
createrawtransaction '[{"txid":"d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262","vout":1}]' '{"mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g":0.05000000,"mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1":1.19994817}'

Huh

It does't return the JSON error which is a step forward.  Thanks!

Looks like I also missed out the change return address.  I have noticed that you worked out the change to be less by 0.0001BTC, which I assume goes towards fees?  If that is the case, how did you work out the fees?  Is it always 0.0001BTC?
Yuki1988
Hero Member
*****
Offline Offline

Activity: 614
Merit: 500



View Profile
June 08, 2014, 08:29:14 AM
 #4

I have noticed that you worked out the change to be less by 0.0001BTC, which I assume goes towards fees?

Yup, the difference between inputs and outputs will go towards tx fee. So, please never ever forget to include the change.

If that is the case, how did you work out the fees?  Is it always 0.0001BTC?

It depends on the tx size in KB (number of inputs and outputs).
For details, please refer to http://bitcoinfees.com/



oshirowanen (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 10


View Profile
June 08, 2014, 08:45:40 AM
 #5

I have noticed that you worked out the change to be less by 0.0001BTC, which I assume goes towards fees?

Yup, the difference between inputs and outputs will go towards tx fee. So, please never ever forget to include the change.

If that is the case, how did you work out the fees?  Is it always 0.0001BTC?

It depends on the tx size in KB (number of inputs and outputs).
For details, please refer to http://bitcoinfees.com/




Thanks, based on http://bitcoinfees.com/, I didn't have to pay a fee in this particular case.  Is that correct?  As it says:

Quote from: bitcoinfees.com
f any of the outputs (including any change) of your transaction are less than 0.01 XBT, then a fee of 0.0001 XBT is required

So as I was sending 0.05XBT, the fee was optional.  Is that right?
Yuki1988
Hero Member
*****
Offline Offline

Activity: 614
Merit: 500



View Profile
June 08, 2014, 09:00:59 AM
 #6

based on http://bitcoinfees.com/, I didn't have to pay a fee in this particular case.  Is that correct?  As it says:

Quote from: bitcoinfees.com
f any of the outputs (including any change) of your transaction are less than 0.01 XBT, then a fee of 0.0001 XBT is required

So as I was sending 0.05XBT, the fee was optional.  Is that right?

You should continue reading section 3. Smiley
Quote
If the coins you're spending are too small or too new then your transaction won't qualify as free.

Basically speaking, if you transaction qualifies as "high-priority" (https://en.bitcoin.it/wiki/Transaction_fees#Technical_info) and have no dust outputs, you can choose to not pay any transaction fee.
It may take a little bit more time to get your transaction included in a block though.

oshirowanen (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 10


View Profile
June 08, 2014, 09:18:21 AM
Last edit: June 08, 2014, 09:59:03 AM by oshirowanen
 #7

Thanks for all the help!
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
June 08, 2014, 07:39:02 PM
 #8

Yup, the difference between inputs and outputs will go towards tx fee. So, please never ever forget to include the change.

This is important enough, that it's worth repeating.

The inputs provide value to the transaction.  Add up all the value from all the inputs, and that is the total transaction value.

Then the outputs assign that value to one or more outputs.

Any remaining unassigned value is a transaction fee to the miners.



If the total of all your outputs is greater than the total value supplied by all your inputs, then you have an invalid transaction.

If the total of all your outputs is equal to the total value supplied by all your inputs, then you have a valid transaction that is not paying any fee.

If the total of all your outputs is less than the total value supplied by all your inputs, then ALL REMAINING UNASSIGNED VALUE BECOMES TRANSACTION FEES FOR THE MINERS.
ondratra
Sr. Member
****
Offline Offline

Activity: 350
Merit: 250



View Profile
June 09, 2014, 12:14:01 AM
 #9

Yup, the difference between inputs and outputs will go towards tx fee. So, please never ever forget to include the change.

This is important enough, that it's worth repeating.

The inputs provide value to the transaction.  Add up all the value from all the inputs, and that is the total transaction value.

Then the outputs assign that value to one or more outputs.

Any remaining unassigned value is a transaction fee to the miners.



If the total of all your outputs is greater than the total value supplied by all your inputs, then you have an invalid transaction.

If the total of all your outputs is equal to the total value supplied by all your inputs, then you have a valid transaction that is not paying any fee.

If the total of all your outputs is less than the total value supplied by all your inputs, then ALL REMAINING UNASSIGNED VALUE BECOMES TRANSACTION FEES FOR THE MINERS.

Can I use 'sendmany' or any other API call for sending to multiple people(multiple outputs) but paying just one fee??? When I used sendmany I had to pay fee for every address specified. Sad
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!