3

I want the result of listnodes like the following. How can I do that?

{ "nodes" : 
    [ 
        { "nodeid" : "028e5a8e86540f703e1f58880d35d1e318a54c27d84ec1edbcde04a78ed4469a1e", "alias" : "???? EXANTE", "color" : "007f39", "last_timestamp" : 1516636793, "addresses" : 
            [ 
                { "type" : "ipv4", "address" : "148.251.53.235", "port" : 9735 } ] },

https://gist.github.com/coinables/19223b8bf09a24a3a6e8240433df04bf

This is what I did:

  1. Installed c-lightning referring to https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md#to-build-on-ubuntu
  2. Add config file as the followings.
  3. Open firewall for port 9735
  4. Check netstat. but 9735 is NOT listing. ("netstat -anp | grep 9735" is empty)
$ cat ~/.lightning/config
alias=xxx
rgb=008000
network=bitcoin
bitcoin-rpcuser=xxx
bitcoin-rpcpassword=xxx
bitcoin-rpcconnect=xxx
bitcoin-rpcport=xxx
announce-addr=xxx:9735
log-level=debug

$ ./cli/lightning-cli getinfo
{
  "id": "xxx",
  "alias": "xxx",
  "color": "008000",
  "num_peers": 0,
  "num_pending_channels": 0,
  "num_active_channels": 0,
  "num_inactive_channels": 0,
  "address": [
    {
      "type": "ipv4",
      "address": "xxx",
      "port": 9735
    }
  ],
  "binding": [
  ],
  "version": "v0.7.0-41-g1cd0ae1",
  "blockheight": 567741,
  "network": "bitcoin",
  "msatoshi_fees_collected": 0,
  "fees_collected_msat": "0msat"
}

$ ./cli/lightning-cli listnodes
{
  "nodes": [
  ]
}

1 Answer 1

4

In order for list nodes to provide some output you need to first connect to at least one peer on the network. Because the peer is giving you all the information from the gossip protocol about announced nodes and announced channels.

So do lightning-cli connect 03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df@144.76.235.20:9735 to peer with my node.

In case I change my node in the future you can try any node from a node explorer or find the address of my node at https://ln.rene-pickhardt.de

Also keep in mind that syncing the network over gossip takes some time (currently a couple of seconds) after you connected so you should not call list nodes right away.

2
  • 1
    Thank you. It worked. The current number is "2914". "$ lightning-cli listnodes | grep nodeid | wc" => 2914 btw, I want to confirm if 1ml.com shows the correct figures. This is why I'm setting up c-lightning. I think I will post some another questions this site.
    – zono
    Commented Mar 19, 2019 at 6:11
  • 1
    and I subscribe your youtube channel. I like it and very informative.
    – zono
    Commented Mar 19, 2019 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.