1

I tried every different combination in bitcoin.conf to make my bitcoin node (hosted in AWS protected behind VPN) reachable but nothing seems to work...

Just to clear it out of the way, I opened the port 8332 on the machine.

Here is my bitcoin.conf:

txindex=1
server=1
rest=1
# Auth Credentials For JSON-RPC server
rpcuser=your_username
rpcpassword=your_password

#chain=test
testnet=1

#rpcallowip=0.0.0.0/0

[test]
rest=1
rpcallowip=0.0.0.0/0
rpcallowip=::/0

rpcbind=0.0.0.0:8332

# Listen for JSON-RPC connections on this port
#rpcport=8332

Here is the netstat:

ubuntu@blahblah:~$ sudo ss -ltpn
State                      Recv-Q                      Send-Q                                              Local Address:Port                                              Peer Address:Port                                                                                      
LISTEN                     0                           128                                                       0.0.0.0:18333                                                  0.0.0.0:*                          users:(("bitcoind",pid=14485,fd=29))                           
LISTEN                     0                           128                                                       0.0.0.0:8332                                                   0.0.0.0:*                          users:(("bitcoind",pid=14485,fd=9))                            
LISTEN                     0                           128                                                 127.0.0.53%lo:53                                                     0.0.0.0:*                          users:(("systemd-resolve",pid=644,fd=13))                      
LISTEN                     0                           128                                                       0.0.0.0:22                                                     0.0.0.0:*                          users:(("sshd",pid=760,fd=3))                                  
LISTEN                     0                           128                                                          [::]:18333                                                     [::]:*                          users:(("bitcoind",pid=14485,fd=28))                           
LISTEN                     0                           128                                                          [::]:22                                                        [::]:*                          users:(("sshd",pid=760,fd=4))                   

I cant reach my node with the following RPC call: (locally I can)

curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://your_username:your_password@my_machine_ip:8332

I get timeout:

curl: (28) Failed to connect to my_machine_ip port 8332: Connection timed out

But when I run:

docker run --name mynginx1 -p 8332:80 -d nginx

I can curl to 8332 from my own computer and get a response.

my netstat with the docker running:

ubuntu@blahblah:~$ sudo ss -ltpn
State              Recv-Q              Send-Q                            Local Address:Port                           Peer Address:Port
LISTEN             0                   4096                                    0.0.0.0:8332                                0.0.0.0:*                 users:(("docker-proxy",pid=13131,fd=4))
LISTEN             0                   128                               127.0.0.53%lo:53                                  0.0.0.0:*                 users:(("systemd-resolve",pid=644,fd=13))
LISTEN             0                   128                                     0.0.0.0:22                                  0.0.0.0:*                 users:(("sshd",pid=760,fd=3))
LISTEN             0                   4096                                       [::]:8332                                   [::]:*                 users:(("docker-proxy",pid=13139,fd=4))
LISTEN             0                   128                                        [::]:22                                     [::]:*                 users:(("sshd",pid=760,fd=4))

What's lead me to the conclusion that my problem is that I dont have IPv6 rpc bind with the bitcoin node.

I went to the manual and read the following:

-rpcbind=[:port] Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost)

But every way I tried to specify the IPv6 in the rpcbind is not helping.

1 Answer 1

1

At least for IPv4, you can't specify 0.0.0.0 for rpcbind. You'll get this error in bitcoind logs if you try:

Binding RPC on address 0.0.0.0 port 18443 failed.

Try 127.0.0.1 for IPv4, or ::1/128 for IPv6.

bitcoind -rpcbind=127.0.0.1

4
  • Thanks for the input. So I should I expose the RPC for outside communication?
    – Ron
    Mar 8 at 10:10
  • Your answer gave me the right direction, and the following answer provided me the further information i needed: askubuntu.com/a/1000779/1464279 (for future visitors). Thank you.
    – Ron
    Mar 8 at 13:24
  • no, do NOT expose the RPC port to the internet, or any untrusted network. RPC is used to control the bitcoin node, it is not used to relay transactions or otherwise participate in the network. If you don't know you need it, you don't need it.
    – northben
    Mar 11 at 1:51
  • Its behind VPN as I wrote in my question. "If you don't know you need it" what? I didnt understand you point. Anyway I have a service that query the btc-node, and its uses the RPC to communicate.
    – Ron
    Mar 11 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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