<p>Please keep in mind that exposing your node's RPC interface to the entire internet is considered to be unsafe. RPCs are not encrypted so anything that you send to your node will be in cleartext for any man in the middle to see. This includes things such as your RPC username, RPC password, and wallet password. If an attacker were to see any of this information, they can execute commands on your node including ones that move any Bitcoin stored in its wallet. Attackers can also do other things like force your node onto an alternative blockchain or force your node to connect only to malicious peers.</p>

<p>Instead of exposing your node's RPC interface publicly, you should instead setup a VPN which has your VPS and other computers that will access your node's RPC interface and have the RPC interface exposed to the VPN. This is far safer as the RPCs will be encrypted and only computers within your VPN will be able to access your node.</p>

<hr>

<p>The reason that you see that error is that Bitcoin Core no longer binds to <code>0.0.0.0/0</code> when <code>-rpcallowip=0.0.0.0/0</code> is set. You must explicitly tell it to bind to <code>0.0.0.0</code> using <code>-rpcbind=0.0.0.0</code>. This functionality was removed for the reasons stated above. I highly recommend that you do not do this and instead setup a VPN and then bind your node to your IP address within that VPN.</p>

CC BY-SA 4.0
2019-07-09T17:47:26.310Z
Thanks for detailed response, decided to try similar by ssh tunnel with rsa authefication. Seems to be a good solution
ruhtren
CC BY-SA 4.0
2019-07-09T17:34:26.860Z
2019-07-09T17:34:26.860Z
Ava Chow
<p>If anyone got problem with reaching bitcoin-rpc server located on vps, the best way in my opinion would be port redirecting over shh. By this command:</p>

<pre><code>ssh [user]@[host] -p [port] -L 18332:127.0.0.1:18332
</code></pre>

<p>You will be able to send comands to testnet rpc-server via your computer terminal as localhost.</p>

CC BY-SA 4.0
2019-07-12T11:25:22.883Z
2019-07-12T11:25:22.883Z
ruhtren
<p>I got vps with ubuntu 18.04 with ssh access and bitoind set up on it. This is my bitcoin.conf file:</p>

<pre><code>testnet=1
prune=35840
maxconnections=12
muxuploadtarget=20
daemon=1
server=1
rpcclienttimeout=5000
rpcuser=[usr]
rpcpassword=[psw]
rpcallowip=0.0.0.0/0
</code></pre>

<p>This is my rpc call:</p>

<pre><code>curl --data '{"jsonrpc":"2.0","method":"getwalletinfo","params":[]}' http://[usr]:[psw]@localhost:18332
</code></pre>

<p>When it given in vps terminal, that return json response just like it meant to be, but when i got this request on another machine:</p>

<pre><code>curl --data '{"jsonrpc":"2.0","method":"getwalletinfo","params":[]}' http://[usr]:[psw]@[myvpsip]:18332
</code></pre>

<p>terminal returns: </p>

<pre><code>curl: (7) Failed to connect to [myvpsip]: Connection refused
</code></pre>

<p>This is my result for "sudo netstat -tuwpln" on vps, pasted results only with bitcoind:
:</p>

<pre><code>Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      2027/bitcoind       
tcp        0      0 0.0.0.0:18333           0.0.0.0:*               LISTEN      2027/bitcoind       
tcp6       0      0 ::1:18332               :::*                    LISTEN      2027/bitcoind       
tcp6       0      0 :::18333                :::*                    LISTEN      2027/bitcoind   
</code></pre>

<p>Already checked firewall and it has Status: inactive. Iptables also empty. Got connection over ssh, so server is able. Also pinged well. I still think that problem is in bitcoin.conf but don't know exactly where is it. Can anyone help solving this problem? I would be really greatful</p>

<p>P.S. Writing script on python and one part of it is bitcoin payments, so really need solution for this. If there easier way for payments would like to familirize.</p>

CC BY-SA 4.0
2019-07-09T15:33:18.513Z
Which VPS provider are you using? Many, such as GCP and AWS, block all ports except SSH, HTTP, and HTTPS by default, you may need to open the port using your provider's control panels
Raghav Sood
CC BY-SA 4.0
2019-07-09T15:37:20.573Z
Thanks for reply. My provider is Hostwinds, in firewall setiing it says All Traffic allowed by default
ruhtren
<bitcoind><json-rpc><linux><ubuntu><bitcoin.conf>
Can't reach remote bitcoin rpc server
ruhtren
# Can't reach remote bitcoin rpc server

(Asked by: username_0 on 2019-07-09)

I got vps with ubuntu 18.04 with ssh access and bitoind set up on it. This is my bitcoin.conf file:

```
testnet=1
prune=35840
maxconnections=12
muxuploadtarget=20
daemon=1
server=1
rpcclienttimeout=5000
rpcuser=[usr]
rpcpassword=[psw]
rpcallowip=0.0.0.0/0

```

This is my rpc call:

```
curl --data '{"jsonrpc":"2.0","method":"getwalletinfo","params":[]}' http://[usr]:[psw]@localhost:18332

```

When it given in vps terminal, that return json response just like it meant to be, but when i got this request on another machine:

```
curl --data '{"jsonrpc":"2.0","method":"getwalletinfo","params":[]}' http://[usr]:[psw]@[myvpsip]:18332

```

terminal returns:

```
curl: (7) Failed to connect to [myvpsip]: Connection refused

```

This is my result for "sudo netstat -tuwpln" on vps, pasted results only with bitcoind:
:

```
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      2027/bitcoind       
tcp        0      0 0.0.0.0:18333           0.0.0.0:*               LISTEN      2027/bitcoind       
tcp6       0      0 ::1:18332               :::*                    LISTEN      2027/bitcoind       
tcp6       0      0 :::18333                :::*                    LISTEN      2027/bitcoind   

```

Already checked firewall and it has Status: inactive. Iptables also empty. Got connection over ssh, so server is able. Also pinged well. I still think that problem is in bitcoin.conf but don't know exactly where is it. Can anyone help solving this problem? I would be really greatful

P.S. Writing script on python and one part of it is bitcoin payments, so really need solution for this. If there easier way for payments would like to familirize.

**Tags:** bitcoind, json-rpc, linux, ubuntu, bitcoin.conf

> **Comments:**
> **username_1**: Which VPS provider are you using? Many, such as GCP and AWS, block all ports except SSH, HTTP, and HTTPS by default, you may need to open the port using your provider's control panels  
> **username_0**: Thanks for reply. My provider is Hostwinds, in firewall setiing it says All Traffic allowed by default  

---

## 2 answers

### Answer by username_2 on 2019-07-09. Score: 5

Please keep in mind that exposing your node's RPC interface to the entire internet is considered to be unsafe. RPCs are not encrypted so anything that you send to your node will be in cleartext for any man in the middle to see. This includes things such as your RPC username, RPC password, and wallet password. If an attacker were to see any of this information, they can execute commands on your node including ones that move any Bitcoin stored in its wallet. Attackers can also do other things like force your node onto an alternative blockchain or force your node to connect only to malicious peers.

Instead of exposing your node's RPC interface publicly, you should instead setup a VPN which has your VPS and other computers that will access your node's RPC interface and have the RPC interface exposed to the VPN. This is far safer as the RPCs will be encrypted and only computers within your VPN will be able to access your node.

---

The reason that you see that error is that Bitcoin Core no longer binds to `0.0.0.0/0` when `-rpcallowip=0.0.0.0/0` is set. You must explicitly tell it to bind to `0.0.0.0` using `-rpcbind=0.0.0.0`. This functionality was removed for the reasons stated above. I highly recommend that you do not do this and instead setup a VPN and then bind your node to your IP address within that VPN.

> **Comments:**
> **username_0**: Thanks for detailed response, decided to try similar by ssh tunnel with rsa authefication. Seems to be a good solution  

---

### Answer by username_0 on 2019-07-12. Score: 4

If anyone got problem with reaching bitcoin-rpc server located on vps, the best way in my opinion would be port redirecting over shh. By this command:

```
ssh [user]@[host] -p [port] -L 18332:127.0.0.1:18332

```

You will be able to send comands to testnet rpc-server via your computer terminal as localhost.


---

