Lightning Network (LN) : How to become a LN Node Operator
How to run a LN node and route payments on the network, a full detailed guide for beginners, no prior experience with LN required, simply follow along
I recently wrote a long twitter thread around how to run a LN Node and become a node operator & route payments successfully on lightning. Please find the thread below in this article. Enjoy.
1/n] Lightning network (LN) is a layer 2 solution for payments/transaction scaling on top of bitcoin which serves as the base layer of settlement. Thread below on how to setup your own LN node and start routing payments (for beginners, no experience required, follow step by step)
2/n] Start with getting yourself a full node setup. There are many ways of doing this, the simplest one i recommend is via umbrel.com. I built my own node on a raspberry pi-4 a little before they came up with an umbrel server option which is simply plug & play.
3/n] Let's say you want to build your own node. Go ahead and follow the buy parts option listed there which will take you to amazon links to buy these parts. Basic parts needed are-
a) raspberry pi-4 (~$100-$140)
b) 1TB+ SSD (~$100 for 1TB ; $200 for 2TB)
c) 16 GB+ SDcard ($20)
4/n] Parts add-on includes the following -
a) SSD enclosure - Case for your SSD (~$12)
b) Ethernet cable - To connect to your router (~$5)
c) Power supply for RasPi (~$20)
d) RasPi cover case (~$20-$40)
You can also buy a starter kit for RasPi-4 model B 8GB RAM. Details next.
5/n] I went with Canakit RasPi-4 starter kit for $150. It includes -
a) RasPi-4 model B 8GB Ram
b) RasPi case
c) Fan
d) Power cable
e) Heat sinks
So i only had to get the additional SSD (+case), SD card & ethernet cable and i was good to go. The total cost to me was around $300
6/n] Umbrel has come up with a plug & play option which has a great look as well. Its shipping for $429 for 1TB option and also includes a really cool display screen. If i had to do it all again, i would simply go with this instead of building my own and pay the extra 120$ or so.
7/n] Okay, follow steps below once your node (or part) arrives. Insert the sd card, Connect the SSD, Plug in the node to any available port on the back of your home router and connect the power supply to power it on. Instructions are easy to follow. Your node is now ready to go.
8/n] Now, go to your web browser and type in umbrel.local to access your node. You'll be asked to enter a password & save your 24 word seed phrase. I recommend writing it down in a few places. Once you're done with these setup steps, you're in and can access the umbrel server UI.
9/n] You'll now be seeing your node sync to the bitcoin core, basically time travel back into the past and sync each block. This can take a while and be slow upfront. It took my node 4 full days to sync to the timechain. Details on few issues & troubleshooting below-
10/n] I had poor internet download speed. I was getting 50 mbps at best, in the beginning it seemed like i'll need a month to sync up. I was using a splitter connection to the router which was slowing it, so i changed it up to increase speed and restarted my node. It helped.
11/n] You can send some bitcoin your wallet address even while the node is syncing up and it'll show up in due course of time. I did this and received my funds in my wallet on day 2 when my node was around 15% synced. I used the time during sync to watch videos on LN channels etc
12/n] One video I recommend while passing time during sync is linked below, I watched it 2-3 times to learn everything, one time on a flight back from my work -
@BTCsessions great job sir!
13/n] Now let's assume time has gone by and your node is all synced up. You now want to play around with LN and I don;t blame you, so let's do it. Go ahead and download these 3 apps-
1/ Thunderhub
2/ Ride The Lightning
3/ Lightning Terminal
Details next.
14/n] The way LN works is through channels. Before we go ahead and open channels, go ahead and bookmark a few websites we'll use moving forward-
a) 1ML - 1ml.com
b) Terminal Web - terminal.lightning.engineering/#/
c) Amboss - amboss.space
continued..
Terminal Web - Lightning LabsFor Lightning node operators to gauge their node’s performance and get actionable recommendations on ways to improve.https://terminal.lightning.engineering/#/
Amboss Space - Lightning Network ExplorerLightning Network Explorer. Search for nodes and channels on the Lightning Network and get detailed information on them.https://amboss.space/
15/n]
d) LN+ -lightningnetwork.plus
e) Mempool - mempool.space
f) LN Node Insight - lnnodeinsight.com
I recommend making a bookmark folder 'LN' and save these websites for easy access. You'll be using them frequently going forward.
Swaps Index • LightningNetwork+Bitcoin Lightning Network Liquidity Swap Organizerhttps://lightningnetwork.plus/
https://mempool.space/
16/n] We need to do one more thing before we move to opening channels and that's transferring some sats to our bitcoin wallet. The way it'll work is as you open channels, sats will be taken out of your bitcoin wallet and moved to LN wallet as 'local' balance on your open channel.
17/n] If this is confusing, just go ahead and put 1-2M sats on your bitcoin wallet and lets go step by step. Okay, next open the app [Thunderhub] on umbrel. Default password is [moneyprintergobrrr]. Should look something like this below-
18/n] Now, you want to open channels. So go to [channels] on the menu on left. Click on [settings] - [open] - [manual]. It'll look like this below. You need the following info to open your first channel -
a) LN Onion Address
b) Channel size (sats)
c) Fee Amt
Details next.
19/n] I would recommend to open your first channel with a very well connected peer. So we visit terminal.lightning.engineering/#/ and see the list. Lets keep it simple and open a channel with walletofsatoshi (wos). This node will connect us to many good peers and has great capacity as well
Terminal Web - Lightning LabsFor Lightning node operators to gauge their node’s performance and get actionable recommendations on ways to improve.https://terminal.lightning.engineering/#/
20/n] Okay, let's copy the onion address (first string of numbers) to WOS and go back to Thunderhub. Paste this address where it says [node]. Select [new peer] as yes. Put the channel size as what you'd like. I recommend 1-2M sats if you can. select fees you want to pay now....
21/n] For fees, right now the fees are really low so i would just go ahead and do [auto] and select [fastest] to get this one channel opened quickly. Otherwise, go to mempool.space and see the fees. Looks like 7-11 sats/byte will get us there.
http://mempool.space
22/n] Click [open channel] and wait for the notification to tell you the channel is opening. It'll take 2 confirmations on the blockchain for the channel to reflect on thunderhub. If you selected [fastest], this should be done within the hour. Now you have a channel opened.
23/n] First thing you will notice when you go to channels and see this is that all the balance is in blue or 'local'. Take for ex. my open channel with ln.nicehash (at the bottom). I opened this with 1.5M sats from my side. All of it is local which gives me 'outbound liquidity'..
24/n] But not any 'incoming liquidity' or 'remote' balance in (green). What this basically means is that you can spend sats through this channel but you cannot receive them yet. So there is no two way street for sats to and from you yet. This is an issue we need to resolve.
25/n] The biggest thing about LN channels is 'incoming liquidity' and you'll hear this a lot. There are a few ways of getting it -
a) Loop out liquidity
b) Rent incoming liquidity
c) Open swaps via lightningnetwork.plus
I've tried a) & c) and will go through them next.
Swaps Index • LightningNetwork+Bitcoin Lightning Network Liquidity Swap Organizerhttps://lightningnetwork.plus/
26/n] Let us look at loop out first & practice a bit. Go ahead and open the app [Ride the Lightning]. It will ask you to change your password, default is again [moneyprintergobrrr]. Now we'll use their loop out function to send some sats from our side (local) to (remote).
27/n] Go to [Lightning] - [Peers/Channels] and click your channel [actions] tab. Click on [loop out]. It will ask you for loop out details next. You'll need to specify the amount you want to loop out as well as the fees (%) you're willing to pay.
28/n] Here's an example below. You can go ahead and loop out 50% of your channel local balance to try this out. Fees are slightly high for looping out and the fee split will be shown to you. Go ahead and confirm the loop out. It should be confirmed after 'xx' confirmations.
29/n] Once loop out is done, you can go back to Thunderhub. Open channels again and now you should see balance on both sides of your open channel. In our case, we should see 50% on both sides of our channel with WOS. So if we started a channel with 1M local balance...
30/n] 500k sats local (blue) and 500k sats remote (green). What we've basically done is give us the capacity to both send and receive payments on LN via wallet of satoshi now or have a 'balanced channel'. You would also notice, the funds are credited to your bitcoin wallet.
31/n] So you should receive back 500k sats in your bitcoin wallet from the loop out and this way you're net even. Your balance is strictly 'local', you've pushed 500k sats to 'remote' on wos's side and have received 500k sats in your bitcoin wallet, making it even.
32/n] The way this was done is when you initiated loop out, you told lightning labs - "hey, i'm sending you 500k sats through wos channel (remember you could spend through this channel). Can you send me back 500k sats to my bitcoin wallet making this even, and i'll pay you a fee"
33/n] @lightning said "Ok boss, here we go. Done". When you send 500k sats through this channel to lightning labs, it basically moved 500k sats from your local balance to remote balance on this channel because that's how LN payments work. We route payments via channels. Get it?
34/n] When you receive 500k sats in yo bitcoin wallet, this becomes an even transaction and you lost nothing barring a small fee. And you got a balanced channel in return allowing you to both spend & now receive payments via walletofsatoshi which is linked to multiple peers.
35/n] You've done great. Now let us test out another way of getting some inbound liquidity or having a balanced channel with someone. In comes LN+ to help us out (remember we bookmarked this for a reason): lightningnetwork.plus , so we'll start a swap with plebs on the internet
Swaps Index • LightningNetwork+Bitcoin Lightning Network Liquidity Swap Organizerhttps://lightningnetwork.plus/
36/n] To do this, let;s transfer some more sats to our bitcoin wallet so we have liquidity to open more channels with plebs. Let's say you transfer 1M sats more on your bitcoin wallet and are ready to start or participate in your first swap. Let's look for some open applications
37/n] Open swap applications are ones already started by plebs like us who're looking to have balanced channels opened with peers. Remember we're all in the same boat, we're all looking for that sweet 'inbound liquidity'. Applications may have certain restrictions, details next..
38/n] When you open an application for a swap you can specify the minimum sat channel you want to open, the peers you want to open channels with by calling out some min. channels they already have and min. capacity on channels they have. This can restrict the quality of nodes..
39/n] But we just got started, so what do we do? We have a few options here.
a) Look for open applications where you meet the restrictions and go join the swap.
b) Open a new application yourself and specify the min requirements you already meet
c) Open more channels first..
c) Open more channels first like we opened one with wos. This would pump up your number of channels opened & maximum capacity you have on channels. FYI, your node capacity = Sum of local balances on all open channels + Sum of remote balances on all open channels.
More to follow
40/n] Let me show what a completed swap application looks like. Here i'm showing the very first swap i did (a triangle swap) with two other peers. Whoever opens the swap is Node A (this case it was me). Graciously, two more peers joined me. First one who joins becomes Node B and.
41/n] The last one joining the triangle swap becomes Node C. Once everyone joins, you get an email telling you what your swap is ready to open channels. Here is where i got confused a bit, i did not know if the channels are opened by themselves or i have do them (duh..).
42/n] So you have to open channels. Let's take a look again. See where is says A opens to B, B opens to C and C opens to A (so a complete triangle). So let us go ahead and go to thunderhub again (or go to app as you are now realizing ofcourse). Click on Node B and copy their..
43/n] LN address so we can use that to open a channel with them on thunderhub. Okay so now that we've done that, lets go there again click [channels] - [open] - [new peer-yes]. Paste the onion address of Node B in there and put the capacity as what you had mentioned on the swap.
44/n] Lets say the swap was for 1M sat capacity so put down 1M sat. And go through the fee selection, check mempool.space again to see what makes sense and click open channel. So now you have opened a channel with Node B. What next, how is this a triangle swap?..
http://mempool.space
45/n] So, node C will also open a channel with you in return for participating in this swap and you should see that very soon on thunderhub. Once both these channels are confirmed, you would have two new channels on thunderhub, one would be the open you opened with node B with...
46/n] 1M sats as local (in blue) and the other would be the one Node C opened with you with 1M sats as remote (green). Also, Node B would've opened a channel with Node C. So this would complete the swap. We can now send & receive payments through these channels. Yay!
47/n] You also have an option to rebalance these channels if you'd like to and the details of that should be on the swap page itself. Only 1/3 peers has to initiate the rebalance and you can keep your fees low to do this. But. We haven't discussed rebalancing or fees at all, so.
48/n] Let us cover this portion next and go through it in detail. Running channels on LN, we'd have to get used to channel rebalancing & fee management for our channels to become good at routing payments through the network. So what's the wait, let's go through this together.
49/n] Okay let us discuss rebalancing, the elephant in the room, which you would've been hearing all over LN twitter? So what the heck is channel rebalancing all about? Well, it is simple. Once you start routing payments through the channels, the balances keep shifting...
50/n] from one channel to another. What you'll quickly see once you start routing some payments is that in one channel you'll shift balance from local (your side) to remote (the other side) while on another channel you'll get the same amount shifted from remote to local..
51/n] keeping balance of funds the same on your side as well as the others. Simple. All you did was you helped route payments on the network and collect some fees in return which we'll go through later. But for now, this brings a slight problem for you to manage, you guessed it..
52/n] Now sats have moved around in your channels. Let's take an example. So i routed a payment from wos to W01. This trimmed down my local balance with wos significantly. So my capacity to route payments again via wos has now gone down quite a bit. Understand now?
53/n] So for me to keep routing payments via wos, you would need to rebalance this channel to get back some of that lost local balance (routing liquidity). So, how do we do this? Well this is called circular rebalancing and is the tip of channel management, some call it art.
54/n] Let's take a look at a rebalance example to learn more and test it. Open the rebalance tab on thunderhub again. You'll see two peer selection options. One is 'outgoing' while the other is 'incoming'. Lets understand what each means so we're all clear and ready to do it.
55/n] 'Outgoing' channel is the one where you want the sats to flow out of, or where there is too much local (blue) built up and you want to spread it to other channel where there is not enough local (blue) balance. For our example, this would be W01 since by routing payments..
56/n] we ended up having a lot of local (blue) balance with W01. so let us rebalance it. So select this channel as 'outgoing' or the one through which sats will be spent out. Next, we cover the 'incoming channel', which is the one where you want the sats to flow into..
57/n] or where there is too little local [blue] balance on our side because of routing payments through that channel. So in our case, that would be wos. So select this channel as 'incoming' or the one through which sats will come in. See below. Keep in mind, i had already moved..
58/n] funds between these two channels or rebalanced them, so it is showing the opposite here where my local balance with W01 is low and wos is high. But before rebalancing it was the other way around, and hence the rebalance to get to steady state again. Get it now?
59/n] Okay, i think you're starting to get it now. Now you can also do this same rebalancing through the other app 'Ride the lightning', so let's take a look at that as well since this is an important aspect of proper channel management since we're already pros at the rest.
60/n] Open RTL. Go to [lightning] - [peer/channels]. Now you'll see the list of the channels. Click on the channel which you want to be the 'outgoing' or where you want the sats to move from your local (blue) balance as it has built up a lot via payment routing. So, W01 for us.
61/n] Click on [circular rebalance]. It'll look like this. Next you'd want to call out the amt. to rebalance and the 'incoming channel' or 'receive from peer'. Basically means the peer you would like to receive sats into on your local (blue) side. For us this would be wos. Get it
62/n] Now we can click rebalance and wait for it to confirm. Keep in mind, some occasions rebalancing can fail, has happened to me multiple times. The reason could be many - i've figured (just from experience), fees is one of them. So, let us discuss fees next since thats left.
63/n] Okay so fees. The good part, the incentives. You want to route payments, because you want yo cut aka fees. So lets look at it. Fees for routing is split into two portions - base fee & fee rate. Base fee is the one which you always collect on the payment being routed..
64/n] Typically the base fee is set to 1sat or so what i've seen. I've listened to some twitter spaces discussing a zero base fee model but lets just go with the basic here since we learning and set it to 1sat for all channels for now. Now, the fee rate. This is the variable.
65/n] Fee rate is where you collect most of your fees on payment routing. It is described in ppm or easier said (sats / million sats routed). Typically i've seen this set to anywhere between 10-1000ppm. I personally started off with 100-200ppm fee rate to test the network out.
66/n] Let's do a quick math here. So let's pay you routed an invoice through your channel for 100k sats. Your base fee was 1 sat and your fee rate was 100ppm.
Total fee collected will be 1 + (100*100k/1M) = 1 + 10 = 11 sats. So you'll make 11 sats on this payment, congrats!
67/n] Now whats the best fee rate to choose? Is it dependent on each channel or should i keep it the same all across? Is there a way to see what average fee rate is through the channel i opened so i have an idea of the range? These are all great questions, so let us discuss more.
68/n] Listen, i'm new to LN myself. so i;m not an expert. But let me show you one site which can help us here or so i've come to know. Go to amboss.space, remember we bookmarked this one as well but never used it uptil now, well lets change it shall we? Jump on it.
Amboss Space - Lightning Network ExplorerLightning Network Explorer. Search for nodes and channels on the Lightning Network and get detailed information on them.http://amboss.space
69/n] Logging into amboss is slightly more challenging but we'll get there. For this, we'll have to sign the message via our private key (cryptography amirite?). So lets copy the message shown here and go to thunderhub next to sign this message and verify our node identity.
70/n] Go to [tools] - [sign message]. Now paste the message we just copied into the message bar here and click [sign]. now copy the signed message and paste it on amboss again and this should confirm your identity. Next we'll look up a channel on amboss and study fee structure..
71/n] Now lets go to 1ML and look up wos so we can copy their address to amboss to search. we can also do this via terminal labs which we did before, but why not try 1ML as well. Okay so here we found wos on 1ML.com , copy their onion address (which we're pros at)
72/n] Ok, so here we've found wos on amboss now and if you go scroll down below, you'll see something called a fee report. Now since ours will be incoming fees to wos, we can look at the metrics for it below and check the weighted avg, avg and median fee rates peers are charging.
73/n] This is one way we can get an idea for what the fee rate looks like for a particular channel so we could atleast be in the ballpark for starters. Looks like we underbid on our end to wos with just 100-200ppm but oh well, we're just starting out and want some order flow.
74/n] Okay now, we've learnt about both fee rate management & channel rebalancing. As you now realize, this would soon become the crux of your work on LN after a while & will be important for running a profitable routing node.
75/n] Keep in mind, we incur fees on loop outs, circular rebalancing, channel openings, channel closing, on chain fees (mempool) etc. So, this is where the game needs to be played. So atleast we understand the game now and its not like we playing checkers while pros play chess.
76/n] Don't worry we're just getting started. Only been a few days. Now lets setup a brand for our LN node, why not? Why don't we verify our node on 1ML and keep track of our growth along with the rest of the peers. Shall we? So login to 1ML.com next.
77/n] Do your credentials check and then go to adding a node. The way it will be done here is they'll ask you to open a channel with them (their LN node) for a specific amt of sats. Go ahead and do that on thunderhub. Open a channel by copying 1ML's node address and the sat amt.
78/n] Now, we're in with 1ML and can see where we stand with the rest of the nodes there. So let's dive in on some stats, why not. As we see, we see rankings based on channels, capacity, age, growth & availability. The lower is better. So how do we jump up the list, lets discuss.
79/n] Let's go point by point-
a) channels - the more channels we open, the better our ranking becomes. simple. should happen over time.
b) capacity - the more sats we lock up in our channels combined, the better our ranking becomes, simple. again, should happen over time.
80/n]
c) age - the longer we run our LN node, the better our ranking becomes. definitely should happen over time (lol)
d) availability - the longer our uptime & the longer we remain available to route payments, the better our ranking becomes. again we should be ok over time.
81/n] Now keep in mind, while we're doing this, the rest of the nodes are doing this as well, so it's kind of a race but i think we're very early here. We're setting ourselves up for not just the next year but the next decade folks, because guess what..
82/n] Lightning will serve as the payment rails on top of bitcoin as base layer of money for the whole fucking world, or so i believe. And that takes time. We already have El-salvador with chivo & strike wallets and many more. We're now part of the network running their payments.
83/n] So let's stick to it, learn as much as we can and grow overtime. Keep adding channels. Keep doing swaps. Keep locking up capacity. Keep connecting with well established peers. Keep getting better at proper channel management and we will win.
84/n] Some of you maybe wondering how to add an alias to your LN node? How are these cool kids doing it. Well its pretty easy. Here are the steps to follow with super easy instructions from umbrel. I was able to grab an alias this way easy.
How to create a Lightning Node Alias?Want to set an alias for your Umbrel Node? Follow these steps: Log in to your node using SSH. Usually this means opening a terminal and typing ssh -t umbrel@umbrel.local. The user is umbrel. Defau…https://community.getumbrel.com/t/how-to-create-a-lightning-node-alias/1252/2
85/n] Listen, this may all seem a lot of work right now but once you get started, things can flow very quickly. Guess how long it took me to reach this far? 2 days. Honestly. Just stick to it. Think long term, you're setting yourself up like the early days of the internet in 99.
86/n] It took me a couple hrs to write this thread, if you like or appreciate it, do lmk & give me a follow if you can. I'll keep writing threads around tricks to get better at this as i learn myself. We're in it together. Shout out to the plebs.