Skip to content

Commit 9db09f9

Browse files
committed
guides: update installation.md
1 parent 85ff22b commit 9db09f9

File tree

1 file changed

+118
-58
lines changed

1 file changed

+118
-58
lines changed

guides/installation.md

Lines changed: 118 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ title: Installation
44

55
---
66

7+
# Table of Contents
8+
* [Installation](#installation)
9+
* [Preliminaries](#preliminaries)
10+
* [Installing lnd](#installing-lnd)
11+
* [Available Backend Operating Modes](#available-backend-operating-modes)
12+
* [btcd Options](#btcd-options)
13+
* [Neutrino Options](#neutrino-options)
14+
* [Bitcoind Options](#bitcoind-options)
15+
* [Using btcd](#using-btcd)
16+
* [Installing btcd](#installing-btcd)
17+
* [Starting btcd](#starting-btcd)
18+
* [Running lnd using the btcd backend](#running-lnd-using-the-btcd-backend)
19+
* [Using Neutrino](#using-neutrino)
20+
* [Using bitcoind or litecoind](#using-bitcoind-or-litecoind)
21+
* [Macaroons](#macaroons)
22+
* [Network Reachability](#network-reachability)
23+
* [Simnet vs. Testnet Development](#simnet-vs.-testnet-development)
24+
* [Creating an lnd.conf (Optional)](#creating-an-lnd.conf-(optional))
25+
26+
# Installation
27+
728
### Preliminaries
829
In order to work with [`lnd`](https://github.com/lightningnetwork/lnd), the
930
following build dependencies are required:
@@ -119,10 +140,61 @@ To check that `lnd` was installed properly run the following command:
119140
make check
120141
```
121142
122-
On FreeBSD, use gmake instead of make.
143+
# Available Backend Operating Modes
144+
145+
In order to run, `lnd` requires, that the user specify a chain backend. At the
146+
time of writing of this document, there are three available chain backends:
147+
`btcd`, `neutrino`, `bitcoind`. All but neutrino (atm) can run on mainnet with
148+
an out of the box `lnd` instance. We don't require `--txindex` when running
149+
with `bitcoind` or `btcd` but activating the `txindex` will generally make
150+
`lnd` run faster.
151+
152+
**NOTE: WE DO NOT FULLY SUPPORT PRUNED OPERATING MODES FOR FULL NODES.** It's
153+
possible to run a node in a pruned mode and have it serve lnd, however one must
154+
take care to ensure that `lnd` has all blocks on disk since the birth of the
155+
wallet, and the age of the earliest channels (which were created around March
156+
2018).
157+
158+
The set of arguments for each of the backend modes is as follows:
159+
160+
## btcd Options
161+
```
162+
btcd:
163+
--btcd.dir= The base directory that contains the node's data, logs, configuration file, etc. (default: /Users/roasbeef/Library/Application Support/Btcd)
164+
--btcd.rpchost= The daemon's rpc listening address. If a port is omitted, then the default port for the selected chain parameters will be used. (default: localhost)
165+
--btcd.rpcuser= Username for RPC connections
166+
--btcd.rpcpass= Password for RPC connections
167+
--btcd.rpccert= File containing the daemon's certificate file (default: /Users/roasbeef/Library/Application Support/Btcd/rpc.cert)
168+
--btcd.rawrpccert= The raw bytes of the daemon's PEM-encoded certificate chain which will be used to authenticate the RPC connection.
169+
```
170+
171+
## Neutrino Options
172+
```
173+
neutrino:
174+
-a, --neutrino.addpeer= Add a peer to connect with at startup
175+
--neutrino.connect= Connect only to the specified peers at startup
176+
--neutrino.maxpeers= Max number of inbound and outbound peers
177+
--neutrino.banduration= How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second
178+
--neutrino.banthreshold= Maximum allowed ban score before disconnecting and banning misbehaving peers.
179+
```
180+
181+
## Bitcoind Options
182+
```
183+
bitcoind:
184+
--bitcoind.dir= The base directory that contains the node's data, logs, configuration file, etc. (default: /Users/roasbeef/Library/Application Support/Bitcoin)
185+
--bitcoind.rpchost= The daemon's rpc listening address. If a port is omitted, then the default port for the selected chain parameters will be used. (default: localhost)
186+
--bitcoind.rpcuser= Username for RPC connections
187+
--bitcoind.rpcpass= Password for RPC connections
188+
--bitcoind.zmqpubrawblock= The address listening for ZMQ connections to deliver raw block notifications
189+
--bitcoind.zmqpubrawtx= The address listening for ZMQ connections to deliver raw transaction notifications
190+
```
191+
192+
## Using btcd
123193
124194
### Installing btcd
125195
196+
On FreeBSD, use gmake instead of make.
197+
126198
To install btcd, run the following commands:
127199
128200
Install **btcd**:
@@ -174,30 +246,17 @@ You can test your `btcd` node's connectivity using the `getpeerinfo` command:
174246
btcctl --testnet --rpcuser=REPLACEME --rpcpass=REPLACEME getpeerinfo | more
175247
```
176248
177-
### lnd
178-
179-
#### Simnet vs. Testnet Development
249+
### Running lnd using the btcd backend
180250
181-
If you are doing local development, such as for the tutorial, you'll want to
182-
start both `btcd` and `lnd` in the `simnet` mode. Simnet is similar to regtest
183-
in that you'll be able to instantly mine blocks as needed to test `lnd`
184-
locally. In order to start either daemon in the `simnet` mode use `simnet`
185-
instead of `testnet`, adding the `--bitcoin.simnet` flag instead of the
186-
`--bitcoin.testnet` flag.
187-
188-
Another relevant command line flag for local testing of new `lnd` developments
189-
is the `--debughtlc` flag. When starting `lnd` with this flag, it'll be able to
190-
automatically settle a special type of HTLC sent to it. This means that you
191-
won't need to manually insert invoices in order to test payment connectivity.
192-
To send this "special" HTLC type, include the `--debugsend` command at the end
193-
of your `sendpayment` commands.
194-
195-
196-
There are currently two primary ways to run `lnd`: one requires a local `btcd`
197-
instance with the RPC service exposed, and the other uses a fully integrated
198-
light client powered by [neutrino](https://github.com/lightninglabs/neutrino).
251+
If you are on testnet, run this command after `btcd` has finished syncing.
252+
Otherwise, replace `--bitcoin.testnet` with `--bitcoin.simnet`. If you are
253+
installing `lnd` in preparation for the
254+
[tutorial](http://dev.lightning.community/tutorial), you may skip this step.
255+
```
256+
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --btcd.rpcuser=kek --btcd.rpcpass=kek --externalip=X.X.X.X
257+
```
199258
200-
#### Running lnd in Light Client Mode
259+
## Using Neutrino
201260
202261
In order to run `lnd` in its light client mode, you'll need to locate a
203262
full-node which is capable of serving this new light client mode. `lnd` uses
@@ -212,26 +271,17 @@ in `--bitcoin.simnet` if needed), and also your own `btcd` node if available:
212271
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=neutrino --neutrino.connect=faucet.lightning.community
213272
```
214273
215-
#### Running lnd using the btcd backend
216274
217-
If you are on testnet, run this command after `btcd` has finished syncing.
218-
Otherwise, replace `--bitcoin.testnet` with `--bitcoin.simnet`. If you are
219-
installing `lnd` in preparation for the
220-
[tutorial](http://dev.lightning.community/tutorial), you may skip this step.
221-
```
222-
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --btcd.rpcuser=kek --btcd.rpcpass=kek --externalip=X.X.X.X
223-
```
224-
225-
#### Running lnd using the bitcoind or litecoind backend
275+
## Using bitcoind or litecoind
226276
227-
The configuration for bitcoind and litecoind are nearly identical, the following
228-
steps can be mirrored with loss of generality to enable a litecoind backend.
229-
Setup will be described in regards to `bitcoind`, but note that `lnd` uses a
230-
distinct `litecoin.node=litecoind` argument and analogous subconfigurations
231-
prefixed by `litecoind`. Note that adding `--txindex` is optional, as it will
232-
take longer to sync the node, but then `lnd` will generally operate faster as
233-
it can hit the index directly, rather than scanning blocks or BIP 158 filters
234-
for relevant items.
277+
The configuration for bitcoind and litecoind are nearly identical, the
278+
following steps can be mirrored with loss of generality to enable a litecoind
279+
backend. Setup will be described in regards to `bitcoind`, but note that `lnd`
280+
uses a distinct `litecoin.node=litecoind` argument and analogous
281+
subconfigurations prefixed by `litecoind`. Note that adding `--txindex` is
282+
optional, as it will take longer to sync the node, but then `lnd` will
283+
generally operate faster as it can hit the index directly, rather than scanning
284+
blocks or BIP 158 filters for relevant items.
235285
236286
To configure your bitcoind backend for use with lnd, first complete and verify
237287
the following:
@@ -262,9 +312,10 @@ zmqpubrawtx=tcp://127.0.0.1:28333
262312
```
263313
264314
Once all of the above is complete, and you've confirmed `bitcoind` is fully
265-
updated with the latest blocks on testnet, run the command below to launch `lnd`
266-
with `bitcoind` as your backend (as with `bitcoind`, you can create an
267-
`lnd.conf` to save these options, more info on that is described further below):
315+
updated with the latest blocks on testnet, run the command below to launch
316+
`lnd` with `bitcoind` as your backend (as with `bitcoind`, you can create an
317+
`lnd.conf` to save these options, more info on that is described further
318+
below):
268319
269320
```
270321
lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=REPLACEME --bitcoind.rpcpass=REPLACEME --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333 --externalip=X.X.X.X
@@ -296,7 +347,7 @@ lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoin
296347
`lnd` plus any application that consumes the RPC could cause `lnd` to miss
297348
crucial updates from the backend.
298349
299-
#### Macaroons
350+
# Macaroons
300351
301352
`lnd`'s authentication system is called **macaroons**, which are decentralized
302353
bearer credentials allowing for delegation, attenuation, and other cool
@@ -315,13 +366,34 @@ using the `--macaroonpath` argument.
315366
To disable macaroons for testing, pass the `--no-macaroons` flag into *both*
316367
`lnd` and `lncli`.
317368
318-
#### Network Reachability
369+
# Network Reachability
319370
320371
If you'd like to signal to other nodes on the network that you'll accept
321372
incoming channels (as peers need to connect inbound to initiate a channel
322373
funding workflow), then the `--externalip` flag should be set to your publicly
323374
reachable IP address.
324375
376+
# Simnet vs. Testnet Development
377+
378+
If you are doing local development, such as for the tutorial, you'll want to
379+
start both `btcd` and `lnd` in the `simnet` mode. Simnet is similar to regtest
380+
in that you'll be able to instantly mine blocks as needed to test `lnd`
381+
locally. In order to start either daemon in the `simnet` mode use `simnet`
382+
instead of `testnet`, adding the `--bitcoin.simnet` flag instead of the
383+
`--bitcoin.testnet` flag.
384+
385+
Another relevant command line flag for local testing of new `lnd` developments
386+
is the `--debughtlc` flag. When starting `lnd` with this flag, it'll be able to
387+
automatically settle a special type of HTLC sent to it. This means that you
388+
won't need to manually insert invoices in order to test payment connectivity.
389+
To send this "special" HTLC type, include the `--debugsend` command at the end
390+
of your `sendpayment` commands.
391+
392+
393+
There are currently two primary ways to run `lnd`: one requires a local `btcd`
394+
instance with the RPC service exposed, and the other uses a fully integrated
395+
light client powered by [neutrino](https://github.com/lightninglabs/neutrino).
396+
325397
# Creating an lnd.conf (Optional)
326398
327399
Optionally, if you'd like to have a persistent configuration between `lnd`
@@ -352,15 +424,3 @@ for Litecoin accordingly. See a more detailed sample config file available
352424
and explore the other sections for node configuration, including `[Btcd]`,
353425
`[Bitcoind]`, `[Neutrino]`, `[Ltcd]`, and `[Litecoind]` depending on which
354426
chain and node type you're using.
355-
356-
357-
358-
359-
### Next Steps
360-
361-
* **[Tutorial](/tutorial/):** Get acquainted with the skills necessary for `lnd` development.
362-
* **[Developer Guides](/guides/):** Look through developer manuals on gRPC,
363-
Docker, and more.
364-
* **[Resources](/resources/):** Learn about the Lightning Network
365-
* **[Code Contribution Guidelines](/contribute/):** Contribute to `lnd` itself.
366-

0 commit comments

Comments
 (0)