This repository was archived by the owner on Apr 17, 2020. It is now read-only.
forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlightningd.8
262 lines (169 loc) · 6.56 KB
/
lightningd.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
.TH "LIGHTNINGD" "8" "" "" "lightningd"
.SH NAME
lightningd - Daemon for running a Lightning Network node
.SH SYNOPSIS
.nf
.RS
lightningd [--conf=<config-file>] [OPTIONS]…
.RE
.fi
.SH DESCRIPTION
\fBlightningd\fR starts the C-Lightning daemon, which implements a
standards-compliant Lightning Network node\.
.SH CONFIGURATION OPTIONS
\fB--conf\fR=\fIFILE\fR
Specify configuration file\. If not an absolute path, will be relative
from the lightning-dir location\. Defaults to \fIconfig\fR\.
\fB--lightning-dir\fR=\fIDIR\fR
Set the directory for the C-Lightning daemon\. Defaults to
\fI$HOME/\.lightning\fR\.
.SH MORE OPTIONS
Command line options are mirrored as configuration options in the
configuration file, so \fIfoo\fR in the configuration file simply becomes
\fB--foo\fR on the command line, and \fBfoo=bar\fR becomes \fB--foo=bar\fR\.
See \fBlightningd-config\fR(5) for a comprehensive list of all available
options\.
.SH LOGGING AND COMMANDING C-LIGHTNING
.nf
.RS
By default, C-Lightning will log to the standard output.
To log to a specific file, use '--log-file=PATH'.
Sending SIGHUP will cause C-Lightning to reopen this file,
for example to do log rotation.
C-Lightning will set up a Unix domain socket for receiving
commands.
By default this will be the file 'lightning-rpc' in your
specified 'lightning-dir'.
You can use lightning-cli(1) to send commands to C-Lightning
once 'lightningd' has started; you need to match the
'--lightning-dir' and '--rpc-file' options between them.
Commands for C-Lightning are described in various manpages
in section 7, with the common prefix 'lightning-'.
QUICK START
.RE
.fi
First, decide on and create a directory for \fIlightning-dir\fR, or just use
the default \fI$HOME/\.lightning\fR\. Then create a \fIconfig\fR file in this
directory containing your configuration\.
Your other main preparation would be to set up a mainnet Bitcoin
fullnode, i\.e\. run a \fBbitcoind\fR(1) instance\. The rest of this quick start
guide will assume you are reckless and want to spend real funds on
Lightning\. Indicate \fInetwork=bitcoin\fR in your \fIconfig\fR file explicitly\.
C-Lightning needs to communicate with the Bitcoin Core RPC\. You can set
this up using \fIbitcoin-datadir\fR, \fIbitcoin-rpcconnect\fR,
\fIbitcoin-rpcport\fR, \fIbitcoin-rpcuser\fR, and \fIbitcoin-rpcpassword\fR options
in your \fIconfig\fR file\.
Finally, just to keep yourself sane, decide on a log file name and
indicate it using \fIlog-file=lightningd\.log\fR in your \fIconfig\fR file\. You
might be interested in viewing it periodically as you follow along on
this guide\.
Once the \fBbitcoind\fR instance is running, start \fBlightningd\fR(8):
.nf
.RS
$ lightningd --lightning-dir=$HOME/.lightning --daemon
.RE
.fi
This starts \fBlightningd\fR in the background due to the \fI--daemon\fR
option\.
Check if things are working:
.nf
.RS
$ lightning-cli --lightning-dir=%HOME/.lightning help
$ lightning-cli --lightning-dir=%HOME/.lightning getinfo
.RE
.fi
The \fBgetinfo\fR command in particular will return a \fIblockheight\fR field,
which indicates the block height to which \fBlightningd\fR has been
synchronized to (this is separate from the block height that your
\fBbitcoind\fR has been synchronized to, and will always lag behind
\fBbitcoind\fR)\. You will have to wait until the \fIblockheight\fR has reached
the actual blockheight of the Bitcoin network\.
Before you can get funds offchain, you need to have some funds onchain
owned by \fBlightningd\fR (which has a separate wallet from the
\fBbitcoind\fR it connects to)\. Get an address for \fBlightningd\fR via
\fBlightning-newaddr\fR(7) command as below (\fI--lightning-dir\fR option has been
elided, specify it if you selected your own \fIlightning-dir\fR):
.nf
.RS
$ lightning-cli newaddr
.RE
.fi
This will provide a native SegWit bech32 address\. In case all your money
is in services that do not support native SegWit and have to use
P2SH-wrapped addresses, instead use:
.nf
.RS
$ lightning-cli newaddr p2sh-segwit
.RE
.fi
Transfer a small amount of onchain funds to the given address\. Check the
status of all your funds (onchain and on-Lightning) via
\fBlightning-listfunds\fR(7):
.nf
.RS
$ lightning-cli listfunds
.RE
.fi
Now you need to look for an arbitrary Lightning node to connect to,
which you can do by using \fBdig\fR(1) and querying \fIlseed\.bitcoinstats\.com\fR:
.nf
.RS
$ dig lseed.bitcoinstats.com A
.RE
.fi
This will give 25 IPv4 addresses, you can select any one of those\. You
will also need to learn the corresponding public key, which you can
determine by searching the IP addrss on \fIhttps://1ml.com/\fR \. The public
key is a long hex string, like so:
\fI024772ee4fa461febcef09d5869e1238f932861f57be7a6633048514e3f56644a1\fR\.
(this example public key is not used as of this writing)
After determining a public key, use \fBlightning-connect\fR(7) to connect to
that public key:
.nf
.RS
$ lightning-cli connect $PUBLICKEY
.RE
.fi
Then open a channel to that node using \fBlightning-fundchannel\fR(7):
.nf
.RS
$ lightning-cli fundchannel $PUBLICKEY $SATOSHI
.RE
.fi
This will require that the funding transaction be confirmed before you
can send funds over Lightning\. To track this, use \fBlightning-listpeers\fR(7)
and look at the \fIstate\fR of the channel:
.nf
.RS
$ lightning-cli listpeers $PUBLICKEY
.RE
.fi
The channel will initially start with a \fIstate\fR of
\fICHANNELD_AWAITING_LOCKIN\fR\. You need to wait for the channel \fIstate\fR
to become \fICHANNELD_NORMAL\fR, meaning the funding transaction has been
confirmed deeply\.
Once the channel \fIstate\fR is \fICHANNELD_NORMAL\fR, you can start paying
merchants over Lightning\. Acquire a Lightning invoice from your favorite
merchant, and use \fBlightning-pay\fR(7) to pay it:
.nf
.RS
$ lightning-cli pay $INVOICE
.RE
.fi
.SH BUGS
You should report bugs on our github issues page, and maybe submit a fix
to gain our eternal gratitude!
.SH AUTHOR
ZmnSCPxj \fI<[email protected]\fR> wrote the initial version of
this man page, but many others did the hard work of actually
implementing a standards-compliant Lightning Network node
implementation\.
.SH SEE ALSO
\fBlightning-listconfigs\fR(7), \fBlightning-config\fR(5), \fBlightning-cli\fR(1),
\fBlightning-newaddr\fR(7), \fBlightning-listfunds\fR(7), \fBlightning-connect\fR(7),
\fBlightning-fundchannel\fR(7), \fBlightning-listpeers\fR(7), \fBlightning-pay\fR(7)
.SH RESOURCES
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
.SH COPYING
Note: the modules in the ccan/ directory have their own licenses, but
the rest of the code is covered by the BSD-style MIT license\.