These are helpful notes I have compiled about the Bitcoin Lightning Network. This covers everything from basic info, which wallets support lightning, and even advanced information about running a lightning node.
Special thanks to everyone who has been contributing to Lightning for years and the community who has helped me find all of this info online and IRL.
Blue Wallet / Umbrel Non-Custodial Walkthrough
Install btc / lnd and torrent the bootstrap from Jeff Garzik
Lightning is a micropayment system for sending bitcoin cheaply and quickly. Since bitcoin transactions are relatively slow and expensive. Lightning enables people to send and receive small payments to and from other people. Lightning is considered a scaling solution for bitcoin or a "layer-2" solution. It uses the bitcoin network to track and execute certain commands. Bitcoin can never leave the bitcoin chain, but lightning nodes can transact between themselves and then settle their balances on bitcoin at a later time.
First thing you should do is read a bit of the documents here and get familiar with the terminology below. This will help you understand everything else in this document.
https://lightning.network/lightning-network-summary.pdf
https://bitcoiner.guide/lightning/
-
On-chain - a transaction or balance on the bitcoin blockchain
-
Node - a server that runs an implementation of lightning which
can create channels to other nodes.
-
Alias - a public "display name" identifier for your node
-
Peer - a node that you are able or have connected to connect to
via a channel
-
Channel - a connection between 2 lightning nodes which can be
private or public. A channel is just a special bitcoin transaction. it makes a 2-of-2 multisig that both parties have to sign to do anything with on-chain
-
Overall Capacity - the amount of BTC that is locked into the
channel
-
Remote Capacity (inbound liquidity) - the amount of Lightning
BTC available to be sent TO your node on a channel
-
Local Capacity (outbound liquidity) - the amount of Lightning
BTC available to be sent FROM your node on a channel
-
Rebalance - the process of creating or restoring a balanced
state in the ratio of your remote and local capacity
-
Tanuki Node - a Lightning node with total local capacity of at
least 0.615 BTC.
-
WUMBO channel - channel of more than 16M sats and require 6
confirmations
-
Keysend - sending a payment to a lightning node id instead of an
invoice
-
Invoice - most lightning payments are sent to an invoice which
determines the amount and the node to send to
These wallets allow you to use the Lightning network for sending and receiving payments - most also support regular bitcoin transactions.
-
Muun - noncustodial wallet supports lightning and BTC in a single balance
-
Breez - noncustodial wallet, runs a lightning node on your phone
-
Zap - useful for controlling your node
-
Wallet of satoshi
-
Blue wallet
-
Phoenix (android only) - noncustodial wallet, runs a lightning node on your phone
-
500+ GB Storage (2 drives recommended)
-
2GB RAM (16GB recommended)
-
+ CPU cores help sync speed
-
Bandwidth requirements are minimal / latency and uptime are
important
Install from apt like a miniboss
Compile from source like a boss using my gists
https://www.youtube.com/watch?v=iVPNk2ZZ63w&t=1s
https://www.reddit.com/r/Bitcoin/comments/2f9o9p/quick_guide_run_a_full_node_with_btcd_an/
https://github.com/lightninglabs/lightning-terminal/blob/master/doc/config-lnd-remote.md
https://github.com/lightninglabs/lightning-terminal/blob/master/doc/WALKTHROUGH.md
https://github.com/Ride-The-Lightning/RTL#install
https://github.com/apotdevin/thunderhub
https://github.com/alexbosworth/balanceofsatoshis
https://github.com/prusnak/suez
The goal of running a good node is to create channels with good peers so you can increase the score of your node on the network.
There are lots of great resources to find nodes to peer with and create channels that I have outlined below.
There is a cost associated with creating a channel. That cost is based on the bitcoin network and how busy it happens to be at the time you want to create a channel. This is because all channels must be opened with a bitcoin transaction that creates a multisig transfer between you and the other node.
Bitcoin transactions are priced in sats / virtual byte. Channels use 154 virtual Bytes (vB) to create. Therefore, a channel costs 0.00000154 BTC if you set the fee at the lowest price of 1 sats/virtual Byte (vB). The lower your fee, the more time it can take for the transaction to be included by a bitcoin miner. You can see the current bitcoin fee estimates here: https://bitcoiner.live/
Pending transactions on bitcoin are stored in the mempool which you can view here on mempool.space.
If the mempool is empty, then you can get transactions included for 1 sat / vB, but the larger the mempool becomes - the pricing to include a transaction becomes more expensive. The most expensive bitcoin transaction fees (not paid by mistake) was on Dec 21, 2017 at 1400+ sats/vB according to Johoe.
Great platform for creating channels of all sizes
This service will open a channel channel back to you with 500k sats capacity
Buy inbound liquidity from LNBIG to rebalance your channels
When LND, use these commands:
-
lncli pendingchannels
-
lookup channel_point in the result
-
paste the part before the colon (the hex stuph) into blockchain.info
-
check if there are confirmations / fee per byte
-outbound channels that get used frequently, you increase fees.
-outbound channels that get used infrequently, you decrease your fees
Look in your routing tab in RTL to determine channel usage.
-If you have a high local balance on a channel, you want to decrease your fees in order to encourage routing through that channel
-if you have a higher remote balance, then you increase your fees to discourage routing through that channel
-if you open to a big drainer channel like bitrefill or loop, you crank your fees. Look at their other channels to determine competitive rates.
-setting fees will only get you so far. You'll most like need to rebalance too if a channel gets used frequently. Some channels really only move one-way regardless of how you set your fees so rebalance to get more traffic. And make sure you're setting your fees in such a way that you make more than what it costs to rebalance.
-it's good to set your fee rates in your lnd conf file, otherwise every channel opened to you will be at the default. This is fine if you're just starting out.
https://lightning.engineering/loop/
From :prem: ghinde:
I started off small and joined a number of 1M rings but found next to no traffic. I'm a member of a private group who are trying to create a super node for want of a better term and we started with 1M channels internally too but were doing alright in terms of traffic. I recently joined a 5M ring and found my traffic through my node exploded so now I am focused on being more selective with who I open channels to but making the channels larger. This change has fed into our super node setup too and we're taking advantage of the low fees to close our chaneels and reopen at 2M to see what difference that makes. Just my own personal philosophy based on my learnings so far. Could be right, could be wrong. Also I'm more interested in creating a more decentralised network so when looking for bigger nodes to connect with I'll start at position 100 on the top nodes lists to research from.
Advice from AZHodl:
Personally, I would open up 5-10 channels to the best professional nodes from around the world and do another 5-10 rings. Keep your channels size between 1-10M. Finally, purchase liquidity from LN BIG and rebalance your channels like its your day job, close those channels when you empty and open new channels to peers.
From Xenonfun:
Once you have multiple channels if someone routes payments - one side will increase the other will decrease. the lightning network is a closed system, so your node doesn't really lose/gain sats beyond the fees the sender pays
you get paid fees for liquidity moving from your side to the remote side
yes, that was the fee to get it in the chain
well you now will be able to send micropayments for way way cheaper
the channels under 16Msats take 3 confirmations before they are open
and then if your path looks good a remote lnd server might pick your node to route thru and you will be paid for that liquidity moving from one side of the channel to another.
I must stress, make copies of your LND Seed, and make channel backup any time you add/remove a channel
your net balance of the whole server will not change, but balance between channels does
From Xenonfun:
and with 0.13 version they enabled AMP and MPP by default (splitting payments across multiple channels) which will help payment success
it's in an earlier version but not default on. only thunderhub uses it, RTL will not try doing MPP payments
AMP is MPP but for keysend payments
well your nodeID, can be consider an "address" in that with just that someone should be able to keysend a payment to you
you can make a very long duration invoice as well
like this one lnbc10n1psdzjhnpp59256waht5vw6qyfaqns6aau0hkl4haxs7qwjdaxr8uyrmhvpx4nsdqqcqzpgxq97zvuqsp5ccdne0uye8sr900896qmevmjkca8lar4szg6gh7cmpf85a07vsps9qyyssqtzwtcszakuek3vyzjuyqtpek0d8wfhdayajlh8gg88yvmc6gn7x3twuvzktnnnhw8mdjqn4skuxrzudnz64ztz5hsr7hprsumunqgtqp3eppe6