I am running bitcoind on a DigitalOcean droplet with public IP address e.g.

I would like to connect to it via RPC from another DigitalOcean droplet with public IP address e.g.

Both Droplets are running Ubuntu Linux 18.04.

~/.bitcoin/bitcoin.conf on


netstat -ln | grep 8332 on yields:

tcp        0      0*               LISTEN
tcp6       0      0 ::1:8332                :::*                    LISTEN

RPC commands on such as ./bitcoin-cli -rpcuser=x -rpcpassword=x -rpcconnect=localhost -rpcport=8332 getnetworkinfo return normally.

However, on machine, when I run ./bitcoin-cli -rpcuser=x -rpcpassword=x -rpcconnect= -rpcport=8332 getnetworkinfo I get:

error: Could not connect to the server

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

Machine has firewall rules in DigitalOcean as follows:

Type        Protocol        Port Range      Sources
SSH         TCP             22    
Custom      TCP             8332  

Note that SSH into from is working just fine.

sudo iptables -L on gives:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination   

Is there anything obviously wrong in my configuration or setup?

Running curl -v on immediately returns with:

* Rebuilt URL to:
*   Trying
* connect to port 8332 failed: Connection refused
* Failed to connect to port 8332: Connection refused
* Closing connection 0
curl: (7) Failed to connect to port 8332: Connection refused

which from what I have read likely indicates a firewall issue.

  • You need an rpcbind= line in your config, as bitcoind is only binding by default on the localhost interface which in inaccessible to the outside world. Also, what you're doing is highly inadvisable, as anyone on the internet will have access to your RPC interface; it's better to tunnel it using ssh proxies, or using something like stunnel for security. Aug 26, 2019 at 13:48
  • @PieterWuille thank you very much for your comment. I have included rpcbind= in my bitcoind.conf and now I can connect successfully. Regarding your second comment, surely it is safe if I use an IP address whitelist at the network level? Or are you suggesting that someone can spoof the whitelisted IP and connect to my RPC service using the plaintext credentials?
    – user97957
    Aug 26, 2019 at 15:58

1 Answer 1


bitcoin.conf should contain the machine's own IP address as an argument to the rpcbind parameter.

For example, if you are running bitcoind on a machine with IP address and you wish to connect to its RPC server from a different machine, your bitcoin.conf file on machine should contain the line rpcbind=

Your Answer

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