shesek/spark-wallet

Error: listen EADDRNOTAVAIL: address not available

NateNate60 opened this issue · 5 comments

So I ran the following command:

nate@nates-server:~/.spark-wallet$ spark-wallet --ln-path /home/nate/.lightning --port 9737 --host [MY EXTERNAL IP] -k
WARN: /home/nate/.lightning/lightning-rpc is missing, using the bitcoin mainnet subdirectory at /home/nate/.lightning/bitcoin instead.
WARN: specifying the main lightning data directory is deprecated, please specify the network directory explicitly with "--ln-path /home/nate/.lightning/<network>".

Connected to c-lightning v0.9.0-44-g01a82d3 with id [                                                                                      ] on network bitcoin at /home/nate/.lightning/bitcoin/lightning-rpc
Loaded TLS certificate with fingerprint [   LETSENCRYPT CERT FROM MY WEBSITE    ] from /home/nate/.spark-wallet/tls
Access key for remote API access: [                              ]
uncaughtException, stopping process
Error: listen EADDRNOTAVAIL: address not available [EXTERNAL IP]:9737
    at Server.setupListenHandle [as _listen2] (net.js:1263:19)
    at listenInCluster (net.js:1328:12)
    at doListen (net.js:1461:7)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Basically, what I'm trying to do is to let my lightning node be controllable from outside my LAN. I want to be able to make Lightning payments from, say, a cafe or something using Zap. A Let's Encrypt certificate and privkey have been installed in ~/.spark-wallet/tls, but it's only valid for mywebaddress.tld and www.mywebaddress.tld, not for 192.168.1.29 or my external IP. obviously.\

Replacing [MY EXTERNAL IP] in the command with mywebaddress.tld yields exactly the same output, stating that [MY EXTERNAL IP] is unavailable. I do have an Apache2 webserver and Owncloud running on the same server using ports 443 and 80, but stopping Apache2 does not remedy the issue

Can you try with --host 0.0.0.0 --tls-name mywebaddress.tld?

Also, note that spark should be able to obtain the letsencrypt certificate automatically, assuming it is able to accept connections on port 80 (see more details here), so you shouldn't have to set up the certs manually.

If you already have an HTTP server running, another option is to terminate TLS there and set it up as a reverse proxy to the spark-wallet http server.

Running it with --host 0.0.0.0 --tls-name mywebaddress.tld appears to work. Thank you! I don't personally think manual installation is too big of an issue for me and I'd only have to do it every three months anyway.

Glad to hear it works, you're welcome!

This was very useful because I needed this too! For others, I now run spark-wallet on the server as follows:

spark-wallet/dist/cli.js --le-port 8081 --host 0.0.0.0 --tls-name mywebsite.nl --port 9737 --ln-path /media/ssd/.lightning/bitcoin --login user:<111111111>

(where mywebsite.nl and the 111111111 are fake of course) and don't get any https warnings anymore. The certificates come from my website pems:

  sudo \cp /etc/letsencrypt/live/www.mywebsite.nl/fullchain.pem /home/user/.spark-wallet/tls/cert.pem
  sudo \cp /etc/letsencrypt/live/www.mywebsite.nl/privkey.pem /home/user/.spark-wallet/tls/key.pem

On the client side (browser or app): https://mywebsite.nl:9737