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.