Author

Topic: createrawtransaction using curl - is it possible? (Read 1147 times)

legendary
Activity: 1316
Merit: 1000
I perform a createrawtransaction with J::R::C here. Maybe by comparing the code you'll be able to figure out what you're doing wrong.

Thank you very much!! I got it working thanks to your example.

One thing that took me a while to figure out even after using your example was not to use dump() to check the input. I knew dump() can change JSON encoded strings. However it seems dumping the $ins and $outs prior to passing to $rpc->createrawtransaction([$ins, $outs]); changes them somehow also. I removed all dump() instances and it worked!!

copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
I dont know anything about curl but your rawtx is broken...

Code:
createrawtransaction
"[
{\"vout\":1,\"txid\":\"0bfa637d84586fc0acee31409fed3f771c78458bad195eb6f2d16ff5d4eaef07\"},
{\"vout\":0,"txid":\"0ec54adfbd8d83f10c5ffb9429431129cf0f6f9ffb096f3c255458032ece5280\"}
]",
"{\"DGV3v6MWakbBzmir9gDNnaU8yV7KGPUTi4\":0.19}"

results in
Code:
Error: Error parsing JSON:[
{"vout":1,"txid":"0bfa637d84586fc0acee31409fed3f771c78458bad195eb6f2d16ff5d4eaef07"},
{"vout":0,txid:"0ec54adfbd8d83f10c5ffb9429431129cf0f6f9ffb096f3c255458032ece5280"}
],

while
Code:
createrawtransaction
"[
{\"txid\":\"0bfa637d84586fc0acee31409fed3f771c78458bad195eb6f2d16ff5d4eaef07\",\"vout\":1},
{\"txid\":\"0ec54adfbd8d83f10c5ffb9429431129cf0f6f9ffb096f3c255458032ece5280\",\"vout\":0}
]"
"{\"DGV3v6MWakbBzmir9gDNnaU8yV7KGPUTi4\":0.19}"

results in

Code:

21:05:31
Invalid Bitcoin address: DGV3v6MWakbBzmir9gDNnaU8yV7KGPUTi4 (code -5)

which is to be expected since I though this was about bitcoin -_-

Hope it helps anyway.
legendary
Activity: 1974
Merit: 1030
After constant 500 server errors using the perl module JSON::RPC::Client I have been trying to use curl directly to see what format the request needs to be in.

However I cannot get createrawtransaction to work with curl either.

I perform a createrawtransaction with J::R::C here. Maybe by comparing the code you'll be able to figure out what you're doing wrong.
legendary
Activity: 1316
Merit: 1000
Have been trying to write a dust cleaner for altcoins in perl.

After constant 500 server errors using the perl module JSON::RPC::Client I have been trying to use curl directly to see what format the request needs to be in.

However I cannot get createrawtransaction to work with curl either.

I have tried just about every different formatting combination I can think of, for example:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": [ "[{\"vout\":1,\"txid\":\"0bfa637d84586fc0acee31409fed3f771c78458bad195eb6f2d16ff5d4eaef07\"},{\"vout\":0,"txid":\"0ec54adfbd8d83f10c5ffb9429431129cf0f6f9ffb096f3c255458032ece5280\"}]","{\"DGV3v6MWakbBzmir9gDNnaU8yV7KGPUTi4\":0.19}" ] }' -H 'content-type: text/plain;' http://user:[email protected]:6666/

Other calls (using perl or curl) do not result in errors for example listtransactions, getinfo, validateaddress etc.

I have read quite a few posts on stackexchange and bitcoinexchange asking if this can be done... There are no answers.

So can it be done? If so, where am I going wrong?

Jump to: