The time and fees for every payment we made may vary a lot, depending on several factors. The distance, the amount, the requirements, the companies involved; all of it can delay payments and/or make them more expensive. We assume this doesn’t happen usually with cryptocurrencies, and that’s right —most of the time. But Bitcoin (BTC), for example, can be kind of slow and expensive too, sometimes. That’s why the Lightning Network (LN).

Lightning Network is a decentralized system specifically designed to make private micropayments out of the main Bitcoin (and Litecoin) blockchain(s). That goal is reached through secure and shared channels started by the parties involved. The channels only need to touch the blockchain once opened and closed: in the middle, the parties can exchange funds freely, without waiting times and almost without fees.

Lightning-Network-what-is

So, for example, Alice and Bob can agree to open an LN channel anytime with a certain amount of funds to exchange between them (or their friends with LN nodes). They can set an “expiration date”, and make commitment transactions while the channel is open —it can be an hour, a day, a month, a year, etc. When they agree to do so, they’ll close the channel (and register it on the blockchain, making it irrevocable) with the final balances for each party.

Why is it necessary the Lightning Network?

Currently, the average Bitcoin transaction fee is $1.6, no matter the amount transacted. However, it’s not always like that: it may vary according to the state of the chain. In April 21, 2021, for example, the fee was up to $62.7 per transaction [BitInfoCharts]. That’s something crazy if you want to pay for a three-dollar coffee with BTC or donate a small tip to your favorite online creator.

Lightning-Network-bitcoin-fees
Network fees: traditional transaction vs. Lightning

The waiting time for every transaction is also an issue, sometimes. To send coins across different wallets, it’s necessary to wait between 30 minutes to 60 minutes per transaction. That’s the time it takes for several miners to create and validate a new block on the blockchain —the system that supports cryptocurrencies.

To consider a BTC transaction fully valid and irreversible, we need to wait for, at least, three confirmations by miners. This happens in the time we mentioned above. Litecoin (LTC) is a little bit quicker, but it also needs some time. And also takes some fees.

That’s why Joseph Poon and Thaddeus Dryja navržený the Lightning Network in 2016. By using this system, the parties can avoid high fees and waiting times; and just transact instantly between them in private.

How does the Lightning Network work?

We’ll try to not make it complicated, because, in the practice, it’s not. But, behind the curtains of a nice app on your phone, the instant payment can be completed thanks to a couple of things: a multi-signature address and a Hash Timelock Contract (HTLC). To put it clearly, the channels we mentioned before use, indeed, multi-signature addresses. This implies that the parties involved will have the same power over the funds, and they’ll need to sign every transaction —which is great to avoid misbehaviors.  

For its part, the HTLC assures that every party has a key to sign the funds, and also locks the funds while the channel is open. So, if one party wants to close the channel (sending it to the main chain) with a favorable (but fake) balance on their side, then they’ll have to wait until this special contract let it do so —within 72 hours, for example.

ruští úředníci-zakázaná-kryptoměna

During this locked time, the other party can seize all the funds if the final balances of the channel are wrong. And they have the right to keep all the coins for them since the other party cheated. That’s the punishment for the bad actor.

An LN channel can be used by several parties as well. This way, for example, if Alice has a shared channel with Bob, and Diane has a shared channel with Alice but not with Bob; Diane can still send funds to Bob by using the route provided by Alice. That’s why it’s a “network”. Usually, the users might only share an “LN route” provided by a wallet, and that’s it.

How to use the Lightning Network?

The first thing you’ll need is to install a wallet or an LN node. Of course, the wallet option is far easier than the node, which comes with detailed instructions on GitHub (a platform for developers). Lightning by Blockstream, Lightning Network Daemon by Lightning Labs, and Eclair by ACINQ are popular node implementations. We can’t recommend these options if you have little informatics knowledge.

On the other hand, we also have friendly wallets, ready to download and use. Available for desktop and mobile, we have options like Zap, Blue Wallet, Muun, Wallet of Satoshi, Electrum, or Breez. All of them have their own features and fees, with some of them charging between 0.4% to 1% on channel creations.

Bitcoin-wallet-phone-coins

Another factor to consider is the decentralizace of your funds. Some of these wallets (Blue Wallet and Wallet of Satoshi) are custodial, which means they guard your funds for you, and you don’t have complete control of them. The others are non-custodial wallets: you’ll always keep your soukromé klíče, therefore, full control of your funds. At least, almost all the time.

Certain features on these wallets may need you to trust the funds temporarily to the company behind the software. For example, Muun has the “Turbo Channels” available. They’re instant LN channels provided by Muun to offer liquidity and usability. As they describe:

“When transactions require the use of turbo channels, there is a limited window of time where you trust Muun. Specifically, during that window of time, you trust Muun will not execute a – very public! – double-spend attack. If you are not okay with this, you should disable turbo channels. You do need to know, however, that turbo channels allow all payments to settle instantly and make your money available to spend immediately.”

Making an LN transaction

To make the process more illustrative, we can make an LN transaction on the Muun wallet. The first step is, of course, to download the app from the App Store or Google Play. Then it comes the usual for every wallet: set up a PIN and back up your funds on “Security”. Once finished, it’s time to deposit some satoshis.

Tap on “Receive”, and you’ll have two options: send coins from an on-chain (traditional) Peněženka Bitcoin or exchange, or send the coins via Lightning Network —if you already have another LN wallet or if a friend with an LN wallet wants to send you funds. The second option isn’t that hard. You’ll only need to scan a QR code or copy (and share) the Lightning Invoice address.

Lightning-Network-Muun-Wallet
Muun wallet interface. Screenshots.

There’s a menu to set the amount and valid time of your invoice (LN channel). The other party (or yourself) must do the opposite from their wallet: tap on “Send” and paste (or scan) the address or LN Invoice provided by the first wallet. Next, set the amount or choose “Use all funds”, add a note, and confirm the transaction.

Finally, voilá! Instant micropayment, almost for free. In this case, the Turbo Channel enabled by Muun will last almost 24h, which means that the transaction will be engraved on the blockchain later. But you still can send your new coins as you please. Enjoy Lightning Network!


Wanna trade BTC, LTC, a další tokeny? Můžeš to udělat bezpečně na Alfacash! Mluvíme o tom a spoustě dalších věcí na našich sociálních médiích.

Cvrlikání * Telegram * Facebook * Instagram * Youtube * Vkontakte

Author

I'm a literature professional in the crypto world since 2016. It doesn't sound very compatible, but I've been learning and teaching about blockchain and cryptos for international portals since then. After hundreds of articles and diverse content about the topic, now you can find me here on Alfacash, working for more decentralization.

cs_CZČeština