Batch Opening Channels on the Lightning Network with LN+: A Deep Dive

Posted 8 months ago by LN+

Bitcoin has seen an exponential increase in adoption since its inception in 2009. With this rise, the network has faced challenges, particularly in scaling and managing the increasing number of transactions. Enter batching, a technique that has proven effective in addressing these challenges. In this post, I'll delve into the benefits of batching transactions in Bitcoin and explore how this concept can be applied to the Lightning Network, especially within the context of LN+.

Why Batching Transactions in Bitcoin is Beneficial

Reduction in Transaction Fees
When sending Bitcoin, users pay a fee to miners for processing and confirming their transaction. The fee is typically calculated based on the data size of the transaction. By batching multiple transactions into one, the overall data size for the combined transaction is reduced, leading to lower fees.

Efficient Use of Block Space
Each block on the Bitcoin blockchain has a size limit. This means that only a certain number of transactions can be included in each block. By batching multiple transactions into a single one, users can more efficiently use the available block space, allowing for more transactions to be confirmed within the same block.

Scalability
Batching is a practical solution to Bitcoin's scalability challenges. By reducing the number of transactions that need to be processed and confirmed, batching helps the network handle a higher volume of transactions without requiring significant changes to its underlying protocol.

Reasonable Limits to Batching

While batching offers numerous benefits, it's essential to be aware of its limitations:
  • Privacy Concerns: Batching multiple transactions can potentially reduce the privacy of the participants, as multiple transfers are visible within a single transaction.
  • Complexity: Implementing batching requires changes to wallet software and can complicate transaction tracking.
  • Optimal Size: There's a trade-off between the number of transactions batched and the savings in fees. After a certain point, adding more transactions to a batch may not yield significant savings.

Batching and the Lightning Network: Opening Channels Efficiently

Just as transactions can be batched on the Bitcoin network, multiple channel openings can be batched into a single on-chain transaction on the Lightning Network.

While the concept of batching channel openings is promising, it comes with its set of challenges:
  • Coordination: Batching requires coordination between participants, which can be complex. But we can help with this on LN+, just read further!
  • Liquidity: Batching multiple channel openings might require more substantial initial liquidity, which might not always be feasible for every participant.
  • Potential Delays: If one channel in a batched transaction faces issues, it might delay the opening of other channels in the batch.

How Much Batch Opening Saves You

Bitcoin transactions are made of 4 parts:
  1. Transaction overhead (version, locktime, etc.): ~11 vB
  2. Input (at least one or more): ~67 vB
  3. Output (at least one or more): ~31 vB
  4. Change output: ~31 vB
Total: ~140 vB.

To compute transaction costs in Satoshis, multiply the transaction size (in vB) by the fee rate you're prepared to pay to record the transaction on the blockchain. For instance, if the fee rate is set at 10 sat/vB, a transaction of 140 vB will cost 1,400 Satoshis. Naturally, if there's more than one input, the cost will rise.

When opening multiple channels simultaneously, the transaction's overhead and input remain constant, but the number of outputs increases. As a result, the cost per output begins to decrease significantly. Refer to the provided table and chart, which outline the costs associated with various numbers of outputs (or simultaneous channel openings).

Fee Savings in Optimal Conditions


Fee Savings / Number of Channels Open in a Batch


From the data, it's evident that batching even two channels offers nearly 40% in savings. This efficiency climbs, reaching up to 74% when batching 20 channels. The sweet spot for practicality versus savings seems to fall between opening 3 to 6 channels at once. However, remember that these savings are under optimal conditions where only one input is used. In practice, especially when opening numerous channels, multiple inputs might be necessary, and the actual savings could be slightly lower. This variation is represented by the yellow shaded region in the chart.

How to Find Nodes to Open Channels to with LN+

There are several ways to find nodes to open to depending on your goals, such as payment reliability or earnings from routing. However to minimize your channel opening fees you should join LN+'s Liquidity Pool, where you can offer to open channels to nodes and in return you will earn liquidity credits that you can spend on receiving channels from other nodes. In result, you will not only save fees on batch opening, but also you will double the amount of channel capacity through the pool.

Here is what you do step by step:
  1. Get your LND lightning node.
  2. Get sufficient funds ready.
  3. Familiarize yourself with the tool called BOS (Balance of Satoshi).
  4. Go to the Liquidity Pool.
  5. Find several nodes you want to open channels to.
  6. Click 'Open Channel' on the node cards to create a credit transaction, which is an offer to open a channel.
  7. Wait until 3+ nodes accept your offer.
  8. Open all channels in a batch with BOS: read instructions.

Example command:
bos open pubkey1 --amount 1000000 pubkey2 --amount 3000000 pubkey3 --amount 4000000
Once you enter the command and hit enter, it will ask the onchain transaction fee you want to set and also if you want to use your internal LND wallet for funding the transaction.

If you're running on Umbrel, check out the LndBoss app, which is a GUI version of BOS.

Conclusion

Batching has emerged as an effective solution to some of Bitcoin's scalability and cost challenges. While it brings numerous benefits, it's essential to approach it with a nuanced understanding of its limitations. As the Bitcoin ecosystem continues to evolve, techniques like batching will play a crucial role in ensuring that networks like Bitcoin and the Lightning Network remain efficient, scalable, and cost-effective.

4 Comments

μbolt|lnd

μbolt|lnd wrote 8 months ago

This is very helpful.
Q. Is --batch is still current on bos?
I can not see batch option when I run bos open --h (bos 17.0.0 )


LN+

LN+ Admin wrote 8 months ago

μpleb: No, I messed up the commands, because I trusted GPT with this (I assumed it can do this much). I got the post checked by Alex B, and Nitesh and now the post has been fixed. Sorry about it.


μbolt|lnd

μbolt|lnd wrote 8 months ago

Not a problem at all. I was preparing to batch open at some point soon, so just wanted to check with you for clarity. Thanks for editing.


coinbroderie.fr [myNode] wrote 8 months ago

For the input part - it is under all circumstances better to have only one input - that's why sweeping is part of the ln node maintenance.

Please login to post comments.