LearnBitcoin

Glossary

Atomic Swap Refill

Using a swap between Lightning and on-chain bitcoin to refill one side of a Lightning channel without closing it. The channel's total capacity stays the same.

Atomic swap refill means using an atomic swap to refill a Lightning channel that has run low on one side, instead of closing it and opening a new one. One leg of the swap is a Lightning payment and the other is an on-chain payment, and both are locked to the same secret, so either both go through or neither does. A swap between Lightning and on-chain bitcoin is called a submarine swap.

Take a routing node. A channel's capacity is set when it is funded and is split between the two sides. As payments are routed, the split drifts, and once one side runs dry the channel can't carry payments in that direction. A swap moves the split back:

  • Swap in. The node sends on-chain bitcoin and is paid back over Lightning, which adds to its own side of the channel, so it can send again. Lightning Labs calls this Loop In.
  • Swap out. The node pays out over Lightning and gets on-chain bitcoin back, which frees up room on the other side, so it can receive again. Lightning Labs calls this Loop Out.

Either way the channel's total capacity stays the same, and only the split changes. Changing the capacity itself takes splicing or a new channel. A swap also doesn't avoid the chain: PeerSwap's protocol, for example, uses two on-chain transactions per swap, one that locks the coins and one that claims them. One way to rebalance that does stay off-chain is a circular payment to yourself through other nodes, which has costs of its own.

Practical implementations:

  • Swap services. Lightning Labs' Loop is one. It uses submarine swaps and doesn't take custody of the funds.
  • PeerSwap. Two nodes that share a channel swap directly with each other, with no outside service. The on-chain leg can run on Bitcoin or on the Liquid sidechain. After the September 2026 security incident on Liquid, PeerSwap's v7.0.1 release stopped accepting new Liquid swaps, and its project page still said so in October 2026.

The on-chain payment is locked with the same hash as the Lightning payment, the HTLC pattern Lightning uses for routing. Settling one side reveals the secret, and the secret then unlocks the other side. If the swap stalls, a timelock lets whoever locked the on-chain coins take them back.

Swaps cost money. The on-chain transactions pay mining fees, and the other side can charge for the swap. Lightning Labs' liquidity guide makes the same point about rebalancing in general: it shouldn't cost more than the channel has earned from routing since the last time.

Key takeaways

  • Moves balance from one side of a Lightning channel to the other
  • Needs on-chain transactions, on Bitcoin or, with PeerSwap, on Liquid
  • Changes how a channel's funds are split, not its total capacity

Corrected

  • Was: The entry said atomic swap refill let a routing node move balance between two of its channels through a swap with another node, restoring routing capacity without an on-chain transaction, and it described the technique as shifting channel capacity.

    Now: The swaps it covers, such as Loop In, Loop Out and PeerSwap, need on-chain transactions, on Bitcoin or, with PeerSwap, on Liquid; PeerSwap's protocol uses two per swap. They move balance from one side of a channel to the other, and the channel's total capacity stays the same. One way to rebalance that does stay off-chain is a circular payment to yourself through other nodes. Details

Sources (6)

Related terms (4)

Published . Revised . One correction logged for this page.

Edit this page on GitHub