Autoloop: Lightning Liquidity You Can Set and Forget!

Carla Kirk-Cohen
November 24, 2020

We are excited to announce Autoloop, a new feature in Lightning Loop that allows Loop users to automatically balance liquidity, saving time and making using bitcoin on Lightning more efficient. Now users can set liquidity and fee preferences, keeping Lightning channels balanced and budgets intact.

The introduction of Autoloop marks an important step in the evolution of liquidity automation on Lightning. To get started, update to the latest version of Loop today.

How It Works

With Autoloop, users set the percentage of inbound capacity each of their channels require, specify their fee budget limitations, and leave the client to take care of the rest.

Autoloop will periodically assess a channel's balances and execute a Loop Out swap for channels that have dropped below their required inbound percentage. (And for those looking to add funds to a Lightning channel, Loop In support is coming soon.) Autoloop’s fine-tuned fee settings allow lower-time-preference loopers to configure the client with a low fee-rate, so that it will only perform swaps when on-chain fees are low.

Autoloop is a new feature, so please use caution when experimenting and send us your feedback. We look forward to building out this feature with the community to best serve routing node operators. Check out our existing feature list issue to provide feedback, or reach out to us on Github or Slack. We hope Autoloop will eventually reduce the time required manually managing nodes, letting users spend more time dreaming of perfectly balanced nodes!


Autoloop is easy

Getting Started

Getting started with Autoloop is easy. Simply set a channel rule that defines the minimum percentage of inbound and outbound liquidity for each channel you’d like to keep balanced. Every 10 minutes Autoloop will examine the channel’s liquidity balance and rebalance the channel to meet your predefined liquidity preference.

Consider the example of a channel with the majority of its capacity as outbound capacity:


An unbalanced channel.
A 200k sat channel with only 5% of its capacity available for receives.

To maintain a minimum of 40% of your overall channel capacity as inbound capacity and a minimum of 20% as outbound capacity, set it as a rule:


Set channel rules with setrule.

Autoloop will target a midpoint between the incoming and outgoing minimum thresholds:


Autoloop calculates swap amounts.
Autoloop calculates a target balance between configured thresholds.

And a Loop Out will be automatically initiated to rebalance the channel:


Autoloop rebalances a channel.
The new channel liquidity balance once the automatically dispatched swap has completed.

It’s as simple as that! No further action will be taken until the channel’s liquidity balance drops below the predefined thresholds.

Additional Features

Autoloop can also be used to reduce on-chain fees when Looping Out. Loop Out swaps acquire inbound liquidity by pushing funds out on a channel to the Loop server, and trustlessly reclaiming these funds on-chain with a sweep transaction. Autoloop uses the sweepconf parameter to set the confirmation target for this transaction. To keep on-chain fees as low as possible, we recommend setting a high confirmation target (up to 250 blocks):


Set confirmation target with sweepconf.

The on-chain fee market can be volatile, so the fee estimate for a 250 block target can vary over time. To make sure that Autoloop only dispatches swaps in low-fee environments, use sweeplimit to set the maximum allowable miner fee rate:


Set fee preference with sweeplimit.

With Autoloop, users set a budget to limit fees paid in order to keep the channel balanced. Fees include server fees, on-chain miner fees, and off-chain routing fees. The total spend is determined by adding up all the fees incurred after the budget start date. To set a budget, define the budget and start date:


Set budgets for autoloop.

Want a monthly budget? Just update the start date to the first of the month to refresh your budget.

Conclusion

Running a business or routing node on Lightning shouldn’t keep you up late at night. We hope Autoloop reduces time spent manually balancing channels, making Loop and Lightning even easier to use.

Autoloop is highly customizable, and you can read more about how to configure your Loop client in our documentation. We look forward to collaborating with the community to iterate on this feature, so we’d love to hear from you on Github or Slack.

About the authorCarla Kirk-Cohen

Carla started working on Bitcoin as a member of the crypto-ops team at Luno, a South African Exchange and Wallet. During her time there she led a project integrating Lightning Network sends and receives, which is when her interest in the Lightning Network began. She attended the 2019 Chaincode Labs Summer Bitcoin residency, where she learned about Bitcoin and Lightning and contributed to LND. She is excited about building infrastructure for the Lightning Network to make it easier to participate in a decentralized, private payments system.

Carla started working on Bitcoin as a member of the crypto-ops team at Luno, a South African Exchange and Wallet. During her time there she led a project integrating Lightning Network sends and receives, which is when her interest in the Lightning Network began. She attended the 2019 Chaincode Labs Summer Bitcoin residency, where she learned about Bitcoin and Lightning and contributed to LND. She is excited about building infrastructure for the Lightning Network to make it easier to participate in a decentralized, private payments system.