Error while connecting to the lightning node via <my external IP>:9735 (The operation was canceled.)
See original GitHub issueHello, I try to set up lightning network (lnd 0.5.1) in my store . BTCpay server is on the same machine as lnd and bitcoind. No docker.
I am getting this error:
Error: Error while connecting to the lightning node via <my external IP addr>:9735 (The operation was canceled.)
I don’t know why it connects to my external IP (what is of course not reachable from LAN) if I have localhost (127.0.0.1) configured in the connection string:
type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/user/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;certthumbprint=123456abcdefgh
My lnd.conf is configured:
listen=0.0.0.0:9735
restlisten=127.0.0.1:8080
rpclisten=127.0.0.1:10009
tlsextraip=127.0.0.1
externalip=<my external IP addr>
Do you have some idea for a reason or workaround? Any help very appreciated.
PS: Communication with lnd API works fine for me with this python script:
import base64, codecs, json, requests
url = 'https://localhost:8080/v1/getinfo'
cert_path = '/home/user/.lnd/tls.cert'
macaroon = codecs.encode(open('/home/user/.lnd/data/chain/bitcoin/mainnet/admin.macaroon', 'rb').read(), 'hex')
headers = {'Grpc-Metadata-macaroon': macaroon}
r = requests.get(url, headers=headers, verify=cert_path)
print(r.json())
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
@jarole I think you are over complicating.
You said that before, it was giving you this:
I guess you talk about the
Test connection
right? If so, it happen that commercial ISP does not allow to connect to your own router via its public IP from your internal network. If that’s the case and people still can create a channel with you, just use the local network IP inside the connection string in BTCPay settings, check that you can create invoice, and you just ignore the error.I think your node would have still been visible on
1ml.com
orexplore.casa
, it just takes time to appear.To make btcpay working in my environment and to have a correct
externalip
advertising by my lnd, I have done a “little hack” following these steps:/etc/hosts
entry with my my local IP addr192.168.77.88
toln.mydomain.com
externalip=ln.mydomain.com
in mylnd.conf
(so both services - BTCpay and lnd are resolvingln.mydomain.com
to my LAN IP192.168.77.88
)/etc/hosts
back and comment out the entry which resolvesln.mydomain.com
to my LAN ip192.168.77.88
When the node will be asked forexternalip=ln.mydomain.com
it will return my external IP because of DNS resolution and no more entry in/etc/hosts
1ml.com
orexplore.casa
with my external IPSorry for spam, but I’d like to document this behavior of btcpay as detailed as possible. You say that btcpay does not depend on
externalip
, but I have experienced that btcpay works different with differentexternalip
configured in lnd. Offcourse my lightning port is open (9735). Otherwise I would not be able to open a channel with the node. I can close this issue, but I want to summarize it for people struggling with similar issues. Perhaps somebody finds this usefull somehow.Thank you for your time and work so far!