When talking about the Lightning Network, it is often said that money is “locked up” in payment channels. The reason for this expression is that when you have money in a payment channel you cannot use it outside the channel.
To use it elsewhere, you must first close the payment channel with an on-chain transaction. Because this requires confirmation times and on-chain fees, there has been rising concern that money could be less liquid in the Lightning Network than it is on-chain.
However, this might not be the case thanks to the development of splices. In this post we explain what are splices, what is needed for them to work and how can they change our perspective on liquidity.
In the Lightning Network, a payment channel always exists between two peers, for example Daniela and Sam. The basic operations are funding, updating and closing the channel. If peers behave cooperatively, the funding transaction and the closing transaction are the only ones that are broadcasted to the blockchain.
While a payment channel is open, there is a constant amount of bitcoins in it. This is called the channel capacity and each peer owns a fraction of it. How money is distributed between them changes according to how they transact off-chain. On the other hand, the channel capacity remains the same while the channel is open.
On-chain payments with off-chain money
Occasionally, Daniela might need to use part of the balance she owns in the channel with Sam to make an on-chain payment.
To keep her channel functioning, she needs to close the existing channel, pay on-chain, and open a new channel. This takes 3 on-chain transactions, with the associated fees and confirmation times.
We can see how costly it was for Daniela to use money she had in a payment channel to pay someone on-chain. If this was the only option, should Daniela keep her money on-chain just in case she needs it to pay on-chain?
Fortunately, the whole thing works differently with splices. Splicing is a feature that allows peers to either add or remove funds from an existing payment channel with one single on-chain transaction. In other words, they can change the channel capacity with a single on-chain transaction.
When money is being added to the payment channel, it’s called a splice in. When money is being removed from the payment channel, it’s called a splice out. In this post we focus on splice out, which has a greater impact on liquidity.
With a splice out, Daniela can close the channel, pay on-chain and open a new channel in one single on-chain transaction.
This has huge implications. If you can use off-chain money to pay on-chain, by broadcasting one single transaction, then your off-chain money can be at least as liquid as your on-chain money.
We saw how splices are more cost effective than broadcasting 3 different transactions to close a channel, pay on-chain and open a new channel. However, we haven’t mentioned anything about the other aspect in which splices also perform better: downtimes.
When Daniela and Sam make a splice out, they are closing an existing channel and opening a new one, with a different channel capacity. With splices, they can do this in one, single, on-chain transaction. But, what exactly happens with the channel while the splice out gets confirmed?
It is reasonable to assume that Daniela and Sam simply cannot transact during the confirmation time. The reason for this thought is that, if the splice out never gets confirmed, the valid channel is still the first one. But if the splice out does get confirmed, the valid channel is the new one. This would mean that payment channels have downtimes during the time the splice out gets confirmed.
However, it turns out channels can have zero-downtime with splices. How is it achieved?
As soon as Daniela and Sam make a splice out, they can keep transacting risk-free by considering either channel can end up being the valid one. If either channel can be valid, both of them need to be updated with the most recent state of the balance.
Therefore, during the confirmation time, Daniela and Sam will exchange off-chain transactions to update both channels instead of one. By the time the splice out gets confirmed, both channels have the most recent information on payments. For this to happen, payments must be valid in both channels.
We saw what is a splice out and how it affects the liquidity of off-chain money. We analyzed this from a cost and time perspective, and also in relation to downtimes. Could our money end up being “locked outside” the Lightning Network rather than in its inside?
Liquidity is not the only factor to consider when deciding if your money should be in payment channels or not. Some other factors might have to do with storing your keys online versus in cold storage, or the size of your payments. Also, the scenarios are very different if peers behave in a non-cooperative way.
Splices aren’t live yet. For them to work properly, dual-funded channels are required. We’ll keep writing about relevant topics of the Lighting Network. Join us in our next post!
Interested in the Lightning Network? Read more about:
Originally published at https://blog.muun.com on July 8, 2019.