chatochi_notes/lightning_node_management.md

160 lines
7.3 KiB
Markdown
Raw Normal View History

2022-01-14 09:43:21 +01:00
# Lightning Node Management
2022-01-15 17:14:13 +01:00
My umbrel node is almost in sync with the blockchain so soon I will be able to
put my new lightning node into use. These past days I have been consuming a lot
of material on how to prepare the lightning node, with the idea in mind of
making a successful routing node.
2022-01-14 09:43:21 +01:00
These are the topics that I have in mind:
- UPS for uptime
- Channel opening strategy
- Channel rebalancing strategy
- Pricing strategy
## UPS for uptime
2022-01-15 17:14:13 +01:00
I have learnt through different sources that it is important to have a "good
reputation" in order to have more chances of peers connecting to my node. Now,
reputation is rather fuzzy, and varies from simply people observing your node
on 1ML or similar pages, to a variety of rankings and scores such as BOS,
Lightning Terminal Tiers, 1ML node rank, etc.
One of the components of most of these scores, and more fundamentally, a strong
signal of node quality, is uptime. Plain and simple, never go down, and if you
do, don't spend much time down.
In order to ensure that my node does a good job in terms of availability, I
have been studying the possiblity of using a UPS. In general terms, an outage
is the only relevant (as in both probable and impactful) event that could put
my node down.
I have been reading up a bit on UPS. By design, they are designed to only
provide a few minutes of availability to securely put services down in the
machine that is going to go dry. But since both Banky and my router are super
low consumption devices, I'm actually hoping that a decent UPS could provide a
handful of hours of activity if needed. Notice I'm also including the router in
the equation because, obviously, if the internet connection goes down, keeping
2022-01-14 09:43:21 +01:00
Banky on is not enough.
So I need to:
- Decide what UPS I should get. The main points here are:
- Price
- Battery capacity
- That it has two sockets.
2022-01-15 17:14:13 +01:00
- Confirm that, in the event of a house-level power outage, the router still
keeps connecting to WAN as long as it has electricity. It would also be good
to check with a building/street level outage, but I think simulating that
goes beyond my current capacities.
2022-01-14 09:43:21 +01:00
- Measure empirically how long does the setup last until the node disconnects.
2022-01-16 20:19:14 +01:00
---
After a couple of conversations with people that roughly knew what they were
talking about, I have concluded that indeed, a decent UPS should be able to
keep banky + the home router up and running for more than an hour. Calculting
the specifics is pretty irrelevant, since there are a lot of real world factors
that will change results and it's not all that important.
I'll simply buy a nice one from pccomponentes and that's it.
2022-01-14 09:43:21 +01:00
## Channel Opening Strategy
2022-01-15 17:14:13 +01:00
Once I get funds in my lightning node, I need to start opening channels. As I
do it, they will all be unbalanced, with all the funds sitting in the local
side. I'll have to compensate for that since I don't expect anyone opening
towards me initially (I'm not gonna showcase myself all over the place to get
people's attention). But I'll discuss that in another section.
2022-01-14 09:43:21 +01:00
So, I need to open channels to people. The key questions are:
- With who?
- How many sats to put into each channel?
2022-01-15 17:14:13 +01:00
Regarding channel size: generally, the larger, the better. It helps reduce the
impact of onchain fees, offers more opportunities for keeping things balanced
and also enables larger transactions to go through. The downside of making one
channel large is the opportunity cost of having a few smaller channels, which
increase the variety of nodes.
2022-01-14 09:43:21 +01:00
2022-01-15 17:14:13 +01:00
From what I've been reading, anything smaller than 1M sats gives yields more
trouble than benefit. So I will keep that as a minimum size for the channels I
open. Question is, how big should the bigger channels be?
2022-01-14 09:43:21 +01:00
I'm copying a table from the statistics page in 1ML, on 13/01/22:
| Percentile | Capacity in Satoshis |
| --- |----------------------|
| 1 | __.__2.000 |
| 5 | __._24.900 |
| 25 | __.200.000 |
| 50 | _1.000.000 |
| 75 | _3.000.000 |
| 95 | 14.995.600 |
| 99 | 50.000.000 |
2022-01-15 17:14:13 +01:00
So, it's clear that going above 0.1 BTC is a pretty rare exercise. I'm planning
on allocating 0.2 BTC in total during my first experiments, so I think I will
distribute them in the following way:
2022-01-14 09:43:21 +01:00
| How many channels | Capacity per channel |
|-------------------|----------------------|
| 1 | 5.000.000 |
2022-01-15 17:14:13 +01:00
| 3 | 2.500.000 |
| 7 | 1.000.000 |
| 11 | 19.500.000 |
2022-01-14 09:43:21 +01:00
2022-01-15 17:14:13 +01:00
The missing half-million will be used as petty cash for fees.
2022-01-14 09:43:21 +01:00
2022-01-15 17:14:13 +01:00
The next question is: who to connect to?
2022-01-14 09:43:21 +01:00
2022-01-15 17:14:13 +01:00
Intuitively, the goal of any routing node intending to place itself in the
network should be to find a place in the graph that's poorly connected but has
a big demand for moving funds. Since reading the future is impossible, and
there is no history of transactions available for anyone to make forecasts on,
it's impossible to assess the demand.
Thus, the only thing one can try is to put itself between different nodes that
are relevant in terms of traffic, but are not properly connected. This means
that simply connecting to the largest nodes won't work, because they are
already very well connected between themselves. I think that, instead, I should
try to connect to both some of the large nodes, but also to a few smaller ones.
Given the channel capacity strategy that I present above, it naturally follows
that to have a few, large channels for large nodes and many, smaller channels
for smaller nodes.
Ok, this is as far as my intuition goes. Now I'm going to do a bit of research
2022-01-16 01:15:29 +01:00
to try to find out if there are any other factors I'm missing in my thinking.
----
I came
across [this brilliant post by Jameson Lopp](https://blog.lopp.net/lightning-network-liquidity-management-guide/)
. Awesome stuff, as it tends to be when he writes it. In it, it gives a
thorough explanation of his own experience trying to run a routing lightning
node. There is plenty of knowledge to get from it, but the main points I'm
keeping in mind for now are:
- Avoid channels smaller than 1M sats completely. If possible, do larger than
10M sats.
- The rebalance tool by carsten otto works nicely, but only if you don't also
have an automatic fee setter (or if you do, just make sure that rebalancing
and fee setting happen not so frequently and with time between both).
- The swaps on [lightningnetwork.plus](https://lightningnetwork.plus) are a
good idea and not some random internet scam, so I should look into how to use
that.
A few links to interesting stuff that I got from Lopp's post:
- [An article by Alex Bosworth](https://github.com/alexbosworth/run-lnd/blob/master/LIQUIDITY.md)
, with the usual thoughts. One new idea I had not seen anywhere though: using
my own node to make payments on the lightning network is a great way to
rebalance channels that need inbound liquidity.
- [Node match tool](https://moneni.com/nodematch) to find nodes that increase
connectivity of another node (mine, basically).
- [Lightning Terminal page](https://terminal.lightning.engineering/#/) to get
scores on any node. Good for judging candidates for channel opening.
- [Lightning conductor](https://lightningconductor.net/receipt), which offers
liquidity services including a pretty convenient services to open an incoming
channel with an on-chain transaction.