.TH "LIGHTNINGD" "8" "" "" "lightningd" .SH NAME lightningd - Daemon for running a Lightning Network node .SH SYNOPSIS .nf .RS lightningd [--conf=] [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 By default, C-Lightning will log to the standard output\. To log to a specific file, use \fB--log-file\fR=\fIPATH\fR\. 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 \fBlightning-rpc\fR in your specified \fBlightning-dir\fR\. You can use \fBlightning-cli\fR(1) to send commands to C-Lightning once \fBlightningd\fR has started; you need to match the \fB--lightning-dir\fR and \fB--rpc-file\fR options between them\. Commands for C-Lightning are described in various manpages in section 7, with the common prefix \fBlightning-\fR\. .SH QUICK START 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 at that IP: .nf .RS $ lightning-cli connect $PUBLICKEY $IP .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 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), \fBlightning-hsmtool\fR(8) .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\.