Lightning Network

 

A complete guide to understanding, getting started and going deeper

 The Lightning Network (LN) is a Bitcoin overlay that enables millions of off-chain microtransactions. The principle is to lock bitcoins into a system of liquidity channels between users. So there are Lightning nodes with specific Lightning wallets to interact with this new routing network. Once implemented in the LN, transactions cost a few satoshis and are instantaneous. So there are trades off between using Bitcoin and the LN depending on your needs.

– LN 202 – Training on LN node set up and use 

– LN 201 – Training on the theoretical understanding of LN

Using LN can be as simple as creating a Blue Wallet LN or Wallet of Satoshi in 2 minutes or as complex as running a professional routing node with several million satoshis.

Good luck

PS : If you are comfortable in English, this guide is easier. This one is the most complete or this thread.

Introduction

This page is intended to give you a little more clarity about the Lightning Network, Bitcoin’s layer 2. We’ll look at simple explanations of this technology, how it technically works, concrete applications and its limitations. You will find external resources to learn more about the subject but also to get your hands on it yourself. Hope you like it, the inspiration for this page comes from Fanis and Bitcoin Q&A.

Contents :

Explanation of the Lightning Network

For a basic, simple and easy explanation, I recommend Yorick de Mombynes’ article or his video at Surfin’Bitcoin 2021.For a more in-depth understanding of the network and how it works, Fanis Michalakis’ training is ideal :

  • #1 – Understanding the Lightning Network
  • #2 – Bitcoin, addresses, UTXO and transactions
  • #3 – Opening a channel
  • #4 – Lightning Transaction & Commitment Transaction
  • #5 – Transactions – part two
  • #6 – Closing a channel
  • #7 – Lightning the network
  • #8 – HTLC
  • #9 – Finding your way
  • #10 – Invoice, LNURL, Keysend
  • #11 – Managing your liquidity
  • #12 – Conclusion (and thank you!)

To go further, besides this page the BitcoinQ&A guide is perfect. Otherwise the book Mastering Lighting Network (available for free in e-book) or all the resources at the end of this page.

 

 

Lightning Network wallets

How to choose your wallet ?
It will depend on your usage and what you are looking to do. If you want to use LNURL, you must have specific wallets, to manage your own channels it is also different. It’s getting simpler and simpler but be careful anyway (here’s a summary of the different wallets and this guide is cool)

Custodial :

  • Blue Wallet (very simple)
  • Wallet of Satoshi (extremely simple but full custodial via AWS)

No-custodial / semi-custodial :

  • Phoenix (very good
  • Muun

 

FAQ : Can you lose your bitcoins on LN ?

Yes, it’s still a hot wallet and sometimes in non-custodial. Moreover, even in custodial, you can also lose your money if you don’t know what you are doing. In short, be careful.

Lightning Network node

In this section, we’ll explore how to run an LN node. The easiest way to do this is through an Umbrel node.

Here’s the tutorial page to create your own, it costs about 200€ and is accessible even for beginners.

Once the node is 100% synchronized, we can start creating our first channels. For this, you need bitcoins on the main Umbrel wallet. The idea is to create an on-chain transaction to lock funds with your other peer in liquidation channels. When creating channels, there is a significant fee on Bitcoin (you need to understand this before you start and therefore analyze the MemPool to know when to implement on LN).

Links to open channels

Opening channels is unique to each person, so you will choose your own peers based on your needs, your liquidity and the purpose of your node! Below are some tools and nodes to make your life easier:

 

My Amboss : https://amboss.space/node/02f1dd194c270b5ffeb9f3418ab5bd37e20e85107d97d0285ccdfebf5ee62c397b

My 1ML : https://1ml.com/node/02f1dd194c270b5ffeb9f3418ab5bd37e20e85107d97d0285ccdfebf5ee62c397b

My node : 02f1dd194c270b5ffeb9f3418ab5bd37e20e85107d97d0285ccdfebf5ee62c397b@nnqvu5yssejj2sthtnzwjxffv32pqsz3elynhrypzrp5f5gmofpijzad.onion:9735

 

 

Who to connect with?

You can open as many channels as you want, but ideally you should avoid channels that are too small and will end up with a lot of management fees. It is possible to set a minimum limit when opening channels (e.g. 500,000). It is better to have a few good channels than hundreds of ridiculous ones.

There is a difference between connecting with your buddies to do something closed and connecting publicly to the whole network. Again, it’s going to depend on your profile and the purpose of that LN node :

  • Routing node (for business purposes, requires cash, time)
  • User node (only sending, little receiving)
  • Walking node (lots of receiving, not much sending)

To get feedback on a routing node, here is an excellent article by Fanis and Guillaume

Subscribe to the newsletter to be kept informed, I will discuss one of them in more detail

Feel free to DM me your node on Twitter to add it here ! This page is collaborative.

 

Channel management

 

Rebalance :

When you open a channel, liquidity is 100% on your side. So you can send money, but not receive it. If this is still not clear, really do the Lightning Network training from Fanis.

In order to be able to receive funds, you need incoming liquidity to you! Here are some solutions to get this:

A third person also opens a channel with me, so I can receive the amount that this person allows.

 The same peer I am connected with in turn connects with me. So now we have liquidity on both sides of the Chanel. (to be checked!)

Use a solution called LOOP which finally allows to rebalance the liquidity between a third party and me. I give the on-chain bitcoins to this person and ask him to open a channel with me.

Rebalancing is the sinews of war it seems, I will work on it more. If you want to discuss this or contribute your expertise, again, the YouTube channel and this site are open to all.

The Lightning Network implementations

To understand the different implementations, the easiest way is this round-up from Surfin’Bitcoin 2021.

There are several implementations to avoid too much centralization of the protocol. Thus there is more manageability, flexibility and not as much rigor. Lightning Network is not a consensus system so there can be no more divergence in opinions. So there are local and not systematic bugs. It is therefore possible to move forward faster and innovate more easily.

The big difference between Lightning Network and Bitcoin is that a finished LN transaction is not stored in the common history of the nodes/blockchain.

Each implementation has different functions, strengths and weaknesses. So they each add value in turn:

    • C-lighting : Modular, written in C, focus on the basic protocol, send HTLC, Chanel management. Most upgrades come via plug-ins so it can go very far.
    • Lightning: Focus on server implementation to run large nodes, distribute to multiple machines with thousands of channels, large routing node with many users.
    • Wallet creation: Phoenix and éclair. Mobile user focus.
    • LND: Focus on community, support, Lightnign labs created this with a business model of selling picks and shovels so lots of services. Ideal to build above. Very marketing (creation of Elizabete Stark and a very large team (26 very good developers). Lots of feedback and framework. 
    • Peter Migan: (abandoned)
    • Rusk lightning & lightning Kit: created by Square, the idea is a library written in Rusk to fit everywhere (not yet released on 11-10-2021)

I won’t go into more detail on this subject, it’s very complex and you already have enough work to do. The network uses one implementation as well as the other, so it’s a kind of voluntary symbiosis between competitors to make sure everyone works together.

FAQ: Should I be interested in this as a lambda/non-technical user? Frankly, not really. It’s the developers’ job to hide that from you.

 Lightning Resources

This page is still a work in progress as it is an extremely complex topic with a lot to say.

If you’ve noticed that there’s some info or useful stuff missing, feel free to send me a DM (@decouvrebitcoin on Twitter). I already have an idea of what I’ll be adding as I go along so it’ll come quickly.

If you made it this far, GG.
Love, Rogzy