<p>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.</p>

<p>So do <code>lightning-cli connect 03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df@144.76.235.20:9735</code> to peer with my node. </p>

<p>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 <a href="https://ln.rene-pickhardt.de" rel="nofollow noreferrer">https://ln.rene-pickhardt.de</a></p>

<p>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. </p>

CC BY-SA 4.0
2019-03-19T06:11:09.740Z
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
CC BY-SA 4.0
2019-03-19T06:13:09.927Z
and I subscribe your youtube channel. I like it and very informative.
zono
CC BY-SA 4.0
2019-03-19T05:28:45.383Z
2019-03-19T05:28:45.383Z
Rene Pickhardt
<p>I want the result of listnodes like the following. How can I do that?</p>

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

<p><a href="https://gist.github.com/coinables/19223b8bf09a24a3a6e8240433df04bf" rel="nofollow noreferrer">https://gist.github.com/coinables/19223b8bf09a24a3a6e8240433df04bf</a></p>

<p>This is what I did:</p>

<ol>
<li>Installed c-lightning referring to <a href="https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md#to-build-on-ubuntu" rel="nofollow noreferrer">https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md#to-build-on-ubuntu</a></li>
<li>Add config file as the followings.</li>
<li>Open firewall for port 9735</li>
<li>Check netstat. but 9735 is NOT listing. ("netstat -anp | grep 9735" is empty)</li>
</ol>

<pre><code>$ 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": [
  ]
}
</code></pre>

<lightning-network><core-lightning><ln-topology><ln-gossip>
lightning-cli listnodes is empty. Am I missing something?
zono
# lightning-cli listnodes is empty. Am I missing something?

(Asked by: username_0 on 2019-03-19)

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": [
  ]
}

```

**Tags:** lightning-network, core-lightning, ln-topology, ln-gossip


---

## 1 answers

### Answer by username_1 on 2019-03-19. Score: 4 | Accepted answer

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.username_1.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.

> **Comments:**
> **username_0**: 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.  
> **username_0**: and I subscribe your youtube channel. I like it and very informative.  

---

