0
$\begingroup$

This question already has an answer here:

When querying Monero deamon via JSON-RPC as described in Daemon RPC documentation, via Curl, everithing pass fine :

curl -X POST http://127.0.0.1:18081/json_rpc -d "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"getblockcount\"}" -H "Content-Type:application/json"

internal \" is escaped double quote.
Return:

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "count": 1313381,
    "status": "OK"
  }
}

But when I try similar in Mathematica:

URLFetch["http://127.0.0.1:18081/json_rpc", Method -> "POST", 
 "Parameters" -> {"jsonrpc" -> "2.0", "id" -> "0", 
   "method" -> "getblockcount"}, 
 "Headers" -> {"Content-Type" -> "application/json"}]

Mathematica returns:

{
  "error": {
    "code": -32700,
    "message": "Parse error"
  },
  "id": 0,
  "jsonrpc": ""
}

and Monero deamon reports log error:

2017-05-19 09:18:56.657 [RPC1]  ERROR   net.http        contrib/epee/include/storages/portable_storage_from_json.h:83   Wrong JSON character at: jsonrpc=2.0&id=0&method=getblockcount
2017-05-19 09:18:56.657 [RPC1]  ERROR   net.http        contrib/epee/include/storages/portable_storage_from_json.h:368  Failed to parse json, what: Wrong JSON character at: jsonrpc=2.0&id=0&method=getblockcount

please help with aranging JSON-RPC query string in Mathematica for querying Monero blockchain deamon.

NOTE: If you go to try with Monero deamon, as I described, you konw that deamon will download full blockchain that is about 16GB in size on your local storage.

$\endgroup$

marked as duplicate by Kuba May 19 '17 at 8:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ What comes after -d is a Body/Content, not parameters. See 144449, does "Body" -> ExportString[{"jsonrpc" -> "2.0", "id" -> "0", "method" -> "getblockcount"}, "JSON"] work? $\endgroup$ – Kuba May 19 '17 at 7:30
  • $\begingroup$ @Kuba, yes, thank you. $\endgroup$ – Dragutin May 19 '17 at 8:06

Browse other questions tagged or ask your own question.