Author

Topic: Problems with curl (Read 781 times)

newbie
Activity: 2
Merit: 0
February 29, 2016, 04:35:01 PM
#3
This is just a guess, but it looks like you are sending it an empty string as the first object in your array

Quote
"params": ["",  "{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002, \"1KigrTAFLRiZQuHEeX1TwfgzvijtvxU4WA\":0.0002}", 6, "testing"]

Have you tried it without an empty string as the first object?

Quote
"params": ["{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002, \"1KigrTAFLRiZQuHEeX1TwfgzvijtvxU4WA\":0.0002}", 6, "testing"]

Tanks for the help.
The first object of the array is the name of the sending account. The empty string means the default account.
Anyway, I dropped the object and rerun the curl command, but this time the server did not even bother to answer an error (and the transaction was not sent).
Giving the same "sendall" command (with the empty string) directly as parameter of bitcoin-cli, however, works.

I am still in trouble.

Michele
hero member
Activity: 798
Merit: 722
February 28, 2016, 01:45:10 PM
#2
This is just a guess, but it looks like you are sending it an empty string as the first object in your array

Quote
"params": ["",  "{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002, \"1KigrTAFLRiZQuHEeX1TwfgzvijtvxU4WA\":0.0002}", 6, "testing"]

Have you tried it without an empty string as the first object?

Quote
"params": ["{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002, \"1KigrTAFLRiZQuHEeX1TwfgzvijtvxU4WA\":0.0002}", 6, "testing"]
newbie
Activity: 2
Merit: 0
February 27, 2016, 10:28:21 AM
#1
Hi all,

  this is my first post on BTC Forum.  I am experimenting with Bitcoin Core RPC, and with curl in particular, on Ubuntu.
  I start the server:  > bitcoind -rest &
  I have a Bitcoin Core wallet just for testing. I am able to call some RPC, using bitcoin-cli and curl, for instance:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaccounts", "params": [6] }' http://USER:[email protected]:8332/

I successfully RPC-ed the "walletpassphrase"

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "walletpassphrase", "params": ["WALLETPASSWD", 60] }' http://USER:[email protected]:8332/ , getting:
{"result":null,"error":null,"id":"curltest"}

When I try to call the "sendmany" procedure, I get errors:

- if I try to transfer 0.0002 BTC to 3 addresses:
  curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["",  "{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002, \"1KigrTAFLRiZQuHEeX1TwfgzvijtvxU4WA\":0.0002}", 6, "testing"] }'  http://USER:[email protected]:8332/ ,  I get:
{"result":null,"error":{"code":-1,"message":"JSON value is not an object as expected"},"id":"curltest"}

- if I try to transfer 0.0002 BTC to 2 addresses (same call): 
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["",  "{\"1HwLtBDtLGeHrLkGWHKfE7WgbCz5FbdWW4\":0.0002, \"1G3kKtEK356sfkKaykQvnv37GFUPR3Lns4\":0.0002}", 6, "testing"] }'  http://USER:[email protected]:8332/  ,  I get:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

  Can someone please help?

TIA

Michele
Jump to: