Lightning Network – the main hope bitcoin
Recently, the bitcoin network has been choking on a huge number of unconfirmed transactions, the transfers have been depressing for a long time, and high commissions have forced many to refuse using BTC at all, switching to other crypto-currencies. And after the rejection of SegWit2x, many like the arrival of the Messiah are waiting for when the Lightning Network will work – the main hope of bitcoin.
This is a kind of superstructure over the bitcoin network, it allows you to create two-way payment channels without recording them in the main locker. At the same time, the reliability and security of transactions is ensured even in the absence of mutual trust of the parties, plus it is possible to guarantee the transfer of money through intermediaries, which none of the participants again does not trust.
«To understand how this is achieved, consider the transaction mechanics in the Lightning Network.»
Payment channel between two users
The opening of the bilateral channel begins with the fact that both parties (let’s call them Alain and Boris) form the base address with a multi-signature, to which each contributes a certain amount as a deposit (suppose it will be for 1 MTC). Also, when the channel is opened, everyone creates a secret code for the next state of the channel, the hash of which sends the second.
If Alena is to send 0.5 VTS to Boris, she forms a transaction with two addresses-one sends 0.5 VTS, the other sends 1.5 MTC. The second address is not normal, but with relative time-out (CSV) and contains the hash of the secret code sent to it by Boris. Signing the transaction, she sends it to Boris. If he signs it and sends it to the blockade, Alain immediately gets his 0.5 BTC, Boris will be able to use 1.5 BTC only after some time (for example, 1000 blocks). Theoretically, Alain can also take these one and a half bitcoins, at once, but only if she knows the code of Boris (and she does not know him).
He also forms and signs his transaction, where he sends to the address from the original address 1.5, and 0.5 VTS to the CSV-address of Alena. Thus, a new state of the channel is formed, where the funds are distributed as 0.5 and 1.5. Everyone can sign a transaction, and then the second will immediately receive his part, the first one is forced to wait for 1000 blocks before spending.
Why is this done?
To protect both parties from fraud, if the transactions are more than one (and the channel is just created for multiple payments).
Let Boris now have to pay 0.3 MTC to Alena. To do this, each creates a new pair of signed transactions (from the base address, because it is recorded in the network bitcoin), according to which Alena now has 0.8 VTS, and Boris’s 1.2, and forward each other with secret codes from the previous channel state.
Now Boris has two signed transactions with Alena, and according to the first, he has 1.5 military, and the second 1.2 military-technical cooperation. Theoretically, he can send to the unit the one where he has more funds, thereby stealing Alena by 0.3 military-technical cooperation. But in this case, she will immediately get 0.5 VTS, he can also take his 1.5 VTS, only when the network calls 1000 blocks.
And since Alena now has a secret code of Boris from this state, she, seeing that only 0.5 bitcoins came instead of 0.8, will understand that she is being tricked and can immediately take away the remaining 1.5 military-technical cooperation.
Thus, using temporary blocking of addresses and forwarding of secret codes for previous transactions, it can be guaranteed that in the absence of trust, both parties will behave honestly and send only the last (true) state to the battle of bitcoine.
In this case, thousands of exchanges can be made through the channel, only the initial and final distribution of funds will be recorded.
Making payments through the intermediary nodes
Making payments on a two-way channel is only part of the unloading provided by the Lightning Network, because the protocol allows you to use intermediate nodes. Suppose that Alena must pay 0.2 VTS to Victor. They can open their channel, but this requires two additional entries in the blockroom.
«However, if they already have open channels with Boris, they can send bitcoins through it, while the Lightning Network guarantees that the funds will come.»
To do this, Victor creates a secret code, the hash of which sends Alena. It, in turn, forms a transaction for 0.2 VTS with multi-signature and absolute time delay CLVT (that is, you can withdraw funds after a certain time, for example, day), where the inserted hash is inserted, and sends it to Boris.
The latter, in turn, sends 0.2 bitcoins to Victor in exchange for a secret code using which receives funds from Alena. If Boris does not send the promised amount to Victor, then after 24 hours, 0.2 MTC from the address created by Alena will return to her.
Of course, here we must ensure that Boris himself will receive a secret code, but this is achieved by creating a CLVT address between him and Victor.
As a result, in order to send payments through the Lightning Network to hundreds or even thousands of addresses, you do not need to create channels with everyone, it’s enough to form a way to the right address through intermediaries. Scientists claim that any two people on the planet can be connected at most through a chain of 7 acquaintances, so that, with a small number of open payment channels, you can transfer to almost any address.
Advantages of Lightning Network:
- The most important advantage now of using the Lightning Network is a significant increase in the throughput of the bitcoin network due to the fact that a large number of small transactions will pass through two-way channels without writing to the block. And because their operation requires only the computers of the users themselves, the system is easily scalable, because every new user works from their device.
- The second important advantage is the speed of transactions. As soon as Alena sends the payment to Boris, he will immediately receive it, wait for the confirmation of 10 minutes, and even more so the hour is not needed. So the Lightning Network is suitable for fast payments here and now.
- zero commissions. Since the channel is created between two users without writing to the block, it is not necessary to pay the miners. The commission is taken only for opening and closing transactions.
- This technology is suitable for almost any crypto currency. The fact that the Lightning network is mentioned mainly in connection with bitkoyn reflects only the fact that for bitkoy, the problem of scalability and insufficient bandwidth is relevant right now, while other crypto-currencies can still cope with a smaller distribution.
However, the implementation of the Lightning Network is already said by the creator of Litecoin, Charles Lee, and in the future the technology will probably use other crypto-currencies.
And since LN can work with any currency, nothing prevents using it to implement so-called atomic swaps – direct exchanges between different blockboys. The only difference is that the deposits for creating the channel will be paid in different digital coins.
Finally, the Lightning Network is perfect for creating decentralized exchanges and other applications where users can easily exchange different currencies or perform other operations.
- LN is not suitable for large translations. After the opening of the channel requires the introduction of a certain amount, and if there are several channels, it is necessary to contribute funds for each. Considering that while the channel is open, bitcoins are frozen as it were and can not be used for other operations, it’s not advisable to make large sums. That is why the Lightning Network is called a channel for micropayments.
- LN will not solve the problem of scalability finally, if we assume that bitcoin will become a means of payment within the whole planet. Because the bandwidth of the network will remain limited, and even if each user needs only one opening and one closing channel a transaction per month, the network will be able to serve no more than 5 million people, i.e. less than a thousandth of the growing population of the Earth.
So, the technology of the Lightning Network is, of course, a very important, but far from the final update of the bitcoin network. Its implementation will allow temporarily unloading the block, eliminating it from small payments, allowing them to be carried out quickly and without commission. This will significantly expand the possibilities of bitcoin for use as a convenient everyday means of payment, which will cause another increase in the number of users, and at the same time the rate.
Progress in developing
Currently, the leading teams for the implementation of the Lightning Network are Lightning Lab, Blockstream and ACINQ. In December 2017, they announced that they had achieved compatibility of their applications and published a general specification designed to become the standard for the application of LN in the main bitcoin network.
In December, the payment service Bitrefill used LN for a real transaction, and on January 17 Blockstream launched an online store where you can pay for purchases through the Lightning Network. At the same time, the company warns that while it is an alpha version of the protocol, it may contain errors, and therefore the list of goods available for order is very meager.
However, the fact that the Lightning Network is already used in real applications demonstrates that work on the protocol has reached the final straight line, and we can hope that a full-fledged working version of the Lightning Network will appear in the first half of 2018.