September 26, 2022

Not a simple guide to setting up and using the full Lightning Network node

The story of the creation of this guide began with a quest announced by BitNews on the decade of the Genesis Day. By competition conditions, the first twenty participants,who installed their personal Lightning node, opened the Lightning channel for receiving BTC and generated a lightning invoice to receive 0.002019 BTC, received 0.002019 BTC as a prize. Among the readers, two people were able to master the task. This poor adoption of technology and the absence of any kind of user friendliness served as an impetus for writing an article designed to popularize the use of Lightning.

Literally 10 years ago - money likeBitcoin was of little interest to anyone, and today everyone can take advantage of almost everyday technology. Every year, developers improve the mechanism of a decentralized financial system, in particular, experimenting with networks such as the Lightning Network. But, without break-in in the “field conditions” - this may remain the interest of a relatively small group of blockchain enthusiasts. Therefore, it is extremely important to familiarize yourself with this innovative method of calculation and take the next step towards the dream of cipher banks.

In my opinion, the abundance of technical terms isthe main problem of many articles on the Lightning Network, whose authors forget that readers may have a slightly different level of training than they themselves. At the same time, I will not give you semi-adequate examples with beads, scores and other rattles.


Blockchain, in particular, Bitcoin blockchain -a difficult thing, and it is impossible to explain all the technical nuances on the fingers in 10 minutes, especially to an unprepared person. Believe me, even sophisticated users sometimes can not answer all the questions regarding the operation of this technology. The Lightning Network is no exception, so only general theoretical aspects will be outlined here, and the main focus will be on practice.

After all, in order to use ordinary money, you do not need to know thoroughly how they are printed, and how the banking system is structured in essence, right? Although this would not be superfluous.

Today, banks are clearly abusing data overprivileges, and force citizens to turn to alternative financial systems. It is worth recognizing that Bitcoin and Lightning Network technologies have not yet become a full-fledged replacement for traditional banking, and probably never will, but, after all, this is just an alternative, the ability, if necessary, to use a more convenient method of transferring value. Moreover, it is possible that over time the situation will change dramatically. Banks will step down as the main currency issuer, and the black flag of the cryptanarchy will fly over the building of the Federal Reserve System. In the meantime, greedy bankers do not allow this by all means - we will prepare, so to speak, the ground for the world revolution.


What is the Lightning Network?

In general, understanding the work of the Lightning Network between dinner and watching the series will not work, so for those who do not have enough superficial explanations, this article is recommended:

Lightning Network: all technical details

She's complicated, honestly. Therefore, for a general understanding, a brief description and minimal practical experience, which I myself acquired by the will of fate and an extremely exciting quest in the winter of 2019 on, will be quite enough. To receive and send transfers to the Lightning Network - more was not required. So, let's start with the main one.

Lightning Network is an add-onover the main Bitcoin blockchain. Purely in theory, the security of this innovation is based on the security of Bitcoin itself. Although, in fact, everything is not so simple. But, most importantly, in the future it is planned to tie such a “stray” to other equally interesting and, of course, necessary blockchains. However, while the main attention is focused on the dearest and closest - Bitcoin.

“The add-in allows for quick, inexpensive and relatively anonymous transfers in bitcoins, almost without affecting the main blockchain”.

Details should be specified here:

  • Fast - yes, in theory, instant. But, due to the nature of the technology, an unexpected delay / failure can occur. For what reasons - I will describe below.
  • Inexpensive - Yes, literally cents and pennies. But, in theory, commissions can be of any arbitrary size.
  • Virtually without affecting the main blockchain - yes, only two transactions are recorded in the registry, the first and the last, without taking into account any number of intermediate transfers in the LN network.
  • Relatively anonymous - LN does not have a public registry, and the nodes do not see all the details of the transactions going through them, which makes payments on this network more private than in the main blockchain.

History of Lightning Network

For the creation of this miracle, first introducedAt the Bitcoin seminar in San Francisco in February 2015, Tadge Dryja and Joseph Poon bear the primary responsibility to society.

At the end of 2015 at Scaling Bitcoin conferencesMontreal and Scaling Bitcoin Hong Kong made a more detailed presentation of the idea, which was approved by the leading developers of Bitcoin Core and became part of its development roadmap.

The Bitcoin Lightning Network Whitepaper

Incidentally, the idea of ​​payment channels was expressed by Satoshi Nakomoto himself. Further, the initiative was supported by such well-known companies as Lightning Labs, Blockstream, BitFury and ACINQ.

History of Lightning Network

How does the Lightning Network work?

In the Lightning Network, users open betweenThese are payment channels that previously were typical bitcoin addresses with multi-signature (P2SH). Similar addresses [multisignature adress] in Bitcoin invariably begin with a three - regular [legacy adress] begin with a unit.

Fact: from a specific time in the client Bitcoin Core by default only generated multisignature adress (P2SH) compatible with technology SegWit, and the Lightning Network itself works with addresses in the native format SegWit (bech32). also in Bitcoin Core can be generated immediately segwit addresses of the form bech32.

Bitcoin Core version 0.19.0 released

Multisignature addresses implemented usingthe simplest scripting language, i.e. This is a vivid example of those same smart contracts in Bitcoin. In the future, this idea became widespread in other blockchains, and in a more complex form. Such addresses allow access to a joint deposit, but no party can dispose of funds without the permission of others. In the case of Lightning Network deposits, there are only two parties.

To whom there is not enough brief information about the work of "multi-signature" addresses - it can refer to these materials on extremely wonderful resources:

Multi-signature. Wikipedia

How multi-signature works in Bitcoin. Habr

Lightning Network and SegWit

As I mentioned - addresses on the Lightning Networkare an implementation of SegWit technology. And this is not just a coincidence. The address in SegWit (in P2SH format) is compatible with standard bitcoin addresses - you can easily receive and send BTC to it. Therefore, SegWit technology uses two types of addresses: P2SH and bech32.

It is the introduction of Segregated Witness that is excellentsupplemented not only Bitcoin, but also the Lightning Network. This solved many problems in the "lightning network": it provided the necessary level of compatibility with Bitcoin, significantly improved security, removed restrictions on the channel lifetime, etc.

What is SegWit?

An example of the interaction of two technologies in the client Lightning Network Daemon (LND)

Therefore, it is not surprising that SegWit and the Lightning Network are strongly associated with each other.

Lightning Network and Atomic Swaps

An important part of the Lightning Network are hash contracts: "Hash time lock contracts (HTLC) or hash time lock contracts." They are not only responsible for the operability and security of the network, but also allow you to set the conditions for fulfillment, for example, the lifetime for a payment channel.

Also, it is these contracts that are used inatomic swap technologies - exchange of coins between different blockchains without the need to trust a third party, i.e. absolutely directly. In the future, this will become possible in the Lightning Network itself, when other blockchains acquire their own “lightning fast”.

But, about atomic swaps and decentralized exchanges based on them - we will talk in other materials.


Naturally, without understanding the principles of workthe blockchain itself - it makes no sense to try to delve into the technical stuffing of the Lightning Network. But, if you still really want to know everything about this incomprehensible "lightning network", and there is a lack of background knowledge, please turn to the basic basis:

How does blockchain work?


So, back to the main thing - we have twousers with a common deposit in bitcoins and a separate balance on Lightning Network wallets. None of them can take their entire deposit without the permission of the other. The balance displays the amount equal to the share contributed to the total deposit. Now users can update balances as many times as necessary, passing each other bitcoins into undivided possession. Thus, in the main blockchain, nothing happens - because, in fact, bitcoins do not move anywhere, they just change the owner.


If it sounds a little incomprehensible, so let's give a specific algorithm of actions, which may differ slightly, depending on the client used:

  • The user downloads and installs any client to work in the Lightning Network;
  • It receives a Bitcoin address with SegWit support, to which it transfers any amount (so far relatively small). The first transaction occurs in the main blockchain;
  • Opens a payment channel (createsmultisigned address) with any other user for any amount. Opening a channel means blocking bitcoins on a multi-subscription address, which allows the parties to get rid of the need to trust each other;
  • Now you can make as many transfers as you want within the enclosed amount. The size of the deposit determines the very "width of the payment channel." Those. You cannot spend more than you placed on deposit.

An important point: you can’t get more width of the open channel either! Yes, so far it works..

By making a "translation" - you only transfer the right to ownyour bitcoins or a small part of them to the second side, when required. In other words, you can “send” any amount, even the smallest. Or get her back. Fast and inexpensive, because the transfer process is just updating the balance on the parties' wallets in the Lightning Network without having to wait for the confirmation of the transaction and pay a commission directly to the miners. In theory, you can send a fraction of a cent with a zero fee for carrying out this transaction.

Thus, the bitcoins themselves do not move anywhere, the history of the balance changes is stored by the full nodes in the Lightning Network, which are in constant synchronization mode.

You can keep the channel open for as long as you like. After all your bitcoins pass into the possession of the second side (the channel is “exhausted” on your side, the money has run out) or the need for transfers disappears - you can close the channel.

Replenish an existing channel from the blockchainBitcoin will not work - you will need to open a new one. And before you bring bitcoins to the main blockchain, you also need to close the channel first. Although solutions are already being developed that can solve this problem.

After closing the channel in the main blockchaina second, final transaction [commitment transaction] is sent, which brings the balance of both sides to the appropriate state based on the results of all intermediate operations. The initiator of the closure of the channel can be either side, without the consent of another.

So, hundreds or thousands of small transactions in the Lightning Network, and only two transactions in the main blockchain, which, of course, are validated by miners.

Do you understand? There are no “debt receipts”, “tokens” and other pseudo-financial excesses in the Lightning Network - there are only real, live bitcoins.


An important and main point - the Lightning Network is a network, and there is no need to open a separate channel with each user. It is enough that between the sender andthe recipient was an intermediate user. This can be an ordinary user or a huge node that has many payment channels open with other users and the same large nodes.

This is the Great Payment Network that will cover the whole world in the future. Don't even doubt it

In the case of transferring funds through intermediate participants in the network, mutual accounting, “rebalancing of balances” occurs.

I will give an example:

I (user 1) want to translate no oneuser (user 3), there is no open channel with him, but there is an invoice. And more is not needed. The network itself will find the optimal path to user 3, for example, through user 2, which, incidentally, does not need to know about the fact of this translation. He sees neither me nor user 3. I need to have at least one open channel and preferably with a large node, the so-called hub, to make a transfer, then calmly go to a bar with friends, drink beer and discuss the latest news from the world of high technology.

In general, opening a channel with a large node is almost equivalent to connecting to the entire network, and this is certainly very cool.

It should also be noted that all traffic betweenthe nodes are encrypted according to the “onion routing principle”, which is laid in the foundations of the Lightning Network itself. This network does not have a public registry, therefore, all transfers between users within this network are completely anonymous. Thus, the difficulties with transaction tracking make LN a kind of “TOR browser for bitcoin payments”.

Is this the ultimate dream of any cryptan? Not at all. There are quite tangible shortcomings, and I simply must identify them.

An important nuance: to transfer from user 1 to user 3 through user 2 - funds from the balance of user 2 are transferred to the balance of user 3, and from user 1 (me) to the balance of user 2. In other words, on the account user 2 should be the amount not less than my transfer to the address user 3. Otherwise, translation through user 2 will be impossible. A route with liquidity is needed, otherwise there will be a payment failure. So far so arranged.

But, there are many others on the net users, therefore, such a failure in the transfer of funds does not occur as often as opponents of this technology would like.

So, until a certain time is not worth itsend too large transfers; liquidity is still relatively low. I emphasize - only RELATIVELY. Moreover, while the Lightning Network is not a full-fledged replacement for Bitcoin or Visa / MasterCard, it is a micro-payment network for those who were critical to “pay for coffee” with bitcoins.

The second aspect: all participants in this chain (I, user 2 and user 3) should be online, t.It is not required that at the time of the transaction, our devices with installed Lightning Network clients work and are connected to the network. If user 2 or / and user 3 are offline, my funds will simply be returned.

These are the problems with the speed of transfers that I mentioned initially. But that's not all, do not rush to exhale.

Watchtowers: Protecting Your Interests

This is where more difficult moments come up in thisTechnology, first of all, is forced to admit, for myself. I already mentioned that the network has some drawbacks in comparison with the classic, reliable Bitcoin blockchain. He's great. Everything else is in its infancy and will survive many more metamorphoses.

Without too much tragedy - not worth it at the momentkeep the amount of money you’re sorry to lose on Lightning Network. This does not mean that you are threatened with a robbery every minute - this is a rare case. But, nevertheless, the system still does not guarantee complete security.

An important point: if your node went offline, then the second side can close the channel, while transmitting the earlier state of the channel, thus returning the money already paid to you back to yourself.

That is why the Lightning Network is stillconsidered not safe enough. But I’m sure that the community of free developers and large technology companies sponsoring the development of technology will surely solve such problems, in particular, such a solution as Watchtowers is already being worked out.

Watchtowers - nodes that monitor the network for fraud attempts and stop arbitrariness by sending all funds to the address of a non-fraudulent node, which is called a “justice transaction”.

Such a peculiar watchdog can becomeany node, so far on a voluntary basis, but, in the future, it is planned to introduce watchtowers operating on a commercial basis, i.e. security will cost a little.

The ability to connect to such nodes is already implemented in the LND beta client.

True, if the amount is large enough, the possibility of a conspiracy of the owners of a fraudulent node and a certain Watchtower is not ruled out.

IMPORTANT recommendations:

  • It is more reliable to work through well-known, trusted nodes, whose reputation causes less distrust than an unfamiliar user who may try to steal your money.
  • You need to go offline less often, which, of course, is difficult to implement in practice and does not guarantee complete security.
  • Until the full implementation of the technology - you should not store more or less significant amounts for you in the Lightning Network.


Therefore, so that annoying moments do not upsetour crypto party - it is necessary to create as many complete nodes as "authority" with decent or "well, very indecent" liquidity (right up to the ugliness high), many channels with other users and a constant stay online, for example, on some a cozy dedicated server in Sweden.

Large nodes not only receive "respect andrespect ”from the brothers on the blockchain, but also regular commissions from transfers. The commission, probably, will not become too high, in view of the fact that its size is set at the discretion of the owner of the node - because the competition is expected to be hot, and the nodes will fight for the attention of users, attracting them with the most favorable conditions.

No problems are foreseen, but, ideally, of course, because the monopoly manners of some individuals from the world of big finance no one abolished. With the condition of all of the above - there is a risk of centralization of the network and the appearance of points of failure.

Although anyone on this network can be raised by anyone, there would be funds to provide. So, it makes sense to accumulate the necessary knowledge and a couple of bitcoins to participate in the future of all mankind.

Besides, I hope you are not looking for simple ways? After all, true crypto-blockchainers and anarcho-capitalists immediately lay a powerful, own foundation for many years to come.

So now that all the cards are on the table, you cantake a deep breath, be patient, have a weekly supply of products and start practicing, starting with simple applications on a smartphone and ending with your own node for all +250 kilograms of the purest blockchain.

How to set up your own Lightning node

I am a sincere supporter of, let's say, “full nodification”, so we won’t use a “wallet from a good uncle”, and we will raise a full-fledged note to all bankers in vain.

There are many options - now there are such clients as LND, Eclair, Zap, etc. Perhaps there are already more advanced options - if you wish, share them in the comments.

I decided to get two in one and useBitcoin Core + Eclair bundle. Yes, there are other options, but the same Lightning Power Node Launcher + ZAP Wallet proved to be not the best way. More precisely, the last Node Launcher client constantly crashed with an error. Although I myself liked the ZAP Wallet. I haven’t contacted the Lightning Network Daemon yet - perhaps in another article we will consider this definitely more than advanced client.

Well, let's get started. I use the Illuminati operating system - therefore I download the Bitcoin Core client for Windows from the official site Bitcoinorg, and I’ll write instructions specifically for this OS.

Interesting fact: initially Bitcoin Core existed only for Windows. Satoshi Nakamoto destroys the established image of a geek-linuxoid.

In theory, for the full operation of the node Ln need static IP address, which you can order from yourInternet Service Provider. Personally, I have not done this yet in view of the fact that, so far, for me this is just an experiment. But, if your dynamic address changes, then the node will become unavailable, because The initial IP address is registered in the settings. And what after this happens with open channels - I do not know.

In general, downloaded, installed just likeFavorite toy: YES-YES-AGREE-INSTALL. If you have never expected from 2-3 days to a couple of weeks of synchronization, then the next step will definitely be remembered for a long time. Perhaps everything will go relatively quickly for you, but, in my case, it turned out to be a rather long and painful wait.

If you want to speed up the process a bit, you can download the main part of the blocks by torrent using the link on the official website and there is already a small balance to synchronize:

Download blockchain

You only need to unpack the received blocks inBitcoin Core working folder - you have it on drive D, right? Any sane person puts +250 gig of the blockchain there. The client can be put on drive C, most importantly, then do not forget to make an encrypted backup to restore the wallet. After unpacking, you need to start the client and wait until it suspiciously double-checks all the blocks personally if they downloaded the blockchain from a third-party source. If you decide to synchronize honestly, in order to avoid so to speak - then wait and you will be happy.

So, a certain number of hours / days / weeks later ... (depends on the speed of your Internet connection, hard drive and patience limit):

If patience was not enough - it means nothing at allwill not. We are going to use PayPal, which, it’s worth noting, is also not going smoothly. And the most motivated receive a worthy reward: the opportunity to continue work on setting up the node.

Do not rush and first make sure - is everythingworking? Check if the client is really synchronized. To do this, open the console and type getblockchaininfo command - the values ​​of block and headers must match:

Now check if the wallet is working (receiving / sending funds, etc.) - if everything is ok, encrypt the wallet and backup it.

Generating an address in Bitcoin Core is very simple.

Go to the “Get” tab:

Fill or do not fill in the fields and click on the button “Request payment”:

We get the address, use it if necessary.

And, most importantly, open the necessary ports in the router - you need a “listening” node and nothing else. Those. it should be able to access other nodes.

To do this, open ports 8333 and 9735 - go to the settings of the router and write them there. It looked like this for me - you might have a slightly different one, depending on the router model:


Now you can proceed to the next configuration phase.

Install Eclair

Download the latest version - the exe format is no longer provided, so it will take a few dances with a tambourine.



“Starting with this version, Eclair does not provide an installer for Windows. Instead, users must manually start jar file. " Well, at least without the need for compilation from raw sources ....

If you do not know what to do, follow the instructions below:

  • Download and install Java from OpenJDK
  • Download eclair-node-gui-0.3.2.jar and place it, for example, on drive D
  • Create a bat-file - “run-eclair-0.3” somewhere on your disk with the following contents:

start / B javaw -Declair.datadir = C: pathtonodedatadir -jar C: pathtoeclair-node-gui-0.3-2a89cf7.jar


How to create a bat file?


Something like this…


Made? Now we make the first launch and get a communication error with Bitcoin Core. This is normal. Close the error message and continue dancing.


It is necessary to edit or create, in case of absence, configuration files bitcoin.conf and eclair.conf.

The bitcoin.conf file is located in the blockchain folder, usually in:

D: //Bitcoin/bitcoin.conf.

Eclair.conf file:

D: //Eclair/.eclair/Datadir/eclair.conf.

Like bat nicknames, configuration files are created in a regular notepad, after which the saved .conf file must be assigned the extension .conf.

Settings for bitcoin.conf and eclair.conf files:


You need to replace the username and password with your own. If everything is done correctly, we launch Bitcoin Core and Eclair. Now everything works:


It remains to show how to use this miracle,how to start and withdraw bitcoins, where to play with transfers and exchange for another crypto. Believe it, gentlemen, believe it. We applaud while standing, but do not succumb to emotions - you still need endurance. Me too.

How to open the Lightning Network channel

First you need to open a payment channel with one of the largest nodes. For this, for example, go to the site

There are many popular sites to choose from:

You can also select the popular node on

You can use the node from the company ACINQ,LightningPowerUsers or Bitrefill. Although the ACINQ node, from the creators of such a wonderful Eclair client and viewer, generated an error when trying to connect, but the latter stated the following:

peer sent error: ascii = ’chan size of 0.001 BTC is below min chan size of 0.16 BTC ’bin = 6368616e2073697a65206f6620302e303031204254432069732062656c6f77206d696e206368616e2073697a65206f6620302e313620425443

As I understand it - the minimum amount for opening a channel is ~ $ 1200 (11/22/2019). Alas, I forgot the wallet at home and decided to try my luck with other nodes.

There are many of them, and you can even risk opening a channel with an ordinary, far from popular node - they are displayed directly in the Eclair client:

But, there is a high probability that a node will havetoo few channels with other nodes are open, and the path to the receiver will be completely illiquid. This is the problem with translations that I mentioned at the very beginning.

Therefore, in order to ensure that interaction with the Lightning Network does not cause disappointment, we find a fairly popular and liquid node.

To do this, copy it Node Id IP and port, which together forms an address, and open the Channels> Open chanel tab in the Eclair client:

In the Target Node URI field, paste the copied address:

For example, this (chose the first one):

02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76[email protected]: 9735

Where 02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76b Is Node Id, - IP, and 9735 - port.

The minimum amount for opening a channel, as a rule: 100,000 satosh (sort of like):

Commission [fee rate] - set at your own discretion. I leave it as it is. Now press the Connect button:

Channel opened with status WAIT_FOR_FUNDING_CONFIRMED and Satoshi with Bitcoin Core were written off to the address of the format bech32 (SegWit):

You can monitor addresses in SegWit in the blockstream explorer from Blockstream:

Now you need to wait for confirmation of the opening of the channel and as soon as the status is updated to Normal, you can continue to work:

As you can see - more than 4000 nodes

Important! Until the channel is finally open - the client Eclair, and, accordingly, Bitcoin Core should stay online. Turning them off (intentionally or unintentionally) may result in the loss of funds sent to open the channel. This happened personally in my first experiments with a client Eclair. Funds remained at the address format bech32, without access to them.

So, the channel is open, it looks absolutely working and now it remains to use the lightning-fast Satoshi for its intended purpose.

How to receive and send a transfer to the Lightning Network?

To receive a transfer, go to the “Receive payment” tab:

Then click on the “Generate” button and copy the received invoice:

A one-time invoice is allowed to receive fundsfrom another user on the network, if known to him. Yes, until the Lightning Network has implemented a static address system. Although the invoice lifetime is not limited. The minimum and maximum values ​​for sending / receiving funds from different wallets are different, while, theoretically, the system does not impose any restrictions.

To send funds, open the “Send Payment” tab:

Insert the invoice received from another network member and click on the “Send” button:

After which it remains only to confirm the transfer:

Sharing options

The Éclair client is like an add-on on Bitcoin Core (it doesn’t work without it), so when you open a channel, bitcoins are automatically deducted from your wallet balance and, most importantly, when closing the channel, they go back there. Therefore, problems with the withdrawal of bitcoins from the LN network, in any case, are not observed in this client.

But, if you immediately want to exchange bitcoins for fiat or other cryptocurrency, without withdrawing them from LN, then you have at your disposal exchangers and P2P exchanges working with this network.


Hodl Hodl is a P2P cryptocurrency exchange thatIt makes it possible to trade users directly among themselves, and, at the same time, does not store their funds, which allows not to disclose their data to the exchange. When working with Hodl Hodl - funds are blocked in escrow, which minimizes the risk of theft and reduces trading time.

There are two modes on the exchange - On-chain and Lightning. In order to trade on the Lightning network, you must switch the exchange mode by clicking on the lightning in the header of the site.

The Lightning trading mode screen opens.

Baltic Honeybadger and HodlHodl: Interview with Max Caidun


Apps for Lightning Network on Android

If all this procedure seems to you a technological excess - your right. Use less safe and altruistic options, because there are a lot of them.

List of mobile wallets:

It is worth paying attention to:


Do you want to install anything at all? Want to own your money - while you are allowed to do this? Well, here there is a plus - convenience, especially if the amount is small and is not stored for long.

Online Wallets:


Various interesting things and delicious buns related to the Lightning Network can be found on special monitoring sites dedicated to this technology.

Informational resources:

Resource and Information Guide


Everything described above is not yet final.a solution that can solve all the problems of Bitcoin and truly decentralize the financial system. But today is already something tangible that you can use. It is hoped that in the near future, Lightning will become as popular as Bitcoin itself.

Posted by: Ne-Standart