Tunneling rpc "ECONNREFUSED" and "Empty reply from server"


#1

Playing with an hsd node

When I run hsd on my laptop, no flags, Im able to connect with either hsd-rpc or rpc

hsd-rpc getnameinfo handshake

curl 127.0.0.1:13037 -X POST --data ‘{
“method”: “getnameinfo”,
“params”: [ “handshake” ]
}’

However my goal was to throw it on a pi. Seems to be booting fine and happily “Adding block: 1951.”

This is where my setup gets a little complicated, Im tunneling port 13037 from that machine to my localhost:13037

However both hsd-rcp and curl fail

root@0ac40f3e43e2:/usr/src/app# hsd-rpc getnameinfo handshake
Error: connect ECONNREFUSED 127.0.0.1:13037
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
root@0ac40f3e43e2:/usr/src/app# curl 127.0.0.1:13037 -X POST --data '{

"method": "getnameinfo",
"params": [ "handshake" ]

}’
curl: (7) Failed to connect to 127.0.0.1 port 13037: Connection refused
root@0ac40f3e43e2:/usr/src/app#

I have the exact same setup on the exact same machine concurrently for an eth node rpc. So Im pretty sure my tunneling is sound…

Ive doubled checked ports, flags, auth. I think I should be set… Just throwing this up here in case someone can think of something dumb Im missing.

Thanks for the read through.


#2

Hey @jacobrosenthal, the HTTP server listens on 127.0.0.1 by default, try adding this to your config:

http-host: 0.0.0.0

#3

I added that then got at least a far more instructive error
Unauthorized (bad API key).

Which was fixable with (in my case since I dont need auth for security) --no-auth

Thanks so much!


#4

You can set the api key with the environment variable HSD_API_KEY so that you don’t have to use the flag --api-key for every cli command. I’m assuming that your pi is on your local network, remember that without the api-key and TLS, anybody on your local network will be able to have access to your node and/or wallet which allows for a denial of service or steal all the money attack.