Crypto glossary
Submarine swap
A submarine swap trustlessly exchanges on-chain bitcoin for Lightning funds, or the reverse, using a hash lock shared by both payments.
The swap links an on-chain transaction and a Lightning payment with the same secret. In a swap into Lightning, the user sends bitcoin to an on-chain HTLC that the swap provider can claim only by revealing a preimage; the provider learns that preimage by paying the user's Lightning invoice. Either both legs complete or the user's on-chain funds are refunded after a timeout. Swaps out of Lightning work the other way round.
Submarine swaps, first described in 2018, are a workhorse of Lightning liquidity management. Merchants use swap-outs to move incoming Lightning payments to cold storage and free up inbound capacity; users top up wallets from on-chain funds without opening a new channel. Services such as Lightning Loop and Boltz offer them, and some wallets integrate them seamlessly.
Swaps cost an on-chain fee plus the provider's fee, and they take at least one on-chain confirmation, so they are slower than pure Lightning payments. The provider cannot steal funds, but a failed swap ties up coins until the timelock expires. Linking on-chain and Lightning activity in this way can also reduce privacy.
Example
A shop that receives many Lightning payments swaps 0.05 BTC out to an on-chain address each week, moving the money to cold storage and restoring inbound liquidity in its channels.
