In the previous article, we introduced the Lightning Network and the factors influencing its emergence. And we also mentioned the main features that come with this network.
In this article, we are going to go one step further and explain how transactions are done in the Lightning Network.
Lightning network is based on payment channel technology. A two-way payment channel is created when both parties to the transaction create a multi-signature address in the blockchain by performing a transaction and at least one of the parties in that address has some assets (for example in the bitcoin blockchain, bitcoin or currency used in a blockchain) invest. Each party has a private key, and a transaction can only be done if both keys are signed. The initial transaction to open the channel takes an average of 10 minutes, as it is done on-chain and published in the blockchain, but after the channel is opened, the parties can use the assets they have invested in the channel. Pay immediate transactions to each other.
In general, an on-chain transaction is valid if everyone agrees to it after being announced on the network, but in a payment channel, the transactions made on the network will not be broadcast unless the parties want to open or close the channel. Signed but non-distributed transactions in the blockchain are done directly and one-to-one between the parties.
So far, various designs have been made for payment channels.
The first design was implemented by Satoshi Nakamoto in Bitcoin version 1.0. The second design announced by Spielman includes two transactions. One to create a secure deposit and the other to release the deposited currency with the agreement of both parties. The payment channel provided by him also operated one-way. This means that the transfer of currency is possible only from one side to the other. But there was a problem with Spielman's method, it was possible for one party to take over the amount deposited by the other party in the channel.
To solve this problem, the idea of a CLTV payment channel was proposed and, in the following, the Poon-Dryja payment channel, which formed the basis of the Bitcoin Lightning Network. Details of this idea can be seen here.
In this method, the fund of both parties is kept in a multi-signature account. Many models have been proposed for the implementation of payment channels, the latest of which is the idea of time-locked contracts and allows transactions to be transferred by intermediate nodes by ensuring security (no theft of funds transferred by intermediate nodes).
If you want to know more about the Poon-Dryja payment channel and Bitcoin Lightning Network details, wait for the next article.