The \fBlistpeers\fR RPC command returns data on nodes that are connected or are not connected but have open channels with this node\&.
.sp
Once a connection to another lightning node has been established, using the \fBconnect\fR command, data on the node can be returned using \fBlistpeers\fR and the \fIid\fR that was used with the \fBconnect\fR command\&.
.sp
If no \fIid\fR is supplied, then data on all lightning nodes that are connected, or not connected but have open channels with this node, are returned\&.
.sp
Supplying \fIid\fR will filter the results to only return data on a node with a matching \fIid\fR, if one exists\&.
Supplying \fIlevel\fR will show log entries related to that peer at the given log level\&. Valid log levels are "io", "debug", "info", and "unusual"\&.
If a channel is open with a node and the connection has been lost, then the node will still appear in the output of the command and the value of the \fIconnected\fR attribute of the node will be "false"\&.
.sp
The channel will remain open for a set blocktime, after which if the connection has not been re\-established, the channel will close and the node will no longer appear in the command output\&.
.SH"RETURN VALUE"
.sp
On success, an object with a "peers" key is returned containing a list of 0 or more objects\&.
.sp
Each object in the list contains the following data:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fIid\fR
: The unique id of the peer
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fIconnected\fR
: A boolean value showing the connection status
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fInetaddr\fR
: A list of network addresses the node is listening on
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fIglobalfeatures\fR
: Bit flags showing supported global features (BOLT #9)
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fIlocalfeatures\fR
: Bit flags showing supported local features (BOLT #9)
If \fIlevel\fR is not a valid log level, an error message will be returned:
.sp
.ifn\{\
.RS4
.\}
.nf
{ "code" : \-32602, "message" "\*(Aqlevel\*(Aq should be \*(Aqio\*(Aq, \*(Aqdebug\*(Aq, \*(Aqinfo\*(Aq, or \*(Aqunusual\*(Aq, not \*(Aq\&.\&.\&.\*(Aq" }
Michael Hawkins <michael\&.hawkins@protonmail\&.com>\&.
.SH"SEE ALSO"
.sp
lightning\-connect(7)
.SH"RESOURCES"
.sp
Main web site: https://github\&.com/ElementsProject/lightning Lightning RFC site (BOLT #9): https://github\&.com/lightningnetwork/lightning\-rfc/blob/master/09\-features\&.md