I am not able to get JSON-RPC response via curl. It seems like is not accepting requests.

My bitcoin.conf


Running daemon

$ bitcoind -conf=~/.bitcoin/bitcoin.conf -daemon
Bitcoin server starting

Checking cli

$ bitcoin-cli -conf=~/.bitcoin/bitcoin.conf getinfo
  "version": 140200,
  "protocolversion": 70015,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 439348,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 254620187304.0614,
  "testnet": false,
  "keypoololdest": 1500029964,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""

Testing curl

$ curl http://localhost:3333
curl: (7) Failed to connect to localhost port 3333: Connection refused

Of course, the port is wrong:

$ curl http://localhost:9332
JSONRPC server handles only POST requests

Making a post

$ curl http://localhost:8332 -H 'content-type:text/plain;' --data-binary ''

The output is always empty, doesn't matter if I add data or user,password. Is always empty:

$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'
$ curl --user USER:PASS http://localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'

Any ideas why is this happening? Don't know what else to try.

  • 1
    Can you add the verbose option and tell us what is says? -v / --verbose
    – m1xolyd1an
    Jul 15, 2017 at 4:41

3 Answers 3


If you're on Amazon AWS try this:

setsebool -P httpd_can_network_connect 1

I had the same problem and it took me hours to figure out that the server was blocking connections. I thought it wasn't the problem because my AWS security group allowed it. But apparently the server was blocking it directly.


For anyone trying to connect locally to a wallet:

I managed to get mine working locally by changing rpcallowip and rpcconnect from to my actual local I.P. address (e.g., seems that by using default localhost or does not always work.


add this to bitcoin.conf


allow all ip

  • 3
    This is incredibly insecure. You should only allow the IPs you will be connecting from. May 18, 2018 at 7:35
  • this allowed me to test locally after hours of trying specific ips. Will not use for production though.
    – Anekdotin
    May 5, 2023 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.