lnd.xprv/docs/INSTALL.md

137 lines
3.8 KiB
Markdown
Raw Normal View History

# Installation for lnd and btcd
2017-01-06 03:35:09 +03:00
### If Glide isn't installed, install it:
2017-01-06 03:35:09 +03:00
```
$ go get -u github.com/Masterminds/glide
```
### Install lnd:
2017-01-06 03:35:09 +03:00
```
$ cd $GOPATH
$ git clone https://github.com/lightningnetwork/lnd $GOPATH/src/github.com/lightningnetwork/lnd
$ cd $GOPATH/src/github.com/lightningnetwork/lnd
2017-01-06 03:35:09 +03:00
$ glide install
$ go install . ./cmd/...
```
### Install btcutil: (must be from roasbeef fork, not from btcsuite)
2017-01-06 03:35:09 +03:00
```
$ go get -u github.com/roasbeef/btcutil
```
### Install btcd: (must be from roasbeef fork, not from btcsuite)
2017-01-06 03:35:09 +03:00
```
$ cd $GOPATH/src/github.com/roasbeef/btcd
$ glide install
$ go install . ./cmd/...
```
### Start btcd (will create rpc.cert and default btcd.conf):
2017-01-06 03:35:09 +03:00
```
$ btcd --testnet --txindex --rpcuser=kek --rpcpass=kek
2017-01-06 03:35:09 +03:00
```
Before you'll be able to use `lnd` on testnet, `btcd` needs to first fully sync
the blockchain. Depending on your hardware, this may take up to a few hours.
2017-01-06 03:35:09 +03:00
(NOTE: It may take several minutes to find segwit-enabled peers.)
2017-01-06 03:35:09 +03:00
While `btcd` is syncing you can check on it's progress using btcd's `getinfo`
RPC command:
2017-01-06 03:35:09 +03:00
```
$ btcctl --testnet getinfo
{
"version": 120000,
"protocolversion": 70002,
"blocks": 1114996,
"timeoffset": 0,
"connections": 7,
"proxy": "",
"difficulty": 422570.58270815,
"testnet": true,
"relayfee": 0.00001,
"errors": ""
}
2017-01-06 03:35:09 +03:00
```
Additionally, you can monitor btcd's logs to track its syncing progress in real
time.
You can test your `btcd` node's connectivity using the `getpeerinfo` command:
2017-01-06 03:35:09 +03:00
```
$ btcctl --testnet getpeerinfo | more
2017-01-06 03:35:09 +03:00
```
### Start lnd: (once btcd has synced testnet)
2017-01-06 03:35:09 +03:00
```
$ lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --externalip=X.X.X.X
2017-01-06 03:35:09 +03:00
```
If you'd like to signal to other nodes on the network that you'll accept
incoming channels (as peers need to connect inbound to initiate a channel
funding workflow), then the `--externalip` flag should be set to your publicly
reachable IP address.
#### Simnet Development
If doing local development, you'll want to start both `btcd` and `lnd` in the
`simnet` mode. Simnet is similar to regtest in that you'll be able to instantly
mine blocks as needed to test `lnd` locally. In order to start either daemon in
the `simnet` mode add the `--bitcoin.simnet` flag instead of the
`--bitcoin.testnet` flag.
Another relevant command line flag for local testing of new `lnd` developments
is the `--debughtlc` flag. When starting `lnd` with this flag, it'll be able to
automatically settle a special type of HTLC sent to it. This means that you
won't need to manually insert invoices in order to test payment connectivity.
To send this "special" HTLC type, include the `--debugsend` command at the end
of your `sendpayment` commands.
2017-01-06 03:35:09 +03:00
```
$ lnd --bitcoin.active --bitcoin.simnet --debughtlc
2017-01-06 03:35:09 +03:00
```
### Create an lnd.conf (Optional)
Optionally, if you'd like to have a persistent configuration between `lnd`
launches, allowing you to simply type `lnd --bitcoin.testnet --bitcoin.active`
at the command line. You can create an `lnd.conf`.
**On MacOS, located at:**
`/Users/[username]/Library/Application Support/Lnd/lnd.conf`
**On Linux, located at:**
`~/.lnd/lnd.conf`
Here's a sample `lnd.conf` to get you started:
2017-01-06 03:35:09 +03:00
```
[Application Options]
debuglevel=trace
debughtlc=true
maxpendingchannels=10
profile=5060
externalip=128.111.13.23
externalip=111.32.29.29
[Bitcoin]
bitcoin.active=1
bitcoin.rpchost=localhost:18334
2017-01-06 03:35:09 +03:00
```
Notice the `[Bitcoin]` section. This section houses the parameters for the
Bitcoin chain. Also `lnd` also supports Litecoin, one is able to also specified
(but not concurrently with Bitcoin!) the proper parameters, so `lnd` knows to
be active on Litecoin's testnet4.
#### Accurate as of:
roasbeef/btcd commit: f8c02aff4e7a807ba0c1349e2db03695d8e790e8
2017-01-06 03:35:09 +03:00
roasbeef/btcutil commit: a259eaf2ec1b54653cdd67848a41867f280797ee
2017-01-06 03:35:09 +03:00
lightningnetwork/lnd commit: d7b36c6