Lightning Network & Layer 2

Lightning Loop Tutorial: Submarine Swaps

An orange braided cord forms a closed loop across a seam between maple and grey stone.

What Is Lightning Loop?

Lightning Loop is a service by Lightning Labs that enables submarine swaps between the Lightning Network and on-chain Bitcoin. In practical terms, Loop lets you move bitcoin between your Lightning channels and the blockchain without closing channels — solving one of the most common operational challenges for node operators.

Two operations form the core of Loop:

  • Loop Out: Sends sats from a Lightning channel to an on-chain address. This creates inbound liquidity in your channels while receiving bitcoin on-chain.
  • Loop In: Sends on-chain bitcoin into your Lightning channels. This creates outbound liquidity, replenishing depleted channel capacity.
Two swaps of 500,000 sats in a 1,000,000-sat channel. Loop Out, Lightning to on-chain: 500,000 sats plus fees leave your side of the channel, which drops from 900,000 to just under 400,000, and go to Loop over Lightning; Loop sends 500,000 sats back on-chain to your wallet, minus the mining fee for claiming them. You end up with more room to receive. Loop In, on-chain to Lightning: 500,000 sats leave your node's on-chain wallet, plus the mining fee, and Loop pays you 500,000 minus its fee over Lightning, so your side of the channel grows from 100,000 to just under 600,000. You end up with more room to send. The channel stays open either way; only the balance inside it moves.
Loop Out makes room to receive; Loop In makes room to send. Both are swaps with Lightning Labs’ Loop server: you give up sats on one layer and get them back on the other, minus fees, without closing the channel.

Both operations use submarine swaps — an atomic exchange mechanism that ensures either both sides of the swap complete or neither does. That protects the swap amount itself without any trust in Lightning Labs, provided that in a Loop Out your node’s claim of the on-chain coins confirms before the contract’s deadline. Fees already paid, and in a Loop Out a small prepayment the server collects at the start, fall outside that guarantee (see the FAQ below).

Why Submarine Swaps Matter

Without submarine swaps, the only way to rebalance your Lightning liquidity is:

  1. Close and reopen channels — expensive (two on-chain transactions), disruptive (loses routing capability during downtime), and slow (requires multiple confirmations).
  2. Circular rebalancing — sends a payment from your node back to yourself through other nodes. This works but has limitations: it requires sufficient routing paths, costs routing fees, and does not add new liquidity to the network.

Submarine swaps add a third option that is non-disruptive, adds real liquidity, and can be automated. For a thorough understanding of why liquidity management matters, see our guide on Lightning channel management.

Three ways to rebalance your liquidity. One, close and reopen: close a channel, wait, and open a new one with your sats; a new channel starts with everything on your side, so this gives you no room to receive. It takes two on-chain transactions, so two mining fees, and there is no channel until the new one confirms. Two, circular rebalance: pay yourself, out through one channel and back in through another; the channels stay open and you pay routing fees, but it needs a route and sats only move between your own channels. Three, a submarine swap: swap Lightning sats for on-chain bitcoin, or back; the channel stays open, you pay a swap fee and a mining fee, and you can automate it with Autoloop.
Only a swap keeps the channel open and changes how much you hold on Lightning. Closing and reopening leaves you without the channel for a while, and the new one starts with everything on your side; a circular rebalance only shifts sats between your own channels, so your totals stay the same.

Prerequisites

  • A running LND node, version 0.19.0-beta or later: Loop has required it since its v0.35.1 release in October 2026
  • Basic familiarity with the command line
  • At least one open Lightning channel with balance to swap
  • For a Loop In, on-chain funds in your LND wallet (a Loop Out pays into your LND wallet unless you give it another address)

If you run Umbrel, you can install Loop from the app store as part of Lightning Labs’ Lightning Terminal app, which also gives Loop a graphical interface. Otherwise, run it from the command line.

Installing Loop

Method 1: Umbrel App Store

  1. Open your Umbrel dashboard.
  2. Navigate to the App Store.
  3. Search for “Lightning Terminal” (by Lightning Labs). Loop is built into it.
  4. Click Install. The app automatically connects to your LND instance.
  5. Open Lightning Terminal from the Umbrel dashboard and choose Loop.

Method 2: Command Line Installation

  1. Download the Loop binary from the official Lightning Labs releases (v0.35.3-beta was the latest when we checked on 8 November 2026):
wget https://github.com/lightninglabs/loop/releases/download/v0.35.3-beta/loop-linux-amd64-v0.35.3-beta.tar.gz
tar -xzf loop-linux-amd64-v0.35.3-beta.tar.gz
sudo cp loop-linux-amd64-v0.35.3-beta/loop /usr/local/bin/
sudo cp loop-linux-amd64-v0.35.3-beta/loopd /usr/local/bin/
  1. Start the Loop daemon (it connects to your running LND instance):
loopd --network=mainnet
  1. Verify the connection:
loop terms

This command displays the current swap terms, including minimum and maximum amounts, fees, and timelock parameters.

Performing a Loop Out (Lightning → On-Chain)

Loop Out is the most common operation. It moves sats from your Lightning channels to an on-chain address, creating valuable inbound liquidity in the process.

Step 1: Check Current Terms

loop quote out --verbose 500000

This returns the estimated cost for looping out 500,000 sats. The output includes:

  • Loop service fee: The fee charged by Lightning Labs’ swap server. For a Loop Out, Lightning Labs publishes a range of 0.05% to 0.5% of the amount; where it lands depends on how long you can wait and on on-chain fees (checked 8 November 2026).
  • Estimated on-chain fee: The estimated miner fee for the on-chain transaction.
  • Estimated total fee: The service fee plus the on-chain fee; the routing fees for the Lightning payment come on top.

Step 2: Execute the Loop Out

loop out --amt 500000 --conf_target 6

Parameters:

  • --amt: Amount in satoshis to loop out.
  • --conf_target: Target number of blocks for on-chain confirmation. Higher targets mean lower on-chain fees. Use 6 for normal speed, 144 for next-day (lowest fees).
  • --addr (optional): Specific on-chain address to receive the funds, such as your cold storage. If omitted, Loop sends them to a new address in your LND wallet.

Step 3: Monitor the Swap

loop monitor

This streams real-time updates on your active swap. A Loop Out goes through four steps, and loop monitor shows the state named in capitals:

  1. Your node pays (INITIATED): Your node sends the Loop server two Lightning payments that together come to the swap amount plus Loop’s fee: a small prepayment, which the server collects before it locks any coins on-chain, and the rest, which it can’t collect yet, because it doesn’t know the secret the payment is locked to.
  2. Loop locks its coins (still INITIATED): The Loop server locks the swap amount on-chain in an HTLC (hash time-locked contract). Without --fast, it may wait up to 30 minutes first, to batch its on-chain transactions.
  3. Your node claims (PREIMAGE_REVEALED): Once the HTLC confirms, your node sweeps the on-chain funds to your destination address. The sweep reveals the secret, called the preimage.
  4. Loop collects (SUCCESS): The server uses the preimage to collect the swap payment, and the state changes to SUCCESS once your claim has confirmed. Your channel now has increased inbound liquidity.
A Loop Out of 500,000 sats in four steps that alternate between Lightning and the blockchain. One, on Lightning: your node pays Loop 500,000 sats plus its fee; Loop takes a small prepay at once, but can't collect the rest yet; it is held. Two, on-chain: Loop locks 500,000 sats of its own in an on-chain contract, an HTLC, that only your secret opens before a deadline. Three, on-chain: once the HTLC confirms, your node claims the coins to your address, which reveals the secret. Four, on Lightning: Loop uses the secret to collect the held payment, and the swap is done. loop monitor shows INITIATED for steps 1 and 2, PREIMAGE_REVEALED at step 3 and SUCCESS at step 4. If your node never claims the coins before the deadline, Loop takes them back, your held payment is cancelled, and Loop keeps the prepay.
Loop can’t collect your payment until your node has claimed its coins. Claiming reveals the secret that unlocks the payment, so your claim must confirm before the deadline, or Loop can end up with both. Unless you use --fast, Loop may wait up to 30 minutes before step 2, so that it can batch its on-chain transactions.

How long it takes depends mostly on --conf_target: Loop aims to have your claim confirmed within that many blocks from the start of the swap. With 6, that is about an hour, as a block comes about every 10 minutes on average.

Step 4: Verify Results

After the swap completes, check your channel balances:

lncli listchannels | jq '.channels[] | {chan_id: .chan_id, local: .local_balance, remote: .remote_balance}'

You should see reduced local balance (outbound liquidity) and increased remote balance (inbound liquidity) in the channel used for the swap.

Performing a Loop In (On-Chain → Lightning)

Loop In moves on-chain bitcoin into your Lightning channels, restoring outbound liquidity that has been depleted by spending.

Step 1: Get a Quote

loop quote in 500000

Step 2: Execute Loop In

loop in --amt 500000 --conf_target 6

Step 3: The On-Chain Payment

By default, Loop In pays the on-chain HTLC from your LND wallet itself and shows you its address, so you can follow it. To pay that address from another wallet instead, add --external (without --conf_target). Once the on-chain transaction confirms, the Loop server pays you over Lightning and your Lightning channel balance increases.

loop monitor

The Loop server pays you over Lightning once your on-chain transaction has one confirmation, so the wait depends on the fee rate you chose: a higher --conf_target costs less and takes longer.

Advanced Loop Features

Autoloop: Automated Liquidity Management

Autoloop is Loop’s automated mode that maintains your channel liquidity within specified thresholds. Instead of manually executing swaps, you define rules and Autoloop handles execution.

  1. Set liquidity rules for a specific channel:
loop setrule [channel_id] --incoming_threshold=25 --outgoing_threshold=25

This rule tells Autoloop to start a Loop Out (the default type) whenever the channel’s inbound liquidity falls below 25% of its capacity, without ever taking your outbound liquidity below 25%. Each swap aims for the midpoint between the two thresholds. For a rule that refills outbound liquidity with Loop In instead, add --type=in.

An Autoloop rule with an incoming threshold of 25% and an outgoing threshold of 25%, on a 1,000,000-sat channel. Before: 900,000 sats are on your side and 100,000 on your peer's side, so inbound is 10%, below the 25% trigger. Autoloop loops out 400,000 sats. After: about 500,000 on each side, inbound at about 50%, halfway between the two thresholds. Autoloop never takes your side below its 25% floor. It acts only once you turn it on, and stays within your fee budget.
A 25/25 rule loops out when inbound falls below 25%, and aims for halfway. It never takes your side below 25%. A rule with --type=in works the other way round: it refills your side with a Loop In when your outbound falls below its threshold.
  1. Configure Autoloop parameters:
loop setparams --autobudget=50000 --autobudgetrefreshperiod=168h --feepercent=1

Parameters:

  • --autobudget: Maximum sats to spend on swap fees per budget period.
  • --autobudgetrefreshperiod: How often the budget resets (168h = weekly).
  • --feepercent: Maximum share of each swap’s amount that all its fees together may take, in percent. On a 500,000-sat swap, 1% is 5,000 sats.
  1. Enable Autoloop:
loop setparams --autoloop=true
  1. Check Autoloop status:
loop suggestswaps

This shows which channels would trigger swaps under your current rules.

Loop with Lightning Terminal

If you prefer a graphical interface, Lightning Labs’ Lightning Terminal (the Umbrel app from Method 1) has Loop built in:

  1. Open Lightning Terminal and click Loop at the top. It shows your channels and their balances.
  2. Slide the bar to the left for a Loop Out, or the other way for a Loop In. You can also pick the channels to empty or refill.
  3. Choose the amount with the slider and select Loop. You’ll see the fees before you confirm.
  4. Under the additional options, set the confirmation speed (more blocks, lower fees) and, for a Loop Out, an address such as your cold storage.
  5. Click Submit and follow the swap’s progress.

Lightning Terminal can also set up Autoloop, with a fee budget per day, week or month. ThunderHub has no Loop integration: its swap page ran on Boltz, which is offline (see Loop Alternatives below).

Fee Optimization Strategies

Loop fees consist of three components: the swap server fee (paid to Lightning Labs), the on-chain miner fee and, for a Loop Out, the routing fees of the Lightning payment. For a broader understanding of how fees work across the network, see our Lightning Network fees complete guide. You can lower the cost in several ways:

What a 500,000-sat Loop Out costs, following the money. Your payment leaves your node over Lightning and crosses other nodes, which keep routing fees; --max_swap_routing_fee caps them, and they are not in the quote's total. Loop keeps its service fee, which it sets for each swap; it rises with on-chain fees, and --fast can cost more. Loop locks the coins in an on-chain contract, an HTLC, and your node claims them to your wallet, paying a mining fee to miners: a higher --conf_target is cheaper but slower, and the fee is about the same for any amount. The prepay is not a fee: it counts toward the 500,000, unless the swap fails because your node never claimed Loop's coins. Bigger, less frequent swaps spread the mining fee over more sats.
Three fees, paid at three points along the way. Loop’s quote shows its service fee and the mining fee; the routing fees for the Lightning payment come on top. The mining fee is the one you control most.
  • Use high conf_target values: Setting --conf_target 144 targets next-day confirmation, substantially reducing the on-chain fee. For non-urgent liquidity management, this saves significant sats.
  • Leave out --fast: Without it, the Loop server may wait up to 30 minutes before publishing the HTLC, to batch its on-chain transactions, and that can mean a lower swap fee.
  • Monitor on-chain fees: Execute loops during weekend or early-morning low-fee periods. Check mempool conditions before initiating swaps.
  • Right-size your swaps: The miner fee for claiming the coins is about the same whatever the amount, so very small swaps are proportionally expensive. Swapping 500,000+ sats per operation is more cost-effective than frequent small swaps.

Loop Alternatives

Loop is not the only submarine swap provider. Understanding alternatives helps you choose the best tool for your situation:

ServiceProviderMin SwapTypical FeeIntegration
Lightning LoopLightning LabsAbout 250,000 sats for Loop Out (see loop terms)0.05-0.5% out, 0.1-1% inLND native
PeerSwapCommunityVariableOn-chain fees plus the peer’s premiumCLN plugin, LND daemon

Boltz, a non-custodial swap service between Lightning, on-chain Bitcoin and Liquid, used to be the usual choice for smaller swaps from any wallet, with lower minimums than Loop and no account. It switched off all its swaps on 3 August 2026 and was still offline when we checked on 8 November 2026, so it is no longer in the table. Tools that used it have moved on: RTL removed its Boltz pages in October 2026, and ZEUS now runs its built-in swaps through other providers that use Boltz’s open-source software. If your wallet has a swap built in, check that it works and try a small amount first.

PeerSwap enables direct atomic swaps between channel peers without a third-party server. It is the most trustless option, but your channel counterparty must also run PeerSwap and allow swaps with you. It runs as a plugin for CLN and as a separate daemon next to LND, and is still beta software. Besides the on-chain fees, the peer can ask for a premium: by default 0.2% when you swap out and nothing when you swap in (PeerSwap v7.0.2, checked 8 November 2026).

Troubleshooting Common Issues

Swap Stuck in “Initiated” State

The on-chain HTLC has not been published. Without --fast, the Loop server may wait up to 30 minutes before publishing it, to batch its on-chain transactions, so give it that long. If the swap does not progress, it will time out and cancel automatically. Your swap amount is safe — the atomic swap protocol ensures the main payment is either completed or returned. The small prepay is the exception: the server collected it at the start of the Loop Out, and the atomic swap does not protect it, so it may not come back if the swap stalls.

High Quoted Fees

Loop fees increase during periods of high demand and high on-chain fees. If the quote seems expensive, wait for lower on-chain fee conditions or use a higher conf_target. If your wallet has its own swap, compare its quote too.

“No Suitable Channels” Error

Loop Out requires a channel with sufficient outbound balance to fund the swap. If no single channel has enough capacity, reduce the swap amount or rebalance your channels first using circular rebalancing before looping.

Part of our free Bitcoin course: This topic is covered in depth in Running a Lightning Node: Earning Sats and Supporting the Network from the Lightning Network & Bitcoin Nodes course.

FAQ

Can I lose funds during a Loop swap?

Your swap amount is protected, with one exception in a Loop Out. Submarine swaps use hash time-locked contracts, so a swap that fails before its secret is revealed is cancelled, and your swap amount returns to where it was. In a Loop Out, your node’s claim reveals the secret, so Loop can collect your payment at once; if the claim then fails to confirm before the contract’s deadline, Loop can also take its coins back, and you lose the swap amount. loopd raises the claim’s fee as the deadline nears and won’t start a claim in the last 20 blocks before it, so keep it running until the swap completes. Two smaller things also fall outside the protection. In a Loop Out, the small prepay goes to the server at the start: Loop keeps it if it has locked its coins on-chain and your node never claims them before the deadline, and it may not come back if the swap is abandoned earlier. And fees already spent, such as the mining fees of a swap that gets refunded, don’t come back.

How much does a typical Loop Out cost?

Run loop quote out --verbose 500000 for the current price. Lightning Labs publishes a range of 0.05% to 0.5% of the amount for a Loop Out (checked 8 November 2026), so on 500,000 sats the service fee is between 250 and 2,500 sats. On top come the mining fee for claiming the coins, which depends on the mempool and your confirmation target, and the routing fees of the Lightning payment. In Lightning Labs’ own worked example, a 300,000-sat Loop Out cost 500 sats in service fee, 416 sats in mining fee and 1,153 sats in routing fees.

Is Loop available for Core Lightning nodes?

Lightning Loop is designed for LND and does not natively support CLN. On CLN, PeerSwap (beta software that runs as a CLN plugin) gives similar liquidity management, but only with channel peers who also run it. Boltz, which worked with any Lightning implementation, has been offline since 3 August 2026 (checked 8 November 2026). Without a swap, closing a channel moves its balance on-chain, at the cost of the channel and a mining fee.

How often should I run Loop operations?

Frequency depends on your payment volume and channel usage patterns. High-volume routing nodes might loop weekly. Personal spending nodes might loop monthly or less. If you use Autoloop, the system handles timing automatically based on your configured thresholds. Monitor your channel balances and swap when channels become unbalanced enough to affect your routing or spending capability.

Filed under: Lightning Network & Layer 2
← Back to All Articles