5

I have been trying to connect to a remote bitcoind -daemon running server. I can access it with the curl command explained at the end of the page here (https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)) by putting in the correct port number, but when I try to call from a remote host, I get a:

curl: (7) couldn't connect to host

error

I checked with netstat and it looks like bitcoind is listening on the port (otherwise I wouldn't be able to do rpc locally), and accepting all incoming IP addresses.

My bitcoin.config file also allows for all IP addresses and rpc (no ssl, although if anyone has a detailed decscription of how ).

I also made sure that I opened up a TCP port.

Here's the curl command I'm using:

curl --user <user> --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' <ip address:port>

Does anyone know what else might be wrong?

2 Answers 2

5

Bitcoin disallows rpc requests from IP addresses other than 127.0.0.1 Try adding

rpcallowip=<your ip addres>

to your bitcoin configuration file.

More info

3
  • Already did that, still not working...I have it set to rpcallowip=*
    – ZenBalance
    Feb 20, 2013 at 5:57
  • @ZenBalance Hmmm. Can you post your curl command?
    – Nick ODell
    Feb 20, 2013 at 6:34
  • curl --user <user> --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' <ip address:port>
    – ZenBalance
    Feb 20, 2013 at 7:39
4

Answer: It ends up that the firewall setting for the network were set in such a way that they were blocking the connection even though the port was open on the computer.

For those who also run into this problem:

-If you curl the server and the connection is instantly refused, then you need to open up the port in your ip tables.

-If your curl hangs like mine above and/or returns a curl: (7) error like above (and you have verified that both the rpc curl from the localhost of the bitcoind server is working and another port on the bitcoind server can be pinged remotely) then you probably have either computer firewall or network firewall settings blocking your port.

Your Answer

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

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