Can't make successful call via remote JSON RPC

2

enter image description here

I can verify that my node is up and that the port is up via the above method, however no amount of effort has allowed me to successfully make a remote RPC call.

I am booting my node via $ bitcoind -daemon

I can make RPC calls via the same server without an issue using $ bitcoin-cli getinfo

My bitcoin.conf file looks like:

rpcuser=rpcuser rpcpassword=anthony rpcallowip=::/0

I have also tried:

rpcuser=notmyrealuser rpcpassword=notmyrealpass rpcallowip=0.0.0.0/

Without luck, both of which were suggested here: https://github.com/bitcoin/bitcoin/issues/4894 by the lead Bitcoin engineer.

I am trying to authenticate using curl, the two scripts I am using are:

curl --user notmyrealuser --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://124.223.81.11:8333/

and also: curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://notmyrealuser:notmyrealpass@104.223.81.11:8333/

Nothing is working so I figured I would ask here after several hours of not making progress, everytime I receive:

curl: (52) Empty reply from server

Anthony

Posted 2016-03-19T21:37:42.533

Reputation: 151

Answers

5

You're trying to send RPC queries to the P2P network port. You should use port 8332 instead of 8333.

Bitcoin Core:

  • interacts with other Bitcoin nodes on the network using the P2P protcol via port 8333 (or whatever you configure -port to be)
  • responds to RPC queries (JSON-RPC) via port 8332 (or whatever you configure -rpcport to be).

Pieter Wuille

Posted 2016-03-19T21:37:42.533

Reputation: 54 032

And just like that it's working. :) Infinite thanks man!Anthony 2016-03-19T23:59:24.803

I have the same issue. it's still "connection refused" for me even though i use 8332. but works locally when i execute on my cloud instance as 127.0.0.1:8332

any other things to check ? – Sonic Soul 2018-08-22T12:06:18.707

i get a different error on 8333: "RemoteDisconnected: Remote end closed connection without response"Sonic Soul 2018-08-22T12:13:57.463