2020-10-13 09:49:20 -10:00
# Connecting LiT to a standalone LND process
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
By default LiT assumes that `lnd` is running as a standalone process locally. However
`litd` can connect to `lnd` running on a remote host.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
## Quickstart
To connect Lightning Terminal to a remote LND instance first make sure your `lnd.conf`
file contains the following additional configuration settings:
2021-01-18 15:38:46 +01:00
```text
2020-10-13 09:49:20 -10:00
tlsextraip=< externally-reachable-ip-address >
rpclisten=0.0.0.0:10009
```
Copy the following files that are located in your `~/.lnd/data/chain/bitcoin/mainnet`
directory on your remote machine to `/some/folder/with/lnd/data/` on your local machine
(where you’ ll be running LiT):
- tls.cert
- admin.macaroon
2021-01-18 15:38:42 +01:00
(Note that with LiT prior to `v0.3.5-alpha` all `*.macaroon` files need to be
copied from the lnd machine.)
2020-10-13 09:49:20 -10:00
Create a `lit.conf` file. The default location LiT will look for the configuration file
depends on your operating system:
- MacOS: `~/Library/Application Support/Lit/lit.conf`
- Linux: `~/.lit/lit.conf`
- Windows: `~/AppData/Roaming/Lit/lit.conf`
Alternatively you can specify a different location by passing `--lit-dir=~/.lit` . After
creating `lit.conf` populate it with the following configuration settings:
2021-01-18 15:38:46 +01:00
```text
2020-10-13 09:49:20 -10:00
remote.lnd.rpcserver=< externally-reachable-ip-address > :10009
2021-01-18 15:38:42 +01:00
remote.lnd.macaroonpath=/some/folder/with/lnd/data/admin.macaroon
2020-10-13 09:49:20 -10:00
remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert
```
Run LiT:
2021-01-18 15:38:46 +01:00
```shell
⛰ ./litd --uipassword=UP48lm4VjqxmOxB9X9stry6VTKBRQI
2020-10-13 09:49:20 -10:00
```
Visit https://localhost:8443 to access LiT.
## Additional Configuration
2021-02-16 13:47:37 +01:00
The default "remote" mode means that `lnd` is started as a standalone process, possibly on another
2020-10-13 09:49:20 -10:00
host, and `litd` connects to it, right after starting its UI server. Once the connection
2020-11-02 13:15:22 +01:00
to the remote `lnd` node has been established, `litd` then goes ahead and starts
`faraday` , `pool` and `loop` and connects them to that `lnd` node as well.
2020-10-13 09:49:20 -10:00
2021-02-16 13:47:37 +01:00
### Connecting LiT to a remote faraday node
To instruct LiT to not start its own integrated `faraday` daemon but instead
connect to an existing node, use the following configuration options:
```text
faraday-mode=remote
remote.faraday.rpcserver=< externally-reachable-ip-address > :8465
remote.faraday.macaroonpath=/some/folder/with/faraday/data/faraday.macaroon
remote.faraday.tlscertpath=/some/folder/with/faraday/data/tls.cert
```
### Connecting LiT to a remote loopd node
To instruct LiT to not start its own integrated `loopd` daemon but instead
connect to an existing node, use the following configuration options:
```text
loop-mode=remote
remote.loop.rpcserver=< externally-reachable-ip-address > :11010
remote.loop.macaroonpath=/some/folder/with/loop/data/loop.macaroon
remote.loop.tlscertpath=/some/folder/with/loop/data/tls.cert
```
### Connecting LiT to a remote poold node
To instruct LiT to not start its own integrated `poold` daemon but instead
connect to an existing node, use the following configuration options:
```text
pool-mode=remote
remote.pool.rpcserver=< externally-reachable-ip-address > :12010
remote.pool.macaroonpath=/some/folder/with/pool/data/pool.macaroon
remote.pool.tlscertpath=/some/folder/with/pool/data/tls.cert
```
2020-10-08 09:34:45 +02:00
## Use command line parameters only
2020-10-13 09:49:20 -10:00
In addition to the LiT specific and remote `lnd` parameters, you must also provide
2020-11-02 13:15:22 +01:00
configuration to the `loop` , `pool` , and `faraday` daemons. For the remote `lnd` node, all
2020-10-13 09:49:20 -10:00
`remote.lnd` flags must be specified. Note that `loopd` and `faraday` will automatically
connect to the same remote `lnd` node, so you do not need to provide them with any
additional parameters unless you want to override them. If you do override them, be sure
2020-11-02 13:15:22 +01:00
to add the `loop.` , `pool.` , and `faraday.` prefixes.
2020-10-08 09:34:45 +02:00
To see all available command line options, run `litd --help` .
2020-11-02 13:15:22 +01:00
The most minimal example command to start `litd` and connect it to a local `lnd`
node that is running with default configuration settings is:
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ litd --uipassword=My$trongP@ssword
2020-10-08 09:34:45 +02:00
```
All other command line flags are only needed to overwrite the default behavior.
2020-11-02 13:15:22 +01:00
Here is an example command to start `litd` connected to a testnet `lnd` that is
running on another host and overwrites a few default settings in `loop` , `pool` ,
and `faraday` (optional):
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ litd \
2021-01-18 15:38:43 +01:00
--httpslisten=0.0.0.0:8443 \
2020-10-08 09:34:45 +02:00
--uipassword=My$trongP@ssword \
--letsencrypt \
--letsencrypthost=loop.merchant.com \
--lit-dir=~/.lit \
2021-02-16 13:39:35 +01:00
--network=testnet \
2020-10-08 09:34:45 +02:00
--remote.lit-debuglevel=debug \
--remote.lnd.rpcserver=some-other-host:10009 \
2021-01-18 15:38:42 +01:00
--remote.lnd.macaroonpath=/some/folder/with/lnd/data/admin.macaroon \
2020-10-08 09:34:45 +02:00
--remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert \
--loop.loopoutmaxparts=5 \
2020-11-02 13:15:22 +01:00
--pool.newnodesonly=true \
2020-10-08 09:34:45 +02:00
--faraday.min_monitored=48h \
--faraday.connect_bitcoin \
--faraday.bitcoin.host=some-other-host \
--faraday.bitcoin.user=testnetuser \
--faraday.bitcoin.password=testnetpw
```
## Use a configuration file
2020-10-13 09:49:20 -10:00
You can also store the configuration in a persistent `~/.lit/lit.conf` file, so you do not
need to type in the command line arguments every time you start the server. Just remember
to use the appropriate prefixes as necessary.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
Make sure you don't add any section headers (the lines starting with `[` and ending with
`]` , for example `[Application Options]` ) as these don't work with the additional levels
of sub configurations. You can replace them with a comment (starting with the `#`
character) to get the same grouping effect as before.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
The most minimal example of a `~/.lit/lit.conf` file that connects to a local `lnd` node
that is running with default configuration settings is:
2020-10-08 09:34:45 +02:00
```text
# Application Options
uipassword=My$trongP@ssword
```
2020-10-13 09:49:20 -10:00
All other configuration settings are only needed to overwrite the default behavior.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
Here is an example `~/.lit/lit.conf` file that connects LiT to a testnet `lnd` node
2020-11-02 13:15:22 +01:00
running on another host and overwrites a few default settings in `loop` , `pool` ,
and `faraday` (optional):
2020-10-08 09:34:45 +02:00
```text
# Application Options
2021-01-18 15:38:43 +01:00
httpslisten=0.0.0.0:8443
2020-10-08 09:34:45 +02:00
uipassword=My$trongP@ssword
letsencrypt=true
letsencrypthost=loop.merchant.com
lit-dir=~/.lit
2021-02-16 13:39:35 +01:00
network=testnet
2020-10-08 09:34:45 +02:00
# Remote options
remote.lit-debuglevel=debug
# Remote lnd options
remote.lnd.rpcserver=some-other-host:10009
2021-01-18 15:38:42 +01:00
remote.lnd.macaroonpath=/some/folder/with/lnd/data/admin.macaroon
2020-10-08 09:34:45 +02:00
remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert
# Loop
loop.loopoutmaxparts=5
2020-11-02 13:15:22 +01:00
# Pool
pool.newnodesonly=true
2020-10-08 09:34:45 +02:00
# Faraday
faraday.min_monitored=48h
# Faraday - bitcoin
faraday.connect_bitcoin=true
faraday.bitcoin.host=localhost
faraday.bitcoin.user=testnetuser
faraday.bitcoin.password=testnetpw
```
2020-10-13 09:49:20 -10:00
The default location for the `lit.conf` file will depend on your operating system:
2020-10-08 09:34:45 +02:00
- **On MacOS**: `~/Library/Application Support/Lit/lit.conf`
- **On Linux**: `~/.lit/lit.conf`
- **On Windows**: `~/AppData/Roaming/Lit/lit.conf`
## Example commands for interacting with the command line
2020-10-13 09:49:20 -10:00
Because not all functionality of `lnd` (or `loop` /`faraday` for that matter) is available
through the web UI, it will still be necessary to interact with those daemons through the
command line.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
We are going through an example for each of the command line tools and will explain the
reasons for the extra flags. The examples assume that LiT is started with the following
configuration (only relevant parts shown here):
2020-10-08 09:34:45 +02:00
```text
2021-01-18 15:38:43 +01:00
httpslisten=0.0.0.0:8443
2020-10-08 09:34:45 +02:00
lit-dir=~/.lit
2021-02-16 13:39:35 +01:00
network=testnet
2020-10-08 09:34:45 +02:00
remote.lnd.rpcserver=some-other-host:10009
2021-01-18 15:38:42 +01:00
remote.lnd.macaroonpath=/some/folder/with/lnd/data/admin.macaroon
2020-10-08 09:34:45 +02:00
remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert
```
2020-11-02 13:15:22 +01:00
Because in the remote `lnd` mode all other LiT components (`loop` , `pool` ,
2021-01-18 15:38:43 +01:00
`faraday` and the UI server) listen on the same port (`8443` in this example) and
2020-11-02 13:15:22 +01:00
use the same TLS certificate (`~/.lit/tls.cert` in this example), some command
line calls now need some extra options that weren't necessary before.
2020-10-08 09:34:45 +02:00
2020-10-13 09:49:20 -10:00
**NOTE**: All mentioned command line tools have the following behavior in common: You
either specify the `--network` flag and the `--tlscertpath` and `--macaroonpath` are
implied by looking inside the default directories for that network. Or you specify the
`--tlscertpath` and `--macaroonpath` flags explicitly, then you **must not** set the
`--network` flag. Otherwise, you will get an error like
`[lncli] could not load global options: unable to read macaroon path (check the network setting!): open /home/<user>/.lnd/data/chain/bitcoin/testnet/admin.macaroon: no such file or directory` .
2020-10-08 09:34:45 +02:00
### Example `lncli` command
2020-10-13 09:49:20 -10:00
The `lncli` commands in the "remote" mode are the same as if `lnd` was running standalone
on a remote host. We need to specify all flags explicitly.
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ lncli --rpcserver=some-other-host:10009 \
2020-10-08 09:34:45 +02:00
--tlscertpath=/some/folder/with/lnd/data/tls.cert \
--macaroonpath=/some/folder/with/lnd/data/admin.macaroon \
getinfo
```
### Example `loop` command
2020-10-13 09:49:20 -10:00
This is where things get a bit tricky. Because as mentioned above, `loopd` also runs on
the same port as the UI server. That's why we have to both specify the `host:port` as well
as the TLS certificate of LiT. But `loopd` verifies its own macaroon, so we have to
specify that one from the `.loop` directory.
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ loop --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert \
2020-10-08 09:34:45 +02:00
--macaroonpath=~/.loop/testnet/loop.macaroon \
quote out 500000
```
2020-10-13 09:49:20 -10:00
You can easily create an alias for this by adding the following line to your `~/.bashrc`
file:
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ alias lit-loop="loop --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert --macaroonpath=~/.loop/testnet/loop.macaroon"
2020-10-08 09:34:45 +02:00
```
2020-11-02 13:15:22 +01:00
### Example `pool` command
Again, `poold` also runs on the same port as the UI server and we have to
specify the `host:port` and the TLS certificate of LiT but use the macaroon from
the `.pool` directory.
2021-01-18 15:38:46 +01:00
```shell
⛰ pool --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert \
2020-11-02 13:15:22 +01:00
--macaroonpath=~/.pool/testnet/pool.macaroon \
accounts list
```
You can easily create an alias for this by adding the following line to your
`~/.bashrc` file:
2021-01-18 15:38:46 +01:00
```shell
⛰ alias lit-pool="pool --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert --macaroonpath=~/.pool/testnet/pool.macaroon"
2020-11-02 13:15:22 +01:00
```
2020-10-08 09:34:45 +02:00
### Example `frcli` command
2020-10-13 09:49:20 -10:00
Faraday's command line tool follows the same pattern as loop. We also have to specify the
server and TLS flags for `lnd` but use `faraday` 's macaroon:
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ frcli --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert \
2020-10-08 09:34:45 +02:00
--macaroonpath=~/.faraday/testnet/faraday.macaroon \
audit
```
2020-10-13 09:49:20 -10:00
You can easily create an alias for this by adding the following line to your `~/.bashrc`
file:
2020-10-08 09:34:45 +02:00
2021-01-18 15:38:46 +01:00
```shell
⛰ alias lit-frcli="frcli --rpcserver=localhost:8443 --tlscertpath=~/.lit/tls.cert --macaroonpath=~/.faraday/testnet/faraday.macaroon"
2020-10-08 09:34:45 +02:00
```
2021-01-18 15:38:45 +01:00
## Shutting down LiT
In the remote mode, there is no explicit command for stopping LiT yet. But a
clean shutdown can be achieved by either pressing `<Ctrl> + c` in the terminal
where LiT is running. Or, if LiT is running in the background, the following
command can be used to send an interrupt signal which will trigger the clean
shutdown:
```shell
⛰ kill -s INT $(pidof litd)
```