From 3da0e2011b64e6ca18a800bf8c871d6bdd976c08 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 12 Jan 2018 22:34:46 -0700 Subject: [PATCH] docker, docs, sample-lnd.conf: update examples for new command-line options --- docker/lnd/start-lnd.sh | 13 ++-- docs/INSTALL.md | 25 +++++-- sample-lnd.conf | 153 +++++++++++++++++++++++++--------------- 3 files changed, 128 insertions(+), 63 deletions(-) diff --git a/docker/lnd/start-lnd.sh b/docker/lnd/start-lnd.sh index 2601d8a0..e3367d9a 100755 --- a/docker/lnd/start-lnd.sh +++ b/docker/lnd/start-lnd.sh @@ -44,15 +44,20 @@ RPCPASS=$(set_default "$RPCPASS" "devpass") DEBUG=$(set_default "$DEBUG" "debug") NETWORK=$(set_default "$NETWORK" "simnet") CHAIN=$(set_default "$CHAIN" "bitcoin") +BACKEND="btcd" +if [[ "$CHAIN" == "litecoin" ]] + BACKEND="ltcd +fi lnd \ --noencryptwallet \ --logdir="/data" \ - "--$CHAIN.rpccert"="/rpc/rpc.cert" \ "--$CHAIN.active" \ "--$CHAIN.$NETWORK" \ - "--$CHAIN.rpchost"="blockchain" \ - "--$CHAIN.rpcuser"="$RPCUSER" \ - "--$CHAIN.rpcpass"="$RPCPASS" \ + "--$CHAIN.node"="btcd" \ + "--$BACKEND.rpccert"="/rpc/rpc.cert" \ + "--$BACKEND.rpchost"="blockchain" \ + "--$BACKEND.rpcuser"="$RPCUSER" \ + "--$BACKEND.rpcpass"="$RPCPASS" \ --debuglevel="$DEBUG" \ "$@" diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 42a1b0ac..b58da946 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -164,7 +164,7 @@ To run lnd in neutrino mode, run `lnd` with the following arguments, (swapping in `--bitcoin.simnet` for `simnet` mode if needed), and also your own `btcd` node if available: ``` -lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --neutrino.active --neutrino.connect=faucet.lightning.community +lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=neutrino --neutrino.connect=faucet.lightning.community ``` #### Running lnd using the btcd backend @@ -174,7 +174,22 @@ Otherwise, replace `--bitcoin.testnet` with `--bitcoin.simnet`. If you are installing `lnd` in preparation for the [tutorial](http://dev.lightning.community/tutorial), you may skip this step. ``` -lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.rpcuser=kek --bitcoin.rpcpass=kek --externalip=X.X.X.X +lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --btcd.rpcuser=kek --btcd.rpcpass=kek --externalip=X.X.X.X +``` + +#### Running lnd using the bitcoind backend + +In order to run `lnd` with a `bitcoind` back-end, the `bitcoind` instance must +be configured with `--txindex` just like `btcd` above. In addition, you'll need + to configure the `bitcoind` instance with `--zmqpubrawblock` and `--zmqpubrawtx` +(the latter is optional but allows you to see unconfirmed transactions in your +wallet). They must be combined in the same ZMQ socket address. Then, run this +command after `bitcoind` has finished syncing on testnet. Otherwise, replace +`--bitcoin.testnet` with `--bitcoin.regtest`. Please note that the `rpcuser` +and `rpcpass` parameters can typically be determined by `lnd` for a `bitcoind` +instance running under the same user, including when using cookie auth. +``` +lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=kek bitcoind.rpcpass=kek --externalip=X.X.X.X ``` #### Network Reachability @@ -196,7 +211,7 @@ at the command line, you can create an `lnd.conf`. **On Linux, located at:** `~/.lnd/lnd.conf` -Here's a sample `lnd.conf` to get you started: +Here's a sample `lnd.conf` for `btcd` to get you started: ``` [Application Options] debuglevel=trace @@ -210,7 +225,9 @@ bitcoin.active=1 Notice the `[Bitcoin]` section. This section houses the parameters for the Bitcoin chain. `lnd` also supports Litecoin testnet4 (but not both BTC and LTC at the same time), so when working with Litecoin be sure to set to parameters -for Litecoin accordingly. +for Litecoin accordingly. For node configuration, the sections are called +`[Btcd]`, `[Bitcoind]`, `[Neutrino]`, and `[Ltcd]` depending on which chain +and node type you're using. # Accurate as of: - _roasbeef/btcd commit:_ `f8c02aff4e7a807ba0c1349e2db03695d8e790e8` diff --git a/sample-lnd.conf b/sample-lnd.conf index 6bd3fd8c..7e1398cc 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -97,29 +97,6 @@ ; active. bitcoin.active=1 -; The host that your local btcd daemon is listening on. This MUST be set if -; neutrino mode isn't active. -; bitcoin.rpchost=localhost - -; Username for RPC connections to btcd. This only needs to be set if neutrino -; mode isn't active. By default, lnd will attempt to automatically obtain the -; credentials, so this likely won't need to be set (other than for simnet mode). -; bitcoin.rpcuser=kek - -; Password for RPC connections to btcd. This only needs to be set if neutrino -; mode isn't active. By default, lnd will attempt to automatically obtain the -; credentials, so this likely won't need to be set (other than for simnet mode). -; bitcoin.rpcpass=kek - -; File containing the daemon's certificate file. This only needs to be set if -; the node isn't on the same host as lnd. -; bitcoin.rpccert=~/.btcd/rpc.cert - -; The raw bytes of the daemon's PEM-encoded certificate chain which will be used -; to authenticate the RPC connection. This only needs to be set if the btcd -; node is on a remote host. -; bitcoin.rawrpccert= - ; Use Bitcoin's test network. ; bitcoin.testnet=1 ; @@ -129,6 +106,77 @@ bitcoin.simnet=1 ; Use Bitcoin's regression test network ; bitcoin.regtest=false +; Use the btcd back-end +bitcoin.node=btcd + +; Use the bitcoind back-end +; bitcoin.node=bitcoind + +; Use the neutrino (light client) back-end +; bitcoin.node=neutrino + + +[Btcd] + +; The host that your local btcd daemon is listening on. By default, this +; setting is assumed to be localhost with the default port for the current +; network. +; btcd.rpchost=localhost + +; Username for RPC connections to btcd. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for simnet mode). +; btcd.rpcuser=kek + +; Password for RPC connections to btcd. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for simnet mode). +; btcd.rpcpass=kek + +; File containing the daemon's certificate file. This only needs to be set if +; the node isn't on the same host as lnd. +; btcd.rpccert=~/.btcd/rpc.cert + +; The raw bytes of the daemon's PEM-encoded certificate chain which will be used +; to authenticate the RPC connection. This only needs to be set if the btcd +; node is on a remote host. +; btcd.rawrpccert= + + +[Bitcoind] + +; The host that your local bitcoind daemon is listening on. By default, this +; setting is assumed to be localhost with the default port for the current +; network. +; bitcoind.rpchost=localhost + +; Username for RPC connections to bitcoind. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for a remote bitcoind instance). +; bitcoind.rpcuser=kek + +; Password for RPC connections to bitcoind. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for a remote bitcoind instance). +; bitcoind.rpcpass=kek + +; ZMQ socket which sends rawblock and (optionally) rawtx notifications from +; bitcoind. By default, lnd will attempt to automatically obtain this +; information, so this likely won't need to be set (other than for a remote +; bitcoind instance). +; bitcoind.zmqpath=tcp://127.0.0.1:18501 + + +[neutrino] + +; Connect only to the specified peers at startup. This creates a persistent +; connection to a target peer. This is recommended as there aren't many +; neutrino compliant full nodes on the test network yet. +;neutrino.connect= + +; Add a peer to connect with at startup. +;neutrino.addpeer= + [Litecoin] @@ -136,27 +184,6 @@ bitcoin.simnet=1 ; active. ; litecoin.active=1 -; The host that your local ltcd daemon is listening on. This MUST be set if -; neutrino mode isn't active. -; litecoin.rpchost=localhost - -; Username for RPC connections to ltcd. This only needs to be set if neutrino -; mode isn't active. -; litecoin.rpcuser= - -; Password for RPC connections to ltcd. This only needs to be set if neutrino -; mode isn't active. -; litecoin.rpcpass= - -; File containing the daemon's certificate file. This only needs to be set if -; the node isn't on the same host as lnd. -; litecoin.rpccert=~/.btcd/rpc.cert - -; The raw bytes of the daemon's PEM-encoded certificate chain which will be used -; to authenticate the RPC connection. This only needs to be set if the ltcd -; node is on a remote host. -; litecoin.rawrpccert= - ; Use Bitcoin's test network. ; litecoin.testnet=1 ; @@ -166,21 +193,37 @@ litecoin.simnet=1 ; Use Bitcoin's regression test network ; litecoin.regtest=false +; Use the ltcd back-end (marked as btcd). No other back-end type is currently +; supported for litecoin. +litecoin.node=btcd -[neutrino] -; If the light client mode should be active or not. This mode requires less -; disk space as it doesn't require one to have full-node locally. Instead, -; neutrino will connect to the P2P network for all of lnd's needs. -neutrino.active=false +[Ltcd] -; Connect only to the specified peers at startup. This creates a persistent -; connection to a target peer. This is recommend as there aren't many neutrino -; compliant full nodes on the test network yet. -;neutrino.connect= +; The host that your local ltcd daemon is listening on. By default, this +; setting is assumed to be localhost with the default port for the current +; network. +; ltcd.rpchost=localhost + +; Username for RPC connections to ltcd. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for simnet mode). +; ltcd.rpcuser=kek + +; Password for RPC connections to ltcd. By default, lnd will attempt to +; automatically obtain the credentials, so this likely won't need to be set +; (other than for simnet mode). +; ltcd.rpcpass=kek + +; File containing the daemon's certificate file. This only needs to be set if +; the node isn't on the same host as lnd. +; ltcd.rpccert=~/.ltcd/rpc.cert + +; The raw bytes of the daemon's PEM-encoded certificate chain which will be used +; to authenticate the RPC connection. This only needs to be set if the ltcd +; node is on a remote host. +; ltcd.rawrpccert= -; Add a peer to connect with at startup. -;neutrino.addpeer= [autopilot]