How to send large Bitcoin payments on Lightning
Lightning Network is seen as the main solution in the Bitcoin ecosystem to make small BTC transactions feasible, as it allows you to send the smallest payments for almost no fees.
In fact, Lightning has come a long way since it was first designed in 2015 and went live in 2018. There are now over 88,000 public channels holding over 4,000 BTC, according to data from Txstats.com.
The Bitcoin overlay network has grown significantly in the last year after it was put in the center of global media with the use of bitcoin as the legal tender of El Salvador. The move gave Lightning a lot of legitimacy when it became clear to the world that bitcoin could actually be used to buy everyday goods.
While much work remains to be done to make a global adoption of the Lightning Network realistically possible, the protocol has solidified its position as the most important scaling solution for Bitcoin payments.
However, due to Lightning Network’s design of interconnected channels, it is not guaranteed that payments sent over the network will succeed, and decisions must therefore be made on how the wallet should prioritize payment flows. An example of this is prioritization by route charges, which is the most popular priority; it seeks to choose a path in the network that entails minimal fees for the sender.
ONE path in Lightning Network refers to the route a Lightning payment takes from sender to recipient across different channels. Routing means that payment can be made between a given sender and recipient without the two parties having to open a channel between them. Nodes between them route the payment through their channels in exchange for a routing fee.
Although choosing the cheapest route can often work well for small payments, as the amount of payment increases the less likely it is that the payment will succeed. In other words, the probability that the lower cost route – and Lightning Network in general – can deliver a given payment decreases as the size of that payment grows.
Much of this problem is about the liquidity issue, which is necessary for the movement of funds from both sender and receiver point of view – and each channel in between.
Of course, the larger the payment, the greater the need for liquidity in Lightning channels for the payment to be able to cross the network to the destination. For small payments, this does not mean much: the probability that a channel’s bitcoin capacity is enough for a small payment to go through is high, but it decreases as the amount of BTC sent increases. Therefore, senders of small Bitcoin payments sent through Lightning usually do not have to worry much about the liquidity issue, as larger payments do.
Nevertheless, even small payments are subject to delivery failure at Lightning. In that sense, increasing the reliability of both small and large payments seems like a good idea.
With this problem in mind, Lightning Network researcher and educator Rene Pickhardt began researching ways to optimize the likelihood of a payment being successful. Now the research is bearing fruit.
Pickhardt payments: Increasing reliability for lightning payments
As explained above, the core of the reliability issue in Lightning payments is centered around liquidity. As a result, most of Pickhardt’s work attempts to answer the question: Where is the liquidity?
There is not a single answer to that question. Worse, often there is no way to be sure about it either, even when considering a single channel.
While it may be trivial to determine the bitcoin capacity of a public Lightning channel, it is not easy to determine how that capacity is shared between the two peers – which poses a challenge to properly assess outgoing and incoming liquidity in that channel. . Therefore, the ability of a sender to accurately determine the liquidity required for a successful payment routing is impaired.
Because of this uncertainty, Pickhardt found that the best answer is based on probability.
Pickhardt Payments quantifies the uncertainty surrounding liquidity into a probability, maps all possible paths for a given payment to take and selects it with the greatest probability of success. In other words, Pickhardt Payments seeks to choose the path with the lowest level of uncertainty.
The probability model Pickhardt uses estimates the amount of liquidity in a channel. That model is run on Lightning Network’s public payment channels to estimate how likely it is that there is some liquidity in a given channel. The payment is then sent through the path that is more likely to contain the highest amount of liquidity – in an attempt to optimize for reliability. If the payment fails, the model learns from the error by updating its beliefs on the network.
Pickhardt’s approach spends decades of computer science research on the burgeoning Lightning protocol. More specifically, the Lightning researcher draws from the late father to information theory Claude Shannon’s work on communication channels, entropy, and uncertainty to quantify communication uncertainty with probability distributions.
Pickhardt payments for large transactions
At Lightning, large payments are made more feasible by splitting into smaller payments. These are then routed over the network to the destination, and if all succeed, the initial payment is successful.
Given that all divisions must succeed for the original payment to succeed, the higher the number of payments an original payment is divided into, the lower the probability of success. This is because the probability of the original payment succeeding is found by multiplying the probability that each “child payment” will succeed. This creates a kind of paradox because, in theory, the smaller the payment, the greater the chance of success. Therefore, an optimization challenge arises in finding the right split.
Pickhardt Payments seeks to increase the likelihood of the initial payment succeeding by striving for this optimization, which is done by reducing uncertainty costs. To achieve this, it utilizes operational research (OR).
More specifically, Pickhardt Payments uses Minimum Cost Flows, a well-studied tool from the OR field, to model and implement the optimal multi-part Lightning payment – and improve the decision-making process for sharing and delivering payments on Lightning. In short, the assumption is that there is an inherent cost associated with the uncertainty about the liquidity information for each channel.
Not to be confused with fee costs, uncertainty costs can be considered as the opportunity cost of trying a given route. In theory, the higher the cost of uncertainty, the higher the cost of alternatives, as the payment is less likely to succeed. By quantifying this uncertainty, Pickhardt Payments can minimize the opportunity cost and choose the path that maximizes the chance of success.
Ultimately, these optimizations allow Pickhardt Payments to send large Lightning payments which was previously impossible on the network.
Pickhardt’s design differs from current practice at Lightning because, as with single payments, prioritization for shared payments is usually based on fees. On the other hand, Pickhardt Payments prioritises lowering uncertainty costs as it seeks to increase the likelihood of payment delivery, which means that fees can often be relatively expensive compared to those typically paid at Lightning.
However, Pickhardt told Bitcoin Magazine that his algorithm can also offer the choice to optimize for fees, although he claims to do so at the moment is computationally heavy given the existence of Lightning’s base fee. In that case, the challenge will be to find an optimal balance between the two alternatives – which he calls “functions” – as users frolic in what they ultimately want to prioritize.
How to use Pickhardt Payments today
Use of Pickhardt Payments today can be done via LND managementJ by Carsten Otto. Alternatively, Pickhardt is developing a library that currently allows simulations and production tests. Pickhardt told Bitcoin Magazine that he will eventually send the library with bindings for implementations, but it is currently not as high a priority as technical accuracy, security and runtime. Although it is not yet an easy way for a regular user to take advantage of Pickhardt Payments, availability should increase as developers continue to work with the algorithm and library to boast of robustness and security.
Thanks to Rene Pickhardt for information and feedback.
For more information on Pickhardt Payments, navigate to the related research assignment and mailing list item. More resources are also available at Pickhardt’s website.