ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.8k stars 891 forks source link

Alias & RGB not propagated #4655

Open unixb0y opened 3 years ago

unixb0y commented 3 years ago

So, I noticed that after multiple days, multiple channel creations, and successful transactions, even though my node shows up on 1ml.com and amboss.space, none of those show my alias and RGB. Is there anything specific I have to set in my config for c-lightning to propagate them in the network?

vincenzopalazzo commented 3 years ago

Hi @unixb0y, maybe if you post your getinfo command result and the configuration file we can help.

Honestly, I don't know if you did specify nothings in the file, the node will make some choice for you. However, have your configuration can be helpful to fix your problem.

unixb0y commented 3 years ago

Hi @unixb0y, maybe if you post your getinfo command result and the configuration file we can help.

Honestly, I don't know if you did specify nothings in the file, the node will make some choice for you. However, have your configuration can be helpful to fix your problem.

sure, here's my info:

$ lightning-cli getinfo
{
   "id": "0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78",
   "alias": "ln.unixb0y.de",
   "color": "ff00ff",
   "num_peers": 6,
   "num_pending_channels": 0,
   "num_active_channels": 5,
   "num_inactive_channels": 1,
   "address": [],
   "binding": [
      {
         "type": "ipv6",
         "address": "::",
         "port": 9735
      },
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "0.10.0",
   "blockheight": 691160,
   "network": "bitcoin",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/home/dave/.lightning/bitcoin"
}

The config file in ~/.lightning/config specifies these options as well as a few plugin settings:

mainnet
alias=ln.unixb0y.de
rgb=ff00ff
vincenzopalazzo commented 3 years ago

@unixb0y your configuration looks good to me, I have the same configuration on my node

unixb0y commented 3 years ago

@unixb0y your configuration looks good to me, I have the same configuration on my node

weird then what can I do to propagate my alias and rgb?

btw whats the plugin used for your webpage?

GlenCooper commented 3 years ago

@unixb0y your configuration looks good to me, I have the same configuration on my node

@vincenzopalazzo : the QR codes presented on your webpage are not scannable using the QR scanner software on my phone. Please increase the margin size of the QR image (to at least Margin Size 3 if using qtqr) to make them more easily scannable.

vincenzopalazzo commented 3 years ago

@unixb0y all the plugin used are under this organization https://github.com/clightning4j, there are a couple of plugin under the hood

weird then what can I do to propagate my alias and rgb?

@unixb0y I really don't have idea about that, and I'm curious to know more about that

@vincenzopalazzo : the QR codes presented on your webpage are not scannable using the QR scanner software on my phone. Please increase the margin size of the QR image (to at least Margin Size 3 if using qtqr) to make them more easily scannable.

@GlenCooper, Ops! i reproduced it now. thanks to reporting this error :-)

unixb0y commented 3 years ago

@unixb0y all the plugin used are under this organization https://github.com/clightning4j, there are a couple of plugin under the hood

thanks!

weird then what can I do to propagate my alias and rgb?

@unixb0y I really don't have idea about that, and I'm curious to know more about that

Okay, maybe someone here knows.. 😊

jsarenik commented 3 years ago

@unixb0y there is some issue because even though you seem to have channels, your peers may not be connected to anyone else or something like this. I tried to connect to your node, no success.

$ lightning-cli connect 0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78
{
   "code": 400,
   "message": "Unable to connect, no address known for peer"
}

Ah it could be that you have bindings, but do not announce any address and the node may be behind NAT (and probably no IPv6 there, the binding is just local-host).

See my getinfo:

{
   "id": "032de5c0f28f9d7d10c0c0b5ec92e83f9bf40def2bf40181c0f4330c57e58a8605",
   "alias": "IRATEMONKEY-v0.10.0-448-g896da4f",
   "color": "96da4f",
   "num_peers": 4,
   "num_pending_channels": 0,
   "num_active_channels": 4,
   "num_inactive_channels": 0,
   "address": [
      {
         "type": "ipv4",
         "address": "78.98.73.119",
         "port": 19735
      },
      {
         "type": "ipv6",
         "address": "300:5ecb:6b8a:d837::3",
         "port": 19735
      },
      {
         "type": "ipv6",
         "address": "2001:470:1f1b:365:aa20:66ff:fe3f:1909",
         "port": 19735
      },
      {
         "type": "torv3",
         "address": "seagd6ubksxmppexhzfibzjjk5ummiii5ancqdoc6ppfzhkqnrn4a5ad.onion",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv4",
         "address": "127.0.0.1",
         "port": 9735
      },
      {
         "type": "ipv4",
         "address": "192.168.1.118",
         "port": 19735
      },
      {
         "type": "ipv6",
         "address": "2001:470:1f1b:365:aa20:66ff:fe3f:1909",
         "port": 19735
      },
      {
         "type": "ipv6",
         "address": "300:5ecb:6b8a:d837::3",
         "port": 19735
      }
   ],
   "version": "v0.10.0-448-g896da4f",
   "blockheight": 691236,
   "network": "bitcoin",
   "msatoshi_fees_collected": 39514,
   "fees_collected_msat": "39514msat",
   "lightning-dir": "/home/nsm/.lightning/bitcoin"
}
unixb0y commented 3 years ago

Ah it could be that you have bindings, but do not announce any address and the node may be behind NAT (and probably no IPv6 there, the binding is just local-host).

Indeed I'm behind NAT without a static IP! But I do have DNS so I give people this format and it works well: ID@url:9735

Should I put the url in the config? Does that work or just IPs?

jsarenik commented 3 years ago

Yes, your node needs to know about that address as well because this is what gets into the gossip.

In my config I have these address-related lines:

bind-addr=127.0.0.1:9735
bind-addr=192.168.1.118:19735
announce-addr=78.98.73.119:19735
addr=[2001:470:1f1b:365:aa20:66ff:fe3f:1909]:19735
addr=[300:5ecb:6b8a:d837::3]:19735
proxy=127.0.0.1:9050
addr=statictor:127.0.0.1:9051

The IPv4 annonce-addr line (currently 78.98.73.119) gets updated according to my dynDNS record (a.bublina.eu.org) every time the home DSL router gets another address. The IPv6 is tunneled through tunnelbroker.net and the funny IPv6-looking address is on Yggdrasil-Network. And then Tor (see doc/TOR.md).

unixb0y commented 3 years ago

@jsarenik Thanks a lot! But how is announce-addr updated? Is it done somehow automatically?

And why can't I just put my URL in announce-addr?

Do I have to set the local IP (lines 1,2) since I had a lightning node with exposed IP on a server in the past and did not need that there.

unixb0y commented 3 years ago

@jsarenik the localhost stuff and everything on 9735 is for Tor and 19735 is normal internet?

vincenzopalazzo commented 3 years ago

@unixb0y I try to answer to the best of my knowledge below

And why can't I just put my URL in announce-addr?

In my knowledge the URL it is not supported because the node needs to resolve the url, I don't know the motivation, but maybe @rustyrussell can give an exhaustive answer here.

But how is announce-addr updated? Is it done somehow automatically?

You need to specify the announc-addr in this way you are telling to be available on the public network, however, the bind-addr is made automagically if no error happens, in this case you can specify the bind-addr on the config file.

the localhost stuff and everything on 9735 is for Tor and 19735 is normal internet?

You are free to use any port that you want, I have all expose on 9735 port, but maybe I didn't catch your question here?

unixb0y commented 3 years ago

@vincenzopalazzo thanks a lot! yeah maybe URL → IP resolution can be added in the futute :)

I earlier managed to get Tor running using the guide in the docs, but I will try again to get both up! I would like for both ways to use 9735, but according to amboss.space your clearnet endpoint is on 19735.

I still didnt understand if you have to use like a cronjob to periodically update the clearnet IP in the config file or if c-lightning does that automatically.

vincenzopalazzo commented 3 years ago

but according to amboss.space your clearnet endpoint is on 19735.

All my addresses are on the same port, I checked now https://amboss.space/node/03e2408a49f07d2f4083a47344138ef89e7617e63919202c92aa8d49b574a560ae

I still didnt understand if you have to use like a cronjob to periodically update the clearnet IP in the config file or if c-lightning does that automatically.

I think you need to update your file, the announce-addr should (In my knowledge) update by hand

unixb0y commented 3 years ago

but according to amboss.space your clearnet endpoint is on 19735.

All my addresses are on the same port, I checked now https://amboss.space/node/03e2408a49f07d2f4083a47344138ef89e7617e63919202c92aa8d49b574a560ae

Oh that looks good, can you send maybe the part of your lightning config related to the various IP addresses? Is your node also behind NAT?

I still didnt understand if you have to use like a cronjob to periodically update the clearnet IP in the config file or if c-lightning does that automatically.

I think you need to update your file, the announce-addr should (In my knowledge) update by hand

Oh so you change the announce-addr daily manually (e.g. when your router gets a new IP every day)? Since @jsarenik mentioned it would get updated according to my dynDNS record 🤔

jsarenik commented 3 years ago

@unixb0y Resolving a DNS name inside c-lightning daemon would mean that many would start using it and their privacy would evaporate out of the window simply because if not taken care of, DNS can really do magic*.

* random DNS-poisoning article linked here

Of course it can be done manually (as it is the sole responsibility of c-lightning node operator to fill anything there for the IP address) so here are for example my scripts:

#!/bin/sh -x

ping -c1 ns1.afraid.org || { sleep 5m; exit 1; }

LI=/tmp/lastip

nowip() {
  dig +short -t A a.bublina.eu.org @ns1.afraid.org.
}

LASTIP=$(cat $LI) || { nowip > $LI; exec $0; }

test "$LASTIP" = "$(nowip)" || {
  svc -t $HOME/service/bitcoind-main*
  sleep 5
  svc -t $HOME/service/lightningd-main*
  sleep 5
  svc -t $HOME/service/bitcoind-test*
  svc -t $HOME/service/bitcoind-sig*
  sleep 5
  svc -t $HOME/service/lightningd-test*
  svc -t $HOME/service/lightningd-sig*
  nowip > $LI
}

Explanation of what it does:

  1. Check if online. Sleep and exit if not.
  2. Set the temporary LI (lastip) file to be /tmp/lastip.
  3. Define function nowip which returns the current IP address, while asking straight the DNS server which is the source of truth for my subdomain.
  4. Set LASTIP variable to either what is inside /tmp/lastip or the output of previous function (in which case it also re-execs the script).
  5. Check that LASTIP equals the current fresh output of nowip. If not, restart the (daemontools or runit) services.

Now the other important part. Every time the bitcoind or lightningd service gets restarted, it figures out the current IPv4 address, by doing this:

#!/bin/sh

# non-related lines skipped
PUBLICIP4=$(dnsipq a.bublina.eu.org | cut -d" " -f2)

exec nice -n 15 ionice -c 3 \
  bitcoind \
    -externalip=$PUBLICIP4 \
    $*

And following for lightningd:

#!/bin/sh

# non-related lines skipped
WHERE=$HOME/.lightning
PUBLICIP4=$(dnsipq a.bublina.eu.org | cut -d" " -f2)

# generate config
# bind-addr is set to localnet IPv4 to which the router forwards port 19735
# Note the firewall needs to be open for that port on localnet IPv4 address.
cat > $WHERE/bitcoin/config <<EOF
bind-addr=192.168.1.118:19735
announce-addr=$PUBLICIP4:19735
EOF

exec nice -n 10 ionice -c 2 \                           
  lightningd \                                          
    --mainnet \                                         
    $*

@jsarenik the localhost stuff and everything on 9735 is for Tor and 19735 is normal internet?

Yes, that was the idea. Though I think that in the end the magical statictor address either uses this 9735 port or binds even another one for itself so my binding of 9735 is not really used… but does not hurt anyone either. Works for me. Just a Linux admin here who likes to stop iterating on perfectionism of the config files whenever it works well.

whitslack commented 3 years ago

Uhh, folks, you can put a host name in announce-addr. My C-Lightning node has been configured that way ever since I first set it up over two years ago.

I have:

bind-addr=
announce-addr=<the public IPv4 host name of my local router, which forwards port 9735 to my node machine>
announce-addr=<the public IPv6 host name of my node machine>

Then I just have a cronjob to update those dynamic DNS records in case my IP addresses change.

Caveat: I'm pretty sure Lightning node announcements only carry addresses (not hostnames), and I don't know if C-Lightning ever re-resolves the announce-addr hostnames it's given, so if my IP addresses ever were to change, I'd probably have to restart C-Lightning to get it to start announcing the new addresses.

whitslack commented 3 years ago

@unixb0y: Your alias and RGB are known to my node at least…

$ lightning-cli listnodes 0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78
{
   "nodes": [
      {
         "nodeid": "0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78",
         "alias": "⚡ln.unixb0y.de⚡",
         "color": "ff9900",
         "last_timestamp": 1626548722,
         "features": "8000000002aaa2",
         "addresses": [
            {
               "type": "ipv4",
               "address": "2.200.66.182",
               "port": 9735
            },
            {
               "type": "torv3",
               "address": "lpeg4u6obxqhk2f5vfm72dozoa7ahgvr45ualttmnme25xbwi7ugrcad.onion",
               "port": 9735
            }
         ]
      }
   ]
}
jsarenik commented 3 years ago

@unixb0y Yep. Now it works for me, too! Have a nice weekend!

$ lightning-cli listnodes 0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78
{
   "nodes": [
      {
         "nodeid": "0318849334f3d45ded8dbbfad27bbd54e0fcdae495f4c1e6536775c984a156fa78",
         "alias": "⚡ln.unixb0y.de⚡",
         "color": "ff9900",
         "last_timestamp": 1626548722,
         "features": "8000000002aaa2",
         "addresses": [
            {
               "type": "ipv4",
               "address": "2.200.66.182",
               "port": 9735
            },
            {
               "type": "torv3",
               "address": "lpeg4u6obxqhk2f5vfm72dozoa7ahgvr45ualttmnme25xbwi7ugrcad.onion",
               "port": 9735
            }
         ]
      }
   ]
}
unixb0y commented 3 years ago

@unixb0y Resolving a DNS name inside c-lightning daemon would mean that many would start using it and their privacy would evaporate out of the window simply because if not taken care of, DNS can really do magic*.

oh yes you're right! makes absolute sense, thanks - didn't think of that :)

Of course it can be done manually (as it is the sole responsibility of c-lightning node operator to fill anything there for the IP address) so here are for example my scripts:

Thanks for the script, I'll try that as well! Just to make sure: lightningd doesn't update the IP on its own right? I reckon that could be quite easily implemented that whenever it recognizes an IP change, it changes it in its config file.

@jsarenik the localhost stuff and everything on 9735 is for Tor and 19735 is normal internet?

Yes, that was the idea. Though I think that in the end the magical statictor address either uses this 9735 port or binds even another one for itself so my binding of 9735 is not really used… but does not hurt anyone either. Works for me. Just a Linux admin here who likes to stop iterating on perfectionism of the config files whenever it works well.

Alright got you. I just put everything on 9735 :D

unixb0y commented 3 years ago

Uhh, folks, you can put a host name in announce-addr. My C-Lightning node has been configured that way ever since I first set it up over two years ago.

Interesting. So you have a domain name like thisismynode.com in there? I'll check later if I can find your node via ID then :) I don't need cronjob for dynDNS since my router and domain provider do that automagically :D

unixb0y commented 3 years ago

@unixb0y Yep. Now it works for me, too! Have a nice weekend!

Ah great! I had to bind localhost and my local node IP and announce my external IP, that way it worked.. :)

mainnet

alias=⚡ln.unixb0y.de⚡
rgb=ff9900

bind-addr=127.0.0.1:9735
bind-addr=192.168.178.60:9735
announce-addr=2.200.66.182:9735
announce-addr=lpeg4u6obxqhk2f5vfm72dozoa7ahgvr45ualttmnme25xbwi7ugrcad.onion:9735

proxy=127.0.0.1:9050

Funny enough even though we usually get a new IP daily, or at least last I checked, I have this IP for almost a week now. Good for now I guess

whitslack commented 3 years ago

Interesting. So you have a domain name like thisismynode.com in there?

To be pedantic, I have a fully qualified host name there, not just a domain name. It's like…

bind-addr=
announce-addr=home.mydomainname.com
announce-addr=myhost.home.mydomainname.com

…where home.mydomainname.com has an A record that contains the IPv4 address of my home router, and myhost.home.mydomainname.com has an AAAA record that contains the IPv6 address of my node machine, which is in my home.

GhostTyper commented 2 years ago

My node has a similar symptom as reported by the OP. My node announced its alias and color over the gossip protocol. I could see it at pages like 1ml.com. However, after some time pages like 1ml.com didn't "know" color and alias any more. I didn't restart my node since then. Nodes which are connected directly to me see the correct alias and color.

getinfo, etc

{
   "id": "039306fa4008865638e08d3f43eeee43c0a6d23ed1571e88a17ef384cbd5be656e",
   "alias": "GhostTyper",
   "color": "4080ff",
   "num_peers": 6,
   "num_pending_channels": 0,
   "num_active_channels": 4,
   "num_inactive_channels": 0,
   "address": [
      {
         "type": "ipv4",
         "address": "81.95.4.21",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv4",
         "address": "81.95.4.21",
         "port": 9735
      }
   ],
   "version": "v0.10.1rc2-1-ga8b3a1c",
   "blockheight": 695127,
   "network": "bitcoin",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/home/btc/.lightning/bitcoin"
}

All my channels are working:

$ lightning-cli -F listpeers | grep state_changes\\[0\\].new_state
peers[0].channels[0].state_changes[0].new_state=CHANNELD_NORMAL
peers[1].channels[0].state_changes[0].new_state=CHANNELD_NORMAL
peers[2].channels[0].state_changes[0].new_state=CHANNELD_NORMAL
peers[3].channels[0].state_changes[0].new_state=CHANNELD_NORMAL

And I'm not on an isle of the network, because I'm connected to both bitfinex nodes.

jsarenik commented 2 years ago

Yes, I see your point @GhostTyper and also have noticed similar things. For example, my node has 7 working channels but the explorers show only 6. I guess it will have something to do with the decentralized way of operation and the huge raise in Lightning Network popularity in recent months. All the LN explorers are doing a nice job of helping people understand a bit better what is going on here, but they can not and will not have any completeness of the network data.

GhostTyper commented 2 years ago

But how can it lose my alias and color again, @jsarenik? Meanwhile I have more channels and more peers. So it should somewhen propagate anew via the gossip lightning network?

jsarenik commented 2 years ago

@GhostTyper Good question. I do not know how it can lose your alias and color. This is what my node sees:

$ lightning-cli connect 039306fa4008865638e08d3f43eeee43c0a6d23ed1571e88a17ef384cbd5be656e
{
   "id": "039306fa4008865638e08d3f43eeee43c0a6d23ed1571e88a17ef384cbd5be656e",
   "features": "08026aa2",
   "direction": "out",
   "address": {
      "type": "ipv4",
      "address": "81.95.4.21",
      "port": 9735
   }
}
$ lightning-cli listpeers 039306fa4008865638e08d3f43eeee43c0a6d23ed1571e88a17ef384cbd5be656e
{
   "peers": [
      {
         "id": "039306fa4008865638e08d3f43eeee43c0a6d23ed1571e88a17ef384cbd5be656e",
         "connected": true,
         "netaddr": [
            "81.95.4.21:9735"
         ],
         "features": "08026aa2",
         "channels": []
      }
   ]
}
GhostTyper commented 2 years ago

@jsarenik: I'm not using a config file. I'm just using command line arguments. May this lead to a problem here? I thought that I don't need a config file because I have so few parameters due to clboss.

This is how I call lightningd:

lightningd --network bitcoin --addr 81.95.4.21 --bitcoin-rpcpassword password --alias GhostTyper --rgb 4080FF --min-capacity-sat 500000 --plugin=/usr/bin/clboss --clboss-min-onchain=100000

Maybe you see directly some kind of flaw.

Interestingly this page does see my alias and color.

jsarenik commented 2 years ago

@GhostTyper your command line looks good. --plugin can be also used without equals sign, but that should not make any difference. No need to use config file if this works for you well.

Yes, ln.fiatjaf.com is a great site and it seems to operate by different principles than some others. It uses PostgreSQL and just adds new data, not removing old it does not see them repeated for some reason, am i right @fiatjaf ? See IRATEMONKEY there.