Bitcoin App: Lightning Loop

Lightning Loop

Share this article

The Lightning Network has been a welcomed addition to the bitcoin stack as a method of moving transactions off-chain without having double spend issues and helps scale the network. Lightning provides fast and cheap transactions by moving bitcoin between parties through its protocol rules.

Think of the bitcoin base-chain as a train; all transactions get onto the train and move to the next station; you can’t move faster or slower than anyone in that carriage, or in bitcoins case, a block. Once we reach the station or confirmation block, everyone gets there together. In Lightning, it’s more like instead of heading to the station, you’re able to travel on the road, you can pick the route that best suits you, and when you need to, you can always go back to the train station.

Moving away from the final settlement on the bitcoin base chain comes with certain trade-offers or rather operational quirks, one of those being managing channel capacity. If you’ve asked any non-custodial Lightning user what their biggest pain point or hurdle is initially, it would have to be getting to grips with managing your inbound and outbound capacity in your channel.

The quirks of being a lightning node

When setting up payment channels, users have to fund their Lightning wallet with bitcoin to begin sending and receiving. Once established and confirmed by the base chain, you can now see the channel, but you’ll find that you can’t receive bitcoin. Since you lack “Inbound capacity”, which refers to a receiver’s ability to claim a certain number of bitcoin from a sender, you’re stuck until you make a payment.

This would not be a problem if you established a Lightning channel with the purpose of paying someone, but it can be an issue if you’re establishing a channel to receive payment. It’s simply not an intuitive process; the idea of having a wallet that can’t receive by default seems strange, doesn’t it?

When you create a Lightning channel, you create a money tunnel; the money is now all sitting on your side of the tunnel; if you moved some first, you would have spare capacity to receive if you didn’t, you’ll end up blocked.

For example, Molly has a payment channel set up with Angela and Molly funded her side of the channel with 2 BTC. In comparison, Angela funded her channel with 1 BTC, then Molly’s inbound capacity is 1 BTC, and Angela’s is 2 BTC. If Molly wants to receive 2 BTC from Angela, then they’d have to open up a new channel and fund it with the appropriate amount.

If a sender does not have enough bitcoin for a given transaction, the recipient won’t be able to receive an invoiced amount through the channel. But if a channel is at capacity, then the recipient won’t be able to receive funds, either.

So what do you do if you’re new to the Lightning network and have no mates to help you secure capacity? Well, you look for a liquidity market.

Channel rebalancing

Dealing with inbound and outbound liquidity might be daunting for first-time users, but this issue doesn’t go away; you simply have to manage it. As your Lightning channel matures and you keep making payments or routing payments, channels can become unbalanced, with too much liquidity on one side versus another, and you will have to rebalance.

If routing payments continues only to go one way, you’ll have to find a way to send payments in the opposite direction to keep that capacity open, or payments will fail. In certain cases, your would need to open a second channel and try to rebalance that way and close the old channel, but channel churning can be expensive as you’re at the mercy of the fees of the base layer.

It becomes near pointless to manage a channel, if closing and opening is costing you more than you’re sending or earning through routing payments.

Keeping you in the Loop

Lightning Labs, the development team behind LND, aimed to tackle this problem with a new protocol called Lightning Loop. Lightning Loop is designed to allow users to deposit and withdraw bitcoin from their payment channels (the two-way payment gateways that allow users to send and receive funds to and from each other) without closing these channels entirely.

Why would you use Lightning Loop?

  • Automate channel balancing with AutoLoop
  • Deposit to a Bitcoin address without closing channels with Loop In
  • Convert outbound liquidity into inbound liquidity with Loop Out
  • Refill depleted Lightning channels with Loop In
  • If you’re using LND, since Loop isn’t compatible with other Lightning implementations

Loop Out

For merchants, services, and users who primarily receive funds via Lightning, Loop Out serves as a bridge, allowing funds to be sent out of the Lightning Network to “on-chain” destinations like exchange accounts or cold storage systems. This can also be useful for users who want to:

  • Manage capacity so that channels can be used indefinitely to receive more funds
  • Send funds on-chain to merchants or services that aren’t yet Lightning-enabled
  • Rebalance routing channels so payments can be routed in any direction

Loop In

Loop In enables typical users to “refill” their Lightning wallets when funds are depleted. In these cases, users “Loop” funds into Lightning wallets from “on-chain” sources (e.g. exchanges or cold storage). Loop In can also be useful for:

  • Operating fiat bridges that deliver funds to Lightning Network users
  • Services that pay users via Lightning (e.g. for content creation, rewards programs, micro work, etc.)

What is autoloop?

The Lightning loop client also contains functionality to dispatch loop-out swaps automatically, according to a set of rules configured for your Lightning node’s channels, within a budget of your choosing. The autoloop functionality is disabled by default and can be enabled by users and configured based on certain rules.

Autoloop can be configured to either acquire incoming liquidity using loop out or acquire outgoing liquidity using loop in. However, it cannot support automated swaps in both directions.

Liquidity targets

Autoloop can be configured to manage liquidity for individual channels, or for a peer as a whole. Peer-level liquidity management will examine the liquidity balance of all the channels you have with a peer. This differs from channel-level liquidity, where each channel’s individual balance is checked. Note that if you set a liquidity rule for a peer, you cannot also set a specific rule for one of its channels.

Liquidity thresholds

To set up the autolooper to dispatch swaps on your behalf, you need to set the liquidity balance you would like for each channel or peer. Desired liquidity balance is expressed using threshold incoming and outgoing percentages of capacity.

The incoming threshold you specify indicates the minimum percentage of your capacity that you would like in incoming capacity.

The outgoing threshold allows you to reserve a percentage of your balance for outgoing capacity but may be set to zero if you are only concerned with incoming capacity.

How Loops compare to churning

FeaturesLoopChurn
Adjust the amount of funds in LightningYesYes
Maintain stable channelsYesNo
Reduced fees with batchingYesNo
Transact easily between on-chain and Lightning as neededYesNo
Volume discountsYesNo
Comparing loops to channel open/close

Get the app

There you have it, another tool you can use to improve your Lightning experience and make your life a little easier and have fun with the Lightning network. If you’re new to the Lightning Network and you’re only getting started with your Lightning wallet or Lightning node and all the things you can and should do, it can be overwhelming but take your time to learn more about each app and why you would want it added to your bitcoin stack.

Applications like Lightning Loops should be one of the first on your list to explore because it impacts not only how efficient your non-custodial Lightning experience will be but also the hit you take on your pocket when managing your channels.

Running a Lightning node isn’t some passive income opportunity, and if you want to ensure that you’re not setting in the negative just to use Lightning, learning to use tools like loop, leverage submarine swaps and getting comfortable with channel management is going to be one of the skills you need to refine.

Sources:

If you want to learn more about Lightning Loop and dive down the rabbit hole, we recommend checking out the following resources.

Are you a bitcoin and lightning fan?

Have you been using Lightning to make micro-payments? Stream sats or engage with apps? Which app is your favourite? Have you tried all the forms of Lightning payments? Which one do you prefer? Let us know in the comments down below.

Disclaimer: This article should not be taken as, and is not intended to provide any investment advice. It is for educational and entertainment purposes only. As of the time posting, the writers may or may not have holdings in some of the coins or tokens they cover. Please conduct your own thorough research before investing in any cryptocurrency, as all investments contain risk. All opinions expressed in these articles are my own and are in no way a reflection of the opinions of The Bitcoin Manual

Related articles

You may also be interested in

Wumbo LN channels explained

What Are Wumbo Lightning Channels?

Bitcoin’s Lightning Network has reached significant milestones as it continues to provide bitcoin users with a scaling method ideal for micropayments and programmable payments. The

Sign up to our newsletter

Never Miss A Story

Get the latest bitcoin news, articles and resources.

Cookie policy
We use our own and third party cookies to allow us to understand how the site is used and to support our marketing campaigns.