<p><code>listpeers</code> show current peers, which means your node has been peered to other nodes that are shown in the command. It also means you are ready to fund channels with these nodes.</p>

<p><code>listnodes</code> show nodes in your local network information.</p>

CC BY-SA 4.0
2019-11-08T01:30:24.837Z
2019-11-08T01:30:24.837Z
ogw_yuya
<h2>listpeers</h2>

<p><code>listpeers</code> returns data on nodes that you have connected with OR the nodes with which you have an open channel. If you have an open channel with a node, but the connection with that node has been lost, then the node will still appear in the output, with <code>"connected": false</code>. If you are connected with a node but do not have open channels, then it will return the output with <code>"channels": []</code>.</p>

<p>If you want to get information about a particular peer and not all of them, then you can add the node id of the peer like: <code>lightning-cli listpeers &lt;node_id&gt;</code>. You can also query log entries related to the peer by passing the command: <code>lightning-cli listpeers &lt;node_id&gt; &lt;level&gt;</code> where level can be <code>io</code>, <code>debug</code>, <code>info</code>, and <code>unusual</code>. Log levels can only be queried if a node id is supplied.</p>

<h2>listnodes</h2>

<p><code>listnodes</code> will return the information of all the nodes in your local network view. This information is collected via the gossip network. If you pass the <code>listnodes</code> command without a node id, then the RPC will return information of ALL the nodes in your view. If you are interested in the information of a particular node id, then you can do so by passing the command: <code>lightning-cli listnodes &lt;nodeid&gt;</code>.</p>

CC BY-SA 4.0
2019-11-08T04:40:11.367Z
2019-11-08T06:12:11.653Z
2019-11-08T06:12:11.653Z
Ugam Kamat
<p>In c-lightning implementation, what is the difference between the <code>listpeers</code> and <code>listnodes</code> commands of lightning-cli?</p>

<lightning-network><core-lightning>
What is the difference between listpeers vs listnodes commands?
dcfg
# What is the difference between listpeers vs listnodes commands?

(Asked by: username_0 on 2019-11-07)

In c-lightning implementation, what is the difference between the `listpeers` and `listnodes` commands of lightning-cli?

**Tags:** lightning-network, core-lightning


---

## 2 answers

### Answer by username_2 on 2019-11-08. Score: 6 | Accepted answer

## listpeers

`listpeers` returns data on nodes that you have connected with OR the nodes with which you have an open channel. If you have an open channel with a node, but the connection with that node has been lost, then the node will still appear in the output, with `"connected": false`. If you are connected with a node but do not have open channels, then it will return the output with `"channels": []`.

If you want to get information about a particular peer and not all of them, then you can add the node id of the peer like: `lightning-cli listpeers` . You can also query log entries related to the peer by passing the command: `lightning-cli listpeers`  where level can be `io`, `debug`, `info`, and `unusual`. Log levels can only be queried if a node id is supplied.

## listnodes

`listnodes` will return the information of all the nodes in your local network view. This information is collected via the gossip network. If you pass the `listnodes` command without a node id, then the RPC will return information of ALL the nodes in your view. If you are interested in the information of a particular node id, then you can do so by passing the command: `lightning-cli listnodes` .


---

### Answer by username_1 on 2019-11-08. Score: 3

`listpeers` show current peers, which means your node has been peered to other nodes that are shown in the command. It also means you are ready to fund channels with these nodes.

`listnodes` show nodes in your local network information.


---

