Channel factories are an intermediate layer between Bitcoin’s blockchain and the Lightning Network (LN) proposed by Conrad Burchert, Christian Decker, and Roger Wattenhofer in a paper in 2017. Initially called ‘Scalable Funding of Bitcoin Micropayment Channel Networks,’ the concept has become commonly known as ‘channel factories.’
Channel factories are designed to reduce the number of on-chain transactions required for opening and closing LN channels. You can think of them as channel super-highways that can exist between many users without increasing the number of on-chain transactions necessary to open and close channels.
Users can open and close virtually unlimited numbers of channels, having the potential to drastically reduce the on-chain burden of the LN if it scales to a popular global payments network of millions of users.
Background on LN Channels
Opening an LN channel between two participants requires a transaction to fund the channel and open it with commitments of their BTC balances to the Bitcoin blockchain. Once the channel is open and funded, users can exchange BTC back and forth as many times as they wish within the confines of the balance in the channel that is transferred back and forth between them.
The magic is securely updating the channel state balance without publishing on-chain transactions.
Closing the channel also requires an on-chain transaction, where the channel balance is published on the Bitcoin blockchain. However, there are two primary limitations of the bidirectional channel setup.
- The requirement for on-chain open/close transactions does not scale well with LN adoption because of the limitations in Bitcoin’s on-chain capacity.
- Funds (BTC) are locked into the channel.
First, as the number of users of Bitcoin’s LN increases, the amount of on-chain transactions will also increase drastically — especially if each user is opening multiple channels. Bitcoin’s on-chain transaction capacity can easily handle the LN open/close transactions now, but if it is to reach its desired level of adoption the problem needs to be addressed.
For example, if 1,000 active LN users are seeking to open 5 channels each, then that creates 10,000 on-chain transactions. The more users, the more problematic the strain on Bitcoin becomes.
Second, the fixed amount of BTC in an LN channel is inconvenient, especially when the need to rebalance channels arises or refilling channels is required. Low channel balances are suitable for two interacting parties but are not ideal for peak performance of the LN which would require routing nodes and payments hopping between nodes.
The channel factory paper highlights these two problems and strives to provide a scalable solution where users can create an arbitrary number of channels as part of a group — drastically reducing the costs of blockchain transactions. According to the paper:
“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.”
The part about Schnorr signatures is important as the inclusion of Schnorr Signatures into the Bitcoin protocol is on the horizon and offers a suite of enhanced efficiency and privacy features for the network. Combined with channel factories, Schnorr signatures enable much more compact channel factory transactions when they are published on-chain.
Channel factories are empirically multi-party micropayment channels that consist of groups of participants creating one-to-one channels off-chain. The same method for broadcasting the close of an LN channel can be optimized to open another channel concurrently. In effect, channel factories leverage this capacity for creating and terminating off-chain channels without the need for broadcasting to the Bitcoin blockchain. According to the paper:
“Funds are committed to a group of other users instead of a single partner and can be moved between channels with just a few messages inside this collaborating group, which reduces the risk, as an unprofitable connection can be quickly dissolved to form a better connection with another partner.”
Channel factories lock in multi-party channel funds using a ‘hook transaction,’ which opens shared ownership of the deposited funds between the parties. The clever component that enables the funding of many multi-party channels is called the ‘allocation,’ where one or many sequential transactions can retrieve the locked funds of the multi-party channel as an input and fund multiple channels with their outputs. According to the paper:
“The allocation effectively replaces the funding transactions of a number of two-party channels.”
The hook enables a user to withdraw their funds from a channel if the other parties become non-cooperative. Opening secondary payment channels within a channel factory are essentially instantaneous as the channel factory itself has a sufficient amount of confirmations — users are creating channels within a channel.
Additionally, channel factories remove the risk among the participating parties using timelocks and an invalidation tree where only one path of the tree is broadcastable following the expiration of the timelocks. No single party or colluding parties can arbitrarily spend the channel factory funds due to restrictions derived from multi-sig.
Settlement consists of the parties in the channel factory cooperatively deciding to close the channel, and only the hook and settlement transaction are published on the blockchain. However, settlement of secondary payment channels falls into three primary options:
- Commit final state of the secondary channel to the blockchain.
- Update balances within the broader channel factory.
- Open a new channel.
The aggregate coordination required for larger channel factories rises, but they still retain the ability to function with only two on-chain transactions despite arbitrary group sizes. The implications of large channel factories are compelling for the organic growth of the LN.
Advantages, Risks, and Future Development
Channel factories are convincing improvements for the LN when considering the limitations in moving funds between channels for rebalancing. Rebalancing problems arise when one party of a bidirectional channel has a lopsided sum of the channel balance, and the other party cannot send them BTC because their end of the channel is too low.
“A new allocation is set up, which replaces every channel with a balanced new one while keeping the total stake of each party the same,” details the paper.
Channel factories can subsequently enable funds to be moved between channels, create new channels, or remove old channels — all without broadcasting to the blockchain.
Channel factories also have unique benefits in complex systems. In Bitcoin’s LN, channel factories have the potential to increase the depth of the connections between large groups of nodes. In effect, this would accelerate the speed of payment hops between nodes that people do not have direct channels open with.
With channel factories, the overlap between large channel factories would enable shorter paths between participants of separate groups, making the LN more distributed while simultaneously strengthening its connections.
Conversely, large channel factories have a notable deficiency. The number of parties capable of closing the channel factory rises in a higher order system and remove the ability to move funds between secondary channels following the broadcast of the hook and settlement transaction to the blockchain.
Such scenarios are not directly malicious — as no user funds are lost or stolen — but can be wielded by base users to increase the mining fees paid for the extra blockchain space that the channel factory requires — causing inconvenience for secondary payment channel users in the process. Cooperative users can decide on settlement solutions outside of publishing the path to the invalidation tree, however.
Overall, channel factories are a convincing proposition for the expansion and scalability of Bitcoin’s LN. The LN’s adoption is rapidly swelling, and channel factories are a practical tool for supplementing the network’s scalability via better on-chain efficiency and rebalancing of secondary payment channels for a more liquid payment ecosystem.