Articles on: Bitcoin

⚡Lightning Network on Defiant⚡

Lightning Network is a network used for fast and low-cost BTC exchanges. Currently, the Lightning Network project presents itself as the best candidate to solve the scalability problem of Bitcoin's main network, on the path to true adoption of this cryptocurrency as a global payment system.

Lightning Network (LN⚡)



LN⚡ is independent from the Bitcoin blockchain, but it can still be used for BTC exchanges. LN⚡ can be described as a network of interconnected payment channels that allows the transfer of balances, or BTC, peer-to-peer.

Payment Channels


The proposal of LN⚡ consists of part of the value exchanges being resolved off-chain, where LN⚡ allows for the opening of payment channels between two addresses on the Bitcoin network. These addresses will give up a specific amount of BTC to this channel, which can be reassigned between these two addresses as many times as desired without the need to report the change of balances on the Bitcoin blockchain.
If either party already had another open LN⚡ payment channel, it will serve as a bridge to the different people with whom it shares channels, enabling a payment network between all actors, only limited by the BTC capacity defined when opening each of the channels.

Currently, there are more than 80,000 open payment channels on the Lightning Network.


On-chain transactions and off-chain transactions


Within the LN⚡ payment protocol, there are only two types of transactions that need to be executed on the Bitcoin blockchain, which correspond to the opening and closing of payment channels -- funding transactions and closing transactions. These transactions can be thought of as movements of BTC from the main network to LN⚡ and vice versa.

The other transactions -- commitment transactions -- take place off-chain and are, for practical purposes, the ones that reassign BTC between the addresses that participate in the Lightning Network payment network. As you might imagine, the commitment transactions that occur on LN⚡ follow a tight logic that ensures that all parties involved in the payment network cooperate.

Invoices


It is not necessary to understand the various mechanisms that make up LN⚡ transactions and ensure cooperation within the network. However, it is important to understand how invoices work, the instrument with which payments are executed on the network. Understanding these will make it clearer how the LN⚡ network functions.
In LN⚡, payments are not made directly to an address, but rather are requested through an invoice. This invoice, which requests payment of a certain amount of satoshis —the minimum unit of BTC, corresponding to one hundred millionth of a part— also shares encrypted information, which in Lightning Network literature is simply called as "secret". Only the issuer of the invoice knows the secret -—the decrypted information— but from the encrypted information it is easy to verify the authenticity of the secret if it is revealed.
As may be suspected, it is very likely that the person who wants to make the payment does not have a direct payment channel with the other party, and must pass through other payment channels in the network to make the payment. Thus, what will be done is to extend a promise of payment to whoever makes the payment to its destination —with some additional sats added as a reward for the intermediary/ies— also sharing the encrypted information, which will function as a verification mechanism. Using this information, the promise of payment will be programmed so that the payment can be claimed by revealing the secret.
Once the payment reaches its destination, the requester will verify that both the amount and information are correct. If so, they will reveal the decrypted information to the other party, who will use it to collect their payment and share it with the other intermediaries in the chain to do the same. With the secret disseminated, all actors in the system have been paid, and the amount requested in the invoice has been correctly transferred.
Just like regular invoices in the non-crypto world, LN⚡ invoices can only be used once to receive a single payment. For each payment that needs to be requested on Lightning Network, a new invoice must be generated.


LN⚡ on Defiant



To use LN⚡ within Defiant, it is only necessary to be aware of the dynamics of the invoices explained above, since these must be issued prior to any payment being made.
It should be noted that there must be a balance on LN⚡ in order to pay an invoice —and the balance must be equal to or greater than the amount specified on the invoice— but payments can be requested without having any balance. At the moment, the maximum amount that each wallet can manage on the LN⚡ using Defiant is 0.002 BTC (200,000 sats.).
Finally, it is worth adding that it is possible to make Funding from the main Bitcoin network to add funds to the Lightning Network.

This function should not be confused with opening a payment channel, a task that Defiant currently delegates to opennode . Defiant does not yet integrate the function to open and close payment channels from the app.

Lightning Network is not a solution dedicated exclusively to Bitcoin. Other blockchains can also use this scalability solution, and even other use cases have been suggested that do not solely belong to the blockchain technology space. Currently, LN⚡ runs for Bitcoin and Litecoin.

Updated on: 21/03/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!