It’s a no secret that Bitcoin’s Lightning Network is growing at a tremendous speed and the amount of innovation happening there is simply unparalleled.
One of the core mandates of lightning is to reduce the number of on-chain transactions and still be able to offer the same sense of security to the end user for using the second layer.
And all these projects will eventually be reducing the number of on-chain transactions.
But the majority of on-chain transactions are required for opening and closing of payment channels which can be a huge barrier in the future.
Right now, of course, the blockchain can handle several thousand on-chain transactions for opening or closing of channels but when Bitcoin adoption reaches in billions, channel management can create network congestion.
So that’s why keeping a long term view in mind, lightning developers have come up with a concept called Lightning Channel Factories, which will make channel management more efficient by reducing the eventual number of on-chain transactions.
But before dwelling into Channel Factories, let’s have an overview of simple LN channels.
For opening a payment channel on lightning the users first fund their channel. It simply means they transfer their funds to a 2-of-2 multisig address on the blockchain.
Once this transaction confirms, the users can virtually do any number of transactions back and forth in this channel without putting those transactions on the blockchain.
Lastly, when they are done transacting with each other, they can close the channel by broadcasting the latest state of the channel to the blockchain.
This way of working has three limitations:
- First, the funds are kind-off locked untill the channel closes.
- Second, one cannot rebalance the funds in a channel without closing or opening the channel.
- Third, the more channels one needs, the more on-chain transactions are required.
For example, if 500 LN users want to open 2 channels each then they have to make 2000 on-chain transactions !!
Of course, one would say that Bitcoin’s blockchain is processing 300-400k transactions a day, so 2000 on-chain transactions shouldn’t be a problem.
But this can a problem in the future when many lightning users are active and at that time simple payment channel management itself will clog the network defeating the whole purpose of having a second layer.
But this problem is being taken care of by channel factories.
Getting Started with Bitcoin? Below is all you need:
What Are Lightning Channel Factories?
Channel Factories is another name of the concept brought forward by Conrad Burchert, Christian Decker, and Roger Wattenhofer in their whitepaper on ‘Scalable funding of Bitcoin micropayment channel networks’ in 2017.
Channel factory is an intermediary layer that aims to sit between the blockchain and the lightning network channels to provide an off-blockchain channel funding solution.
This will result in a 3-layered system:
- First layer: the blockchain, where every transaction is validated by every node.
- Second layer: this consists of multi-party payment channels (i.e. channel factories).
- Third layer: this is the resultant network of channel factories for LN payments.
How Does Channel Factories Work?
If you closely look, channel factories are simply an extension of 2-of-2 payment channels.
So in factories, instead of doing 2-of-2 multisig, you can do 5-of-5 or 10-of-10 multsig where the funds are allocated by multiple parties.
You can imagine this factory like a pool or starfish where 5 parties are allocating funds in a 5-of-5 multisig and now within this multisig, all the parties can open many 2-of-2 channels concurrently.
Let’ see this example of 3 parties in a channel factory.
This is how it works:
Firstly, the 3 participants pool in a fund and create a ‘hook’. The hook transaction is the funding transaction of the multi-party channel. It locks the funds of many parties into shared ownership.
Secondly, now from this hook transaction, the funds are allocated and can be used by many pairs of parties to fund their individual channels.
For example, if Alice, Bob & Harry have allocated 1 BTC each in a hook transaction then now the pooled capacity is 3 BTC which now allows each of the three parties to open up channels with the other remaining two.
- Alice & Bob can have a channel between then with 0.5 & 0.5 BTC from both parties
- Harry & Bob can have a channel between then with 0.5 & 0.5 BTC from both parties
- Alice & Harry can have a channel between then with 0.5 & 0.5 BTC from both parties
Thirdly, when any of these parties wish to close the channel, they can do so by locally closing their individual channels within the factory without going to the blockchain. This magic happens from hashed time lock contracts and scripting language of Bitcoin.
This is called the commitment, a commitment is a transaction or a number of transactions that return the funds of a two-party channel to their owner.
So this way one can create sub-channels within a multi-party channel which is funded and owned by multiple parties.
Benefits Of Channel Factories
Thanks for the preview, @GamerAndy =)
Lightning Network Development
Dual Funded Channels
Sphinx and Rendezvous Routing
— ProfessorMeow (@ProfessorMeo_w) March 3, 2019
Furthermore, with the magic of splicing-in and splicing-out, these multi-party channels can exist perpetually and can continue replenishing/rebalancing themselves.
And all this with splicing will happen in one on-chain transaction which will be ultimately utilized by multiple participants of that channel factory.
Also, in cases where one party want to drop-off and want to give its replacement in such cases also the channel factory can exist and utilize this opportunity to rebalance/replenish the channel factory.
One of the examples where you can use channel factories is where you have some very critical centralized nodes on lightning that are doing a lot of traffic with each other. These can be very large merchants, very large wallets, exchange nodes that are on the Lightning Network.
Lastly, channel factories will drastically help in keeping a check on the overall cost of on-chain transactions as well as lightning payments because it will not let the main blockchain become congested.
Here is an estimate of the same:
For a group of 20 users with 100 intra-group channels, the cost of the blockchain transactions is reduced by 90% compared to 100 regular micropayment channels opened on the blockchain. This can be increased further to 96% if Bitcoin introduces Schnorr signatures with signature aggregation.
Hope you find this article informative. If you do, please share it with your friends and family member who are interested in knowing about Lightning Network and Channel Factories !!