My intro into the Bitcoin Lightning Network

End of last year I started a small project to dig into the Bitcoin Lightning Network rabbit hole. Looking for the complete experience, I directly setup my own Bitcoin node at home and was amaze by the easiness and relatively low cost to do it. Quickly I discovered many of the possibilities offered by the Lightning Network and for the first time understood its huge potential. There is so much to say and I still have so much to learn, that I have to split in several parts, and even probably add new articles in the future to cover other aspects more in details. If you like this kind of article, please comment below to support me going further on the topic.

First let’s start by the beginning in this first part.

What is the Bitcoin Lightning Network?

The Bitcoin Lightning Network, often abbreviated LN, is a second layer network on top of Bitcoin allowing fast and cheap transaction between participants while still being secured by the Bitcoin blockchain and thus indirectly by its Proof of Work mechanism. The basic idea is quite simple to understand for someone familiar with the basic of how Bitcoin works. But despite being simple, LN is still extremely powerful and open a lot of new possibilities and applications yet to be seen. The simplest way I found to explain it, is that two node operators agree to allocate a given amount of bitcoin in a multi-signatures transaction that state the quantity of bitcoin owned by each of the two node. This is called opening a channel and for this first step happened on the Bitcoin blockchain. After that, when the two nodes want to make a transaction between them, instead of making a new transaction on the main Bitcoin blockchain that will cost more or less high transaction fee and take between a few minutes to hours, the pair of node exchange a new signed transaction multi-signed with the update quantity of bitcoin on each side.

Nothing new is recorded publicly on the blockchain at this point as the transaction is not broadcasted but just saved, ready to be used if needed in case one of the node went offline for a long period of time or in case the other node try to cheat by trying to force close the channel with a previous state that is more in its favor. If a cheater is detected by the node that is being cheated (or another node watching for it as a guardian, called watchtower) all the bitcoin are send to the victim of the cheat, so nobody should try to cheat making it possible to open channel with any node even if you don’t trust or know its operator. By repeating this step of exchanging a pre-signed transaction that is kept as guarantee but not used most of the time, the two nodes can exchange as many time as they want a certain quantity of bitcoin in a direction or another within the maximum number of bitcoin that are available on each side according to the latest state agreed.

And that’s it, the bitcoin are now usable on the LN for as long as the two nodes are online and willing to keep the channel open. From a blockchain observer point of view the bitcoin are still in the same state as it was written in the block at the initial transaction. If the channel is not used anymore, one of the node could decide to close it and will ask the other node to sign a last transaction reflecting the latest state of the channel that will this time be executed on the Bitcoin blockchain and return to each other the remaining bitcoin on each side.

The first time I heard about LN, I didn’t took time to understand in detail the principle, I kind of understood what I explain above and was thinking: “This is pretty stupid, who want to pay a high transaction fee and wait 6 confirmations to open a channel to one person if all you want is to make one single cheap and fast payment to this person. It will just be more expensive and longer in most cases. Also I don’t see any real use case where I want to send and get back more or less the same amount of money between two persons on a period long enough to save on the initial transaction fee.” So I dismissed this new protocol, thinking I need to let them time to develop in a more useful way.

You don’t have to open a channel to each node

What I didn’t understood is that, once you have an open channel between two nodes, you are not restricted to exchange bitcoin between these two nodes alone. You can exchange with all nodes connected to all the nodes your are connected with. And you can hop several nodes in the network until you eventually reach the final person you are looking to send bitcoin to. All nodes in the system form a mesh network and as long as there is a path between two nodes, you should be able to exchange some bitcoin between these two nodes. Each node can open a channel to any other node without asking for permission. By default when you open a channel to another node, you allocate some bitcoin to this channel on your side and it will be how much you can send from your node to the other node using this channel. If you need to get an incoming payment, you will need that another node has enough bitcoin allocated to be send to your node. This can be done in two ways:

  1. You can pay a node operator to open a channel to your node and allocate some of its bitcoin that you wish to be able to receive to the channel in your direction.
  2. You coordinate with other node operator (if you don’t know any, they are forums, chat rooms and dedicated websites to get in contact with some of them) to connect to each other in a triangle, square or larger polygon shape so you get at least one output and one input channel with the same capacity. Then you can optionally re-balance between the channels, this mean sending from one channel to get it back from another one and have 50/50 capacity in each direction in both channel involved. So you will get half of the capacity you allocate as inbound and half as outbound.

Are all nodes equal?

Some nodes are controlled by individual, and stay usually quite small, and some are controlled by corporations or associations and can become quite large. What I mean by large is the number of channels open to and from other nodes and the total capacity allocated in these channels, in other words how many bitcoin are available for transfer in and out of the node. But whatever is the size of the node, they all have the same right and set of rules in the network. Each node can define a fixed and variable fee to use a channel. When you make a transaction, the node will try several paths into the mesh network to reach the destination and when more than one path are found, it will select the one with enough capacity and with the lowest fee. With the latest updates of the protocol, it’s even possible to split a transaction into several paths in case there is not enough capacity in one path or to optimize even more the cost.

There is still an important difference between the node. You can have a full node or a light node. A full node has a full copy of the Bitcoin blockchain with all transactions from the very beginning of the Bitcoin network starting in 2009. A light node just synchronize with a public full node (that you should trust to some extend) to verify the transactions without storing hundreds of GB of data locally (the Bitcoin blockchain is about 400GB as of today). Typically a user wallet on a laptop or smartphone will prefer a light node because it cannot stay online all the time and cannot store all the data needed. While a corporation, association or an enthusiast will dedicate a machine that run 24:7 to keep synchronize the full Bitcoin blockchain and don’t relay on any third party to participate in the network. It gives essentially more privacy and more control by allowing to run other apps to monitor, manage and use the node in the LN.

How much does it cost?

This question has several meanings and also depends what you are looking to do. To start using Bitcoin LN it cost almost nothing. You can download a free and open source wallet supporting LN, transfer some bitcoin to it and open a channel for a few cents of transaction fee on the blockchain and a few minutes or hour of time to confirm it. Then you can start sending bitcoin on the LN instantly and for a fraction of cents of fee. In fact the fee are so low on the LN that the common practice with LN wallet and users is to use the satoshi unit (sat or sats in plural) instead of the bitcoin unit (BTC). 1 BTC = 100’000’000 sats or 1 sat = 0.00000001 BTC. As of today exchange rate (February 2022), 1’000 sats = 0.37 CHF = 0.35 EUR = 0.40 USD. Fee to transfer some sats on the LN can vary from 0 to a few hundred sats, so we are talking about cents or even fraction of cents in most cases.

If you are looking to get incoming payments without sending much out and use a light node (like a mobile wallet), you have several solution. Some wallets offer to manage for you the channels and can open for you incoming channel. They cover this cost with the fee charged to use the channel. Alternatively you can find a node operator that offer to pay a fixed price (something like 1-2CHF or more depending on the capacity you need) to open a channel to your node with some of their bitcoin allocated for possible payment going from their side to yours. Of course you cannot force them to keep the channel open so if you don’t use it, they might decide to close it at some point. Usually they guarantee to keep it open at least a month but it all depends on the term of the service. You can also ask an enthusiast running a full node to open a channel to you. I could do that with my node for example if you ask nicely with a comment below.

Finally if your are looking to run a full node, you will have to invest a little on hardware. But, unlike other cryptocurrency, it stays relatively affordable for most people that are into computer and electronics. The basic hardware needed is a Raspberry Pi 4 with 4GB RAM or more (8GB is recommended) plus a 16GB uSD card and a 1TB SSD to store the complete Bitcoin blockchain (external USB3 or with a dedicated case to connect it to the Pi). If you add the power supply (the official one is highly recommended) and a good case with cooling element integrated you should end up around 200 CHF in total.

Optionally you might want to add an uninterruptible power supply (UPS) to be sure that your node will not get switch off brutally due to a power outage or a bad manipulation when you unplug some other electronic stuff around your node. This UPS can be quite costly, starting around 75CHF and up to 200CHF or much more depending on how good you want the output current to be and how long you plan to stay without power (depending if you plan to connect other equipment like your modem or router/switch to it).

Using such simple and relatively affordable hardware you can deploy a ready to use Bitcoin node system like Umbrel, the one I’m using or other dedicated environment like Raspiblitz or RaspiBolt. Other solutions are to deploy manually all necessary softwares on a Linux computer if you are comfortable enough doing so or to rent a server to deploy your node without having to buy any hardware (be careful as this solution might be relatively expensive depending on how the host charge for bandwidth, as a Bitcoin node will consume a lot of bandwidth, especially at the beginning to sync the complete blockchain).

Deeper down the rabbit hole

I try my best to keep this first part simple and not too long. But I’ve just scratch the surface. How is it secure if it’s not on the blockchain? How much centralized it is? How much private it is? And more interestingly, what else can I do with Bitcoin LN? spoiler: a lot more!

In the meantime if you are already using Bitcoin LN and want to open a channel to my node, alias ElucNode, use the QR code below. You can also use my donation page to send me some sats on the LN or event directly on the blockchain and have an overview of how you can integrate a self-hosted payment system without any third party involved, no card processor, no bank, just you and me directly with zero fee involved.

If you like this post, want to add or correct something to it, feel free to leave a comment below.
Also be sure to subscribe by RSS and follow @eluc on Mastodon or @ElucTheG33k on Twitter to not miss any future post.

Disclaimer I’m not a financial advisor, nor a professional in any kind of industry link to finance, cryptocurrencies nor tax legislation. I’m just giving my personal opinion and life advise about topics that I like and experiment by myself on my free time. My articles could always have mistakes, inaccuracies or lead to misunderstanding of a more complex topic. I cannot by any mean be liable for any loss or issue you could have by following any strategy or using any app or product that I mention in my articles. Using any kind of investment product, cryptocurrencies, smart-contracts, app or tool always come with a certain risk. Before engaging your data, time and money in any activities, always do you due diligence and get informed by yourself about the implications and risks.

Affiliate links Some links in my articles can be affiliate links, usually I mention it explicitly. This mean that if you use the link to a shop or service and then buy the product or subscribe to the service offered, I will get a small commission on your purchase. For you it doesn’t cost anything more and in some case it’s also linked to a promotion where you can get a small discount as well, I try to write it clearly if it’s the case.
If you use the link and buy something there, I will know that someone did but I will not know anything about this person. If you don’t agree to use the affiliate link please visit the website of the shop or service by yourself, for example using a search engine without using an ads at the top of the results of course. If you agree to use them and make a purchase, thanks for the small support.
When I decide to place an affiliate link for a product or service, it’s not because I will maybe get some money from the affiliation but because I truly believe in the product/service and I’m using it myself. I will recommend the same way a product or service that doesn’t offer affiliation and will never give the advantage or highlight one product/service just because it offers an affiliation or because the commission offered is higher, but I hope it’s reflected well in my article.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.