Submarine Swap
A Lightning Network mechanism that trustlessly swaps on-chain funds for off-chain Lightning funds, or vice versa, using the same hashed-timelock structure as a Lightning payment.
A submarine swap lets a user convert funds between the Bitcoin base chain and the Lightning Network, a payment channel (see Kaavon's "Payment Channel" glossary definition) based Layer 2 scaling system, without needing to open or close a Lightning channel themselves. It works by using the same hashed-timelock contract structure that secures ordinary Lightning payments, so a swap service can accept an on-chain payment and route an equivalent off-chain Lightning payment (or the reverse) while cryptographically guaranteeing neither party can walk away with funds without completing their side.
This is conceptually related to an atomic swap (see Kaavon's "Atomic Swap" glossary definition), since both rely on a hashed-timelock mechanism to make an exchange all-or-nothing, but a submarine swap specifically moves funds between the on-chain and off-chain layers of the same asset, rather than exchanging two different assets. Submarine swaps are commonly used to let a Lightning wallet receive an on-chain deposit or make an on-chain withdrawal without the user needing to manage channel liquidity directly.
Examples
- A Lightning wallet might use a submarine swap behind the scenes to let a user deposit funds from an on-chain address directly into their Lightning balance.
- Unlike opening a new Lightning channel, a submarine swap doesn't require the user to lock funds into a new channel or manage its ongoing liquidity.