Bitcoin for every day: testing for ourselves how the Lightning Network works
Bitcoin for every day: testing for ourselves how the Lightning Network works
What is the Lightning Network and why is it needed?
As we have already noted, Satoshi Nakamoto described his own project as a peer-to-peer electronic cash system. This means that when the BTC network was created, the main emphasis was on the ability to transfer value without the participation of an intermediary, which Bitcoin really does. At the same time, due attention was not paid to scaling the blockchain and its throughput.
Логично ли это? Пожалуй, да. Всё же BTC стал первой криптовалютой в мире, поэтому дальнейшие перспективы первопроходца в данной сфере были неочевидны. Ну а из-за относительно небольшого числа пользователей сети в первые годы даже семи транзакций в секунду — или 4200 переводов каждые десять минут — было более чем достаточно для удовлетворения их потребностей.
However, over time and with the influx of new cryptocurrency owners, the situation changed. If you study the graph of the average commission in the Bitcoin network, the first large-scale jump in transaction fees due to a large queue for their execution took place during the year before last bullrun in 2017 - then the figure reached a peak value of $55. Naturally, only a few investors could pay such transfer fees.
The next record was set in April 2021, when the average commission reached the current record of $62.
Впрочем, локальные взлёты комиссий случаются даже во время медвежьих трендов, то есть на этапе спада рынка. Здесь вспоминает прыжок показателя до отметки в 31 доллар в начале мая 2023 года.
Он произошёл из-за хайпа вокруг NFT на основе протокола Ordinals и так называемых BRC20-токенов, которые повторяют концепцию ERC20-токенов в сети Эфириума. В итоге блокчейн оказался перегружен, очередь неподтверждённых транзакций исчислялась сотнями тысяч, а не самые обеспеченные держатели биткоинов банально не могли взаимодействовать с блокчейном. Всё даже дошло до того, что некоторые разработчики BTC предложили блокировать транзакции, связанные с NFT и BRC-20.
These situations lead to the popularization of the Lightning Network, a second-layer network that operates as an add-on on top of the main Bitcoin blockchain. To interact with Lightning, users send BTC to it, then make cheap and fast commissions using special channels, and then close them and enter the final result of the balance change into the main BTC network or the so-called mainnet.
Получается, что транзакции внутри Lightning Network не стоят практически ничего, вдобавок на их проведение нужно куда меньше времени. И хотя комиссии за взаимодействие между основной сетью Биткоина и LN могут достигать неприятных значений, работа в сети второго уровня всё равно удобна для многих пользователей — и особенно в периоды перегрузки основного блокчейна.
The idea for the Lightning Network was published in early 2016, although the corresponding draft appeared in February 2015. The authors of the document are researchers Joseph Poon and Thaddeus Draya.
The network itself was launched at the beginning of 2018. More than five years have passed since then, but the Lightning Network is just beginning to gain popularity. Today it is actively used in El Salvador, Brazil and African countries.
For example, as of the end of August 2023, 4,760 bitcoins were blocked in it, the equivalent of $123 million. This is the amount used by all LN users.
При этом в обороте сегодня находится 19.469 миллиона BTC на 504 миллиарда долларов. Получается, что Lightning Network задействует лишь 0.00024 процента от общего предложения криптовалюты. Конечно, говорить о полноценном распространении LN с учётом этого не приходится.
However, the development of the Lightning network is progressing one way or another. The main news of the year for the network was its integration on the Binance exchange on July 17. Now the Lightning Network is the most accessible option for withdrawing bitcoins for users of the platform, which is approximately half the price of its closest “competitors” in the form of BNB Smart Chain and BNB Beacon Chain.
The developers of the largest US cryptocurrency exchange, Coinbase, are also implementing Lightning. As platform manager Brian Armstrong clarified in early August, representatives of the trading platform are looking for the most effective options for implementing Lightning. At the same time, he himself supports the popularization of payments through the Bitcoin network.
In other words, the Lightning Network will likely become more popular among BTC holders in the future. But how does this second layer network function?
How the Lightning Network works
The operation of the Lightning Network is based on the concept of payment channels, which was once supported by the creator of Bitcoin under the pseudonym Satoshi Nakamoto. That is, the protocol allows you to create direct peer-to-peer channels between two parties and then use them to conduct an unlimited number of fast and practically free transactions.
Соответственно, Lightning Network подходит для проведения регулярных платежей по типу оплаты кофе, продуктов и услуг барбера, которые к тому же проходят мгновенно. И ведь действительно: зачем каждый день тратить на покупку эспрессо несколько десятков центов в качестве комиссии за проведение транзакций в основной сети BTC, если для этого существует более подходящее решение?
Вместо этого проще создать канал между вами и нужным заведением, после чего регулярно проводить отправку монет за ничтожную комиссию.
We draw an intermediate conclusion: the Lighting Network is a system of channels that allows ordinary users or companies to quickly move crypto assets to each other without the need for the “services” of the main blockchain to confirm transactions .
To create a payment channel, you need to block a certain amount of BTC on the network. To receive payment, the user can then create an invoice, which is a long string of letters and numbers and is often provided as a QR code. The sender of the funds scans the code using the corresponding LN wallet and confirms the sending of coins using his digital signature. When the user wants to end this interaction, he closes the channel and withdraws BTC to the Bitcoin main network.
Важно отметить, что в главной сети BTC навсегда фиксируется только окончательное изменение баланса пользователя. Десятки, сотни или даже тысячи переводов в рамках каналов Lightning Network остаются именно там.
This implies another important advantage of the Lightning network, with the exception of the high speed of transfers and low commissions: we are talking about economic benefits when making small payments . Still, paying a nominal 50 cents for a transfer every day for a commission when the cost of a cup of coffee is $1.5 is not very logical.
In addition, if necessary, you can send tiny amounts of BTC to the exchange. Here is our example of such a deposit on Binance.
What is an invoice on the Lightning Network?
As we have already noted, invoices in Lightning are requests to receive payment within this network. They are represented by a unique sequence of letters and numbers that contain all the necessary information.
Lightning invoices contain the following data:
- Amount to pay
- Request validity period
- Invoice ID with the time of its creation marked
- Invoice descriptions
- Backup Bitcoin Address
- Payment route
It all might look like this.
In this regard, invoices are most often shown in the form of a QR code, which simplifies data entry and use.
How to Connect to the Lightning Network
The Lightning Network is a network of nodes that enable value forwarding. Nodes are launched by ordinary people or companies - for this they run a special program on PCs, laptops or computers from the Raspberry Pi family. In this way, the decentralization of the network is supported, because the more nodes, the less vulnerable the blockchain is .
There are two ways to connect to the Lightning network:
- by launching your own node;
- through the use of special wallets that already use configured nodes.
Your own node is a more complex option. Ideally, you need special equipment like a Raspberry Pi 4 with a case, a fan and a memory card, an SSD with at least 1 TB of free memory, an Ethernet cable and a power supply. Interaction with Raspberry also requires an understanding of the command interface, which not every cryptocurrency lover knows.
Эксперты отмечают, что запустить ПО для собственной ноды можно и на личном ПК. Однако в таком случае устройство будет более уязвимым перед атаками.
Then you need to install RaspiBlitz for Raspberry Pi or Umbrel for PC, then connect to the network, set fees and create a channel by placing a deposit there. A detailed guide for advanced developer users is available here.
Most users predictably choose wallets with already configured Lightning nodes, which we will get to know further. While this way they won't be able to take a tiny percentage of other users' transaction fees as a fee for their services, it's a much simpler and more convenient option.
Wallets with configured nodes are more convenient for users, since the essence of the LN network does not involve storing large amounts. Here, a couple of tens or hundreds of dollars will be enough for daily spending. However, it is important to understand that another person is responsible for their storage when working with such nodes.
Types of Lightning wallets. Pros, cons and features
By analogy with other blockchains, wallets for working with the Lightning Network are divided into two types - custodial and non-custodial . The terms are derived from the word “custodian,” which means “custodian.” Typically in the world of finance, the role of custodian or intermediary is performed by a bank.
In the first case, greater responsibility lies with the wallet developer company, while in the second, the user controls what happens.
Features of custodial Lightning wallets
With custodial wallets, your BTC is held by a so-called custodian or intermediary. This means that the user must trust the given entity not to run away with his coins and to diligently perform his duties. In turn, the wallet operator will be responsible for the relevance of the software, the operation of the hardware, as well as the safety of the coins of people who use the program from this developer.
When you send BTC on the Lightning Network using this wallet category, the custodian will forward the value on your behalf to the other user's address and show the corresponding balance.
Забавно, что подтвердить свой баланс на кастодиальном кошельке LN невозможно, ведь его "рисует" и распределяет оператор кошелька. Убедиться в правильности данных можно разве что путём отправки биткоинов на некастодиальный кошелёк, который использует другую ноду.
In exchange for the trust of users, the operator of the custodial wallet takes on all technical difficulties, ensuring the operation of the node and managing channels instead of users. The last thing left to do is to enjoy the simple interface for transferring and receiving value.
Features of non-custodial Lightning wallets
Non-custodial wallets on the Lightning network are those that use their own node. Thanks to this, users have complete control over the bitcoins in their wallets and do not rely on intermediaries. To do this, they use a ready-made mobile application, but at the same time manually connect to the desired node.
Running your own node means a lot of responsibilities. In particular, the user will have to open and close channels, as well as determine their capacity. In addition, the user of such products needs to choose how many bitcoins are required to open the channel, and how many to maintain the functionality of the latter.
That is, non-custodial wallets require knowledge and skills. Therefore, it is easier to start your journey to the Lightning network with custodial wallets, since this will allow you to familiarize yourself with the details of what is happening. As already noted, today we use non-custodial wallets.
Similarities in the work of Lightning wallets
Whatever wallet you choose, due to the nature of the Lightning network, it will be able to conduct transactions through common channels.
Let's imagine that your friend also uses the Lightning Network and maintains an open channel with a fast food restaurant, while there is also a channel between you. In this case, to buy a burger and fries, you will not have to open a separate channel with the establishment and replenish it. Here, the completed payment will be sent through the channel between you and your friend, and then transferred to the establishment through its channel with your friend. Based on the results of the value transfer, the balances of wallets from the two channels used will be updated.
Также при использовании двумя пользователями одного и того же приложения в некоторых случаях для отправки между ними сатоши или сатсов — то есть минимальной частицы Биткоина в 0.00000001 BTC — не потребуется специальный канал. При таком сценарии кошелёк попросту изменит балансы пользователей соответствующим образом с помощью собственной системы учёта, как это делают биржи.
К тому же такая схема может позволить активировать канал без его пополнения.
Advantages and disadvantages of Lightning wallets
Lightning Network wallets allow you to conduct fast and accessible transactions on the basis of the most secure and decentralized blockchain in the world - and this is a definite plus. Their custodial representatives have a simple interface that even beginners can handle. In addition, such programs are free, which means they do not involve additional costs.
At the same time, such wallets require replenishment of a certain amount to open a channel. It also follows that bitcoins blocked in channels cannot be used for other tasks until the channel is closed. It turns out that if you pay for drinks in a coffee shop every day through an open channel, the owner of the establishment cannot get to the coins until you close the channel.
It is worth mentioning here the disadvantage of the Lightning network itself. It needs a constant Internet connection , since running payment channels between two nodes must be ready to make a transfer at any second. Hence the need for online payment, which is not as convenient compared to regular payment cards, which you can use even on an airplane.
In this regard, at least now it is impossible to use the familiar hardware wallets for such transactions. Of course, you're unlikely to need to send thousands of dollars worth of BTC on the Lightning Network, but security is never a bad idea. And while wallets are connected to the Internet, they cannot be considered sufficiently secure.
Which Lightning wallet to choose for iPhone and Android
For simplicity, we will consider custodial wallets - Wallet of Satoshi, Phoenix Wallet and Muun . They are less secure compared to non-custodial ones and also require trust in the intermediary. However, for small transfers and getting to know the network as a whole, this will be enough.
Wallet of Satoshi
- Wallet name - Wallet of Satoshi
- Type - non-custodial
- Supported platforms - Android, iOS
- Features - biometric unlocking, automatic payment for small amounts, scanning NFC tags, sending maximum amount
- Project website — https://walletofsatoshi.com/
As noted earlier, the Lightning Network now supports the Binance crypto exchange, so we use it to send Satoshi to the wallet.
When you enter the corresponding withdrawal menu, the platform will show that it does not support invoices created in Muun and Breez wallets.
That's right, an invoice is required to withdraw bitcoins via Lightning Network from Binance. Creating it is simple: just go to the receiving menu and indicate the amount to receive . In the case of Wallet of Satoshi, we want to receive the equivalent of 15 dollars, which at the time of the transaction is equivalent to 57,560 satoshi.
Важно отметить, что Wallet of Satoshi позволяет указать сумму как в сатсах, так и в долларах. Это очень удобно, поскольку чаще всего перевести нужно какой-то долларовый эквивалент, а не фиксированный объём BTC.
The withdrawal is carried out from the desktop, so the QR code is not particularly suitable. To carry out the transaction, copy the invoice using the corresponding button. It's long and looks like this.
The transaction confirmation window for LN is too cumbersome - here it is.
Естественно, сверять подобную комбинацию ещё сложнее, чем проверять адрес получателя в Биткоине, Эфириуме, Солане и прочих популярных сетях.
Be that as it may, the transaction is confirmed within a minute. At the same time, the wallet shows a nice animation about receiving the transfer. The latter is displayed in the statement and looks like this.
Phoenix Wallet
- Wallet name - Phoenix Wallet
- Type - non-custodial
- Supported platforms - Android, iOS
- Features - Automatic channel creation
- Project website — https://phoenix.acinq.co/
Now let's move on to another wallet called Phoenix.
We select the receive payment button and see that the first incoming transaction must be at least 10 thousand satoshi. Obviously this is a requirement for creating a channel.
We create an invoice, copy it and return to the Wallet of Satoshi interface, where our sats are located. Here is the menu for conducting a transaction in this wallet.
Please note that in the upper right corner of the application there is a button to send the maximum amount. In other words, Wallet of Satoshi independently determines the commission and offers the amount of sats that can be transferred.
Забегая наперёд отметим, что эта важная функция — редкость, а разработчики Wallet of Satoshi заслуживают за неё отдельной похвалы.
The transaction goes away, which is confirmed by a bright animation.
Phoenix receives the transfer. Moreover, at this moment an unpleasant surprise awaits us: the wallet wrote off 3 thousand sats, or about 70 cents, which was needed to open a channel between the two wallets. If a repeated transaction was made from the same wallet, this amount would no longer be debited.
It turns out that making one-time transfers in Lightning is not as cheap as it seems. But we forget about these expenses and move on to the last wallet.
Muun wallet
- Wallet name - Muun
- Type - non-custodial
- Supported platforms - Android, iOS
- Features – Wallet protection via email
- Project website — https://muun.com/
The next wallet is Muun, which is also in demand among Lightning fans.
Now we create an invoice in Muun to send sats from Phoenix to this wallet. After entering the invoice, we are taken to the payment creation screen.
Please note: this menu does not show your wallet balance or fees, nor does it have a button to send a maximum amount. What does it mean? First, we need to go back to the general menu and remember our balance that needs to be transferred. Secondly, the user will have to independently guess the available amount for transfer.
Это самый неприятный момент во взаимодействии с подобными Lightning-кошельками. Как мы уже отметили, Phoenix не показывает взимаемые комиссии до непосредственного создания транзакции на следующем экране. А поскольку она может состоять в том числе из платы за создание канала, пользователю приходится брать совершенно случайные суммы из головы и надеяться, что транзакция сможет провестись. Ну а если вам надо опустошить кошелёк, здесь точно не обойтись без калькулятора.
Specifying the entire balance amount will result in an error. This means you will have to re-insert or scan the invoice and select the amount.
As a result, out of 54,387 sats, we sent 54 thousand satoshi, and 105 sats remained in the wallet. That is, in this case, they didn’t charge us several thousand for creating the channel.
While we were selecting the amounts to send, we managed to see the current commission for sending Satoshi to the Bitcoin network, that is, not Lightning, but the mainnet. It was the equivalent of 68 cents, which was the same as the fee for sending BTC on the main cryptocurrency network.
То есть если сеть Биткоина будет перегруженной, высокие комиссии также коснутся пользователей LN, которые хотят отправить свои сатсы в мейннет. А низкая стоимость переводов касается только переводов внутри Lightning.
Впрочем, теперь Lightning Network поддерживает та же Binance, а значит для передачи ценности при слишком высоких комиссиях в Биткоине можно будет использовать другие способы. Например, отправить BTC через LN на биржу, конвертировать их в USDT и отправить по более доступным и высокопроизводительным сетям по типу Tron, Solana, BNB Chain и прочим.
In any case, 54 thousand sats end up in Muun.
Now, to end the Lightning adventure, we will send the received amount to Binance.
It is quite logical that for this you need to create an invoice - but already on the exchange. Alas, here it is also necessary to indicate the sending amount.
What does it mean? It is correct that Muun and Phoenix wallets, which do not support the function of sending the entire amount, will not tell you the maximum volume of sats available for sending. This means you will also have to create several invoices on Binance. Until they are suitable, taking into account the commission charged by the network, the interfaces will generate an error.
Это актуально только для ситуаций, когда вам нужно обнулить кошелёк. Для простых переводов подобные проблемы отсутствуют.
As a result, the translation goes through. We are sending 52 thousand satoshis, which is approximately 10 percent less than the original amount of 57,560 satoshis that came from Binance to the Wallet of Satoshi. Yes, there are several hundred sats left on Muun and Phoenix, but we are sacrificing them to the developers of these wallets, who did not want to implement the functions of sending the entire amount, following the example of Wallet of Satoshi.
It turns out that the equivalent of $1.5 was spent on creating channels and making several transfers. This also includes a small amount that you are too lazy to withdraw from your last two wallets. Still, to do this you will have to play the guessing game again with commissions, and this activity quickly gets tiring.
Conclusions. Is it worth using the Lightning Network?
The conclusions after interacting with the Lightning Network are not the most pleasant. There are three of them in total .
1. The Lightning Network is unlikely to appeal to newcomers to the world of cryptocurrencies. The interfaces of wallet applications most often seem unfinished, since some of them do not have convenient functions such as sending the entire amount, showing estimated commissions before creating a transfer, or indicating the amount in dollars instead of sats. The above leads to discomfort, because of which you don’t want to interact with LN wallets in the future.
The familiar Phantom wallet is much faster, more intuitive and more functional. In addition, it now supports not only the Solana network, but also Ethereum along with Polygon. This means it is suitable for a much larger number of users.
2. Lightning Network is not suitable for one-time payments. As already noted, we spent more than a dollar on several transfers, the vast majority of which went to creating the channel. This is expensive, because in the same Solana, one transaction costs a base commission of 0.000005 SOL or 0.01 cents - not a dollar - at today's rate.
There are no issues with recurring payments. However, to do this, you will most likely have to top up your wallet from the exchange and send sats to the other party - and this also requires certain actions.
3. The Lightning network is still having a hard time achieving mass popularization. Supporting the operation of a node brings in insignificant income from commissions from other users; in addition, their operators need to spend their money on hardware and other expenses. Accordingly, the motivation for such activity can only be explained by a love of technology and decentralization.
At the same time, the outright dampness of popular wallets and laziness can become an obstacle for ordinary users. As we have already noted, Lightning will certainly come in handy for people who make several transfers per day to the same entity. And if we are talking about transferring an amount once a week or month, as is usually the case, then it is easier to withdraw conditional USDT through Tron.
However, the network has become popular in developing countries like Nigeria, Kenya, Brazil, Philippines, Ghana and so on . The less developed the banking sector is in a certain country and the more expensive such services are, the greater the potential of the Lightning Network.
For clarity, we present a graph of the total number of LN transactions carried out through the already familiar Wallet of Satoshi wallet.
Moreover, the number of monthly transfers is gradually increasing. This means that the Lightning Network’s user base is also growing.
Comments
Post a Comment