1

My setup is a little bit complicated and I'm almost sure that my problem is port related.

So I'm running Mac OS X 10.13.4 with Parallels Desktop with a Ubuntu 14.04 VM. I managed to setup bitcoin core in the VM, on top of it I installed c-lightning and managed to fund it with btc (All is happening on the testnet) which I used to open one channel with some random other node. Everything is perfect for now.

Because I want to use the LApp for WordPress Lightning-Publisher I Installed lightning-charge and started an HTTP server running on the default port 9112. All of my ports are correctly forwarded and in my bitcoin.conf file I have allowed all ips. If I run Mozilla in my Ubuntu VM and go to http://api-token:mySecretToken@localhost:9112/info everything is fine, but when I try this on my Mac I get Can't open the page because the server unexpectedly dropped the connection. If I try using my external ip it's the same thing.

Using several sites to check if my ports are correctly forwarded I get that all corresponding ports are open (18332 for BTC core, 9735 for c-lightning and 9112 for lightning-charge).

Here is my bitcoin.conf

testnet=1
server=1
rpcallowip=0.0.0.0/0
rpcuser=someuser
rpcpassword=somepass

addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151

here is my lightning config

network=testnet
alias=IVCHOBIVCHO
port=9735
rgb=008000

Proof that 9112 is open: port open

Proof that lightning-charge opens from inside the VM: inside VM

And in Safari on my mac (using localhost:9112 returns the same error): in safari

Neither Ubuntu, nor my Mac are under any kind of Firewall. My router is TP-Link

2

After a lot of research I found the solution to my problem.

I didn't know this, but in nodejs there's a huge difference if your server runs on 127.0.0.1 and on 0.0.0.0.

It isn't said in the lightning-charge docs, but except the --port attribute you also have --host which you can set.

Starting lightning-charge with this line charged --api-token mySecretToken --host 0.0.0.0 fixed all of my problems. Gosh was that an unpleasant journey!

  • 127.0.0.1 is the loopback address (also known as localhost). ... If a host has two ip addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host listens on 0.0.0.0, it will be reachable at both of those IPs. – Adam Apr 19 '18 at 20:14

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.