2019-08-10 02:12:44 +02:00
.TH "LIGHTNING-CONNECT" "7" "" "" "lightning-connect"
.SH NAME
2019-08-31 14:30:56 +02:00
lightning-connect - Command for connecting to another lightning node
2019-08-10 02:12:44 +02:00
.SH SYNOPSIS
2019-02-08 17:53:45 +01:00
\fB connect\fR \fI id\fR [\fI host\fR \fI port\fR ]
2019-08-10 02:12:44 +02:00
.SH DESCRIPTION
The \fB connect\fR RPC command establishes a new connection with another
node in the Lightning Network\.
\fI id\fR represents the target node’ s public key\. As a convenience, \fI id\fR may
be of the form \fI id@host\fR or \fI id@host:port\fR \. In this case, the \fI host\fR and
\fI port\fR parameters must be omitted\.
\fI host\fR is the peer’ s hostname or IP address\.
If not specified, the \fI port\fR defaults to 9735\.
2021-03-16 04:44:36 +01:00
If \fI host\fR is not specified (or doesn't work), the connection will be attempted to an IP
2019-08-10 02:12:44 +02:00
belonging to \fI id\fR obtained through gossip with other already connected
peers\.
2020-01-29 04:25:43 +01:00
This can fail if your C-lightning node is a fresh install that has not
connected to any peers yet (your node has no gossip yet),
or if the target \fI id\fR is a fresh install that has no channels yet
(nobody will gossip about a node until it has one published channel)\.
2019-08-10 02:12:44 +02:00
If \fI host\fR begins with a \fI /\fR it is interpreted as a local path, and the
connection will be made to that local socket (see \fB bind-addr\fR in
\fB lightningd-config\fR (5))\.
Connecting to a node is just the first step in opening a channel with
another node\. Once the peer is connected a channel can be opened with
\fB lightning-fundchannel\fR (7)\.
.SH RETURN VALUE
2021-05-26 07:53:01 +02:00
On success, an object is returned, containing:
2019-08-10 02:12:44 +02:00
2021-05-26 07:53:01 +02:00
.RS
.IP \[ bu]
\fB id\fR (pubkey): the peer we connected to
.IP \[ bu]
\fB features\fR (hex): BOLT 9 features bitmap offered by peer
.IP \[ bu]
\fB direction\fR (string): Whether they initiated connection or we did (one of "in", "out")
.IP \[ bu]
\fB address\fR (object): Address information (mainly useful if \fB direction\fR is \fI out\fR ):
.RS
.IP \[ bu]
\fB type\fR (string): Type of connection (\fI torv2\fR /\fI torv3\fR only if \fB direction\fR is \fI out\fR ) (one of "local socket", "ipv4", "ipv6", "torv2", "torv3")
.RE
If \fB type\fR is "local socket":
.RS
.IP \[ bu]
\fB socket\fR (string): socket filename
.RE
If \fB type\fR is "ipv4", "ipv6", "torv2" or "torv3":
.RS
.IP \[ bu]
\fB address\fR (string): address in expected format for \fB type\fR
.IP \[ bu]
\fB port\fR (u16): port number
.RE
.RE
2020-01-05 18:17:25 +01:00
.SH ERRORS
2019-08-10 02:12:44 +02:00
2020-01-05 18:17:25 +01:00
On failure, one of the following errors will be returned:
2019-08-10 02:12:44 +02:00
2020-01-05 18:17:25 +01:00
.nf
.RS
{ "code" : 400, "message" : "Unable to connect, no address known for peer" }
2019-08-10 02:12:44 +02:00
2020-01-05 18:17:25 +01:00
.RE
.fi
If some addresses are known but connecting to all of them failed, the message
will contain details about the failures:
.nf
.RS
{ "code" : 401, "message" : "..." }
.RE
.fi
If the given parameters are wrong:
.nf
.RS
{ "code" : -32602, "message" : "..." }
.RE
.fi
2019-08-10 02:12:44 +02:00
.SH AUTHOR
2019-08-31 14:30:56 +02:00
Rusty Russell \fI <rusty@rustcorp.com.au\fR > is mainly responsible\.
Felix \fI <fixone@gmail.com\fR > is the original author of this manpage\.
2019-08-10 02:12:44 +02:00
.SH SEE ALSO
\fB lightning-fundchannel\fR (7), \fB lightning-listpeers\fR (7),
\fB lightning-listchannels\fR (7), \fB lightning-disconnect\fR (7)
.SH RESOURCES
2019-08-31 14:30:56 +02:00
Main web site: \fI https://github.com/ElementsProject/lightning\fR
2019-08-10 02:12:44 +02:00
2021-06-16 03:08:17 +02:00
\" SHA256STAMP:47e5ec1e2d3cca8a40bd9b93faff9fd226b4fd481ab4c3c81d67f15dc6f8b839