Lightning Network and an estimate of its effectiveness

The overwhelming number of people savvy enough to understand what cryptocurrencies are, performance problems with the bitcoin blockchain and the lightning network, still naively believe that this technology can solve all problems overnight, and will allow the blockchain to scale almost indefinitely.



I will try to dispel these misconceptions.



The classic blockchain in its pure form, where each node passes all transactions through itself, is not capable, at the current level of technology, to store and process a large number of transactions. Even if you do not limit the size of the transaction storage block to a limit (in bitcoin it is 1mb + 3mb from sidechain segwit), the transaction processing speed is limited by the capabilities of the end nodes (I’m not talking about SPV wallets that completely trust the verification of transactions to full nodes); Millions of transactions per day (250 million transactions are fully checked during the initial load of the blockchain with a new bitcoin-qt installation, on a modern machine this takes about 12 hours, with an excellent Internet connection and ssd disk, on a weak machine intel celeron - the load is delayed for 3 days) - now it is about 5-6 thousand transactions per second (for example, the graphene infrastructure bitshares blockchain tests show 2500 tps but when using server hardware with a large number of processors, on the other hand the theoretical maximum is 150t tps) .



The task of checking transactions linearly scales if you distribute the load on several computers, but it also linearly increases the cost of equipment from the load on the entire network, which is inconvenient if you want to raise your service, accepting funds from users and not willing to trust any other service.



This is obvious - the blockchain needs technologies that allow it to scale its performance nonlinearly.



Sidechains - the best that has been proposed lately in cryptoeconomics, and at the same time potentially damaging to that component of cryptocurrency, for which she fell in love - independence from a single point of failure and centralization of control over users ’finances.



Sidechains that store additional information in their repository



A great example of such a sidechain is - segwit, this update is a crutch that allows you to expand the capabilities of the bitcoin blockchain (and its fork) without the need to drastically break compatibility with old customers. The main way by which segwit allows you to increase the number of transactions in a block, without expanding it, is to transfer some of the transaction information to a separate repository. Those. each transaction leaves a mark on the blockchain.



This will not give a noticeable increase in blockchain productivity, average predictions are 2-2.5 times increase, and the theoretical maximum is 4 times more transactions if all of them are multisig p2sh (for example, LN clearing).



If you compare segwit with the usual increase in block size up to 4mb - then this is no different, even slightly higher CPU load is obtained. But segwit brought with him other technologies, as well as compatibility with legacy clients. This is a necessary measure that is difficult to refuse.



The easiest and most effective sidechain is a regular bank (or some exchanges)



... with an account in a cryptocurrency - you transfer coins to your bank account and you can transfer your coins between clients of this bank without placing transactions in the public blockchain (for some cryptocurrency exchanges, this is a translation by code). Of course, the bank keeps these transactions in its format, for itself and for financial monitoring. It is clear that when attempting to transfer to another bank, a blockchain transaction will appear, but banks may agree among themselves on making these transfers according to their own rules, for example, using the state as a guarantor that transactions will be executed.



Thus, transactions can never even get into the blockchain, thereby completely unloading it.



The drawbacks of ordinary banks are elementary - full confidence in the bank is required, plus there are no guarantees that the coins that you have transferred to them for safekeeping will be left unused; moreover, it is common practice to use users' investments for their own needs. This is a very rotten practice, and it is the result of regular failures of banking systems, because in the event of a crisis, banks simply cannot fulfill their obligations and give the money already spent by their client.



More advanced technology - lightning network



... when instead of blindly trusting your money to the bank, you can agree on a two-way pledge, when a couple of users (one of whom is not necessarily a bank), block the blockchain with a special transaction (contract), the same amount so that the balance difference will be show mutual debt obligations. And most importantly, on such arrangements, you can build a network of users with obligations that will respond with their blocked balances for completing transactions on them.



The transfer over the network between the participants is a simultaneous change in mutual debt obligations for the amount of transfer of those participants who are in the network between the sender and the recipient. These changes are not reflected in the blockchain in any way, but if the amount of one-way transfers exceeds the amount of funds blocked, it will require clearing - balancing balances in some way, for example, using loops in the LN network, or sending the necessary funds through the blockchain.



From here we see that the only strategy in which LN allows you to infinitely scale the number of transactions processed is if users send coins to each other with a zero total average balance change. Obviously, this is possible only if the network degenerates into one central node, in which all clients are blockchain users, but there is no need to store and trust its funds to it.



Reliably, efficiently and centrally , because in such a scheme it is possible to refuse to transfer coins on any pretext , for example, to block all transfers from people who do not fulfill the requirements of financial monitoring. Or, for example, if suddenly your country fell under the sanctions of one of the largest economic zones - the European Union / US / China / ..., your pledges may be blocked by a court decision, or when the bank wishes to entrust you with its risks of losing money when transactions were an exchange for goods or services that were prohibited and which the state was able to select in their favor.



It will not be so bad if LN is not the only available way to use the blockchain, but the danger exists, which I wrote about earlier, if the number of transactions in the block remains limited to 1 or 2 MB.



How much will the lighting network expand the translation performance?



Based on the main feature of LN, instead of the cumulative number of transactions, it is necessary to consider the number of blockchain and clearing transactions that may be needed per user for a certain period, as users can send each other one and the same amount in successive amounts, without fees, if there are no intermediate nodes between them.



First, each new user of the network will have to make at least one replenishment of his wallet, and this should be a blockchain transaction. LN users can only be with a non-zero balance.



Secondly, in order to connect to the LN network, an opening transaction is needed that blocks the balances at the input node and the user.



Thirdly, but not necessarily, this is a closing transaction for the user to leave the LN network, for example, to switch to another network node, in order to optimize commissions.



Fourth, the largest transaction volume is clearing, balancing balances on LN node accounts. Each large transfer over the network increases the chance of such a transaction, and each intermediate node in the network. Moreover, it is possible that the next transaction of a single user will require each node in the network to issue a clearing one if the network is not built efficiently (there are no cycles). The greater the amount of collateral between the nodes LN, the less will need clearing. Large nodes will be able and will optimize their expenses in such a way as to minimize or even eliminate clearing via the blockchain, but ordinary users will not be able to do this. Even in the best case, active users will block only a small fraction of the average replenishment (for example, payment of salary once a month or receiving remuneration for work), which means that during the period between the receipt of funds, they will need clearing transactions. It turns out in the ideal case, one user will do 1 blockchain transaction per month.



The fourth item introduces the largest number of transactions, and you can estimate how many such active users can use the blockchain.



The number of transactions in the blockchain with 1mb limit without segwit is 262t. per day or 7883t. per month. Multiplying by 2.5 the coefficient that will be available thanks to segwit, we get 19 million transactions.



The result - 19 million active users, this is the maximum, how much can a 1mb block of legacy bitcoin be able to accommodate.



And no one-time extensions of the block limit to 2 or up to 8 mb will noticeably change this number. 19 million people, or 190 million - it is too little. The future of cryptocurrency is billions of active users.



Of course, it is obvious that in the near future, 1-3 years, the typical active bitcoin user does not receive a salary every month, and spending it is also not regular, it means estimating 1 clearing per month may be erroneous, but to evaluate it requires serious analysis of the blockchain , and this is not the kind of work that can be done by writing a simple article.



If during this time, you do not find a technical and organizational solution, to increase the limit on the block size, network users will be forced to withdraw from using and storing their funds under their own control on local wallets, online wallets and banks. And they will be forced to do this by the rising cost of blockchain transfers.



All Articles