Submarine Swaps Explained: Pay From Bitcoin Mainnet To Lightning and Back

lightningnetwork
mainnet
submarineswap

#1


via capt

By now you have probably heard of atomic swaps, a Lightning Network-related technology looking create interoperability between Bitcoin and every other altcoin on the market. Swaps technology is in itself focused on trustlessly exchanging, “swapping” various types of data, in our case cryptocurrency. And while Lightning Network, the off-chain solution for instant and cheap transactions, allows users to swap cryptocurrencies, this transfer is done by funding the lightning channels.

This means that Bitcoin wallets aren’t compatible with Lightning addresses. Lightning users can send crypto to lightning users, and on-chain users can send Bitcoin to other on-chain users, but they can’t pay eachother directly. This prompted Alex Bosworth, infrastructure lead working for Lightning Labs, to look into the atomic swaps technology and ultimately come up with a concept which was named submarine swaps .

Submarine swaps work on a principle similar to what we have with atomic swaps. This technology uses a trustless middleman to link a Lightning channel transaction with an on-chain one and perform seamless cryptocurrency swaps. This can solve two problems that are currently plaguing the Lightning Network/Bitcoin interactions:

  • Solves the problem of sending cryptocurrency from LN to Bitcoin blockchain
  • Solves the issue of having to set up Lightning Network channels (which required an on-chain transaction to be made and a subsequent fee to be paid) and having to fill them up with pre-set amounts of BTC

As noted above, opening up a new LN channel requires both paying a fee and locking up a set amount of cryptocurrency in said channel. Once this set amount of cryptocurrency leaves the channel, the channel cannot be refilled and the user needs to open a new channel if he wants to send more cryptocurrency. That of course means more fees, more transactions and more expenses for both the user and the blockchain.

This is where submarine swaps come to shine. The technology allows the user to refill a LN channel by making an on-chain transfer of funds. No more extra transactions, no more extra fees, no more extra blockchain bloat.

Submarine swaps (and swaps in general) basically employ what we call a trustless swap provider. This means that when sending cryptocurrency from the Bitcoin blockchain to the off-chain LN channel, the following happens:

  • User sends their on-chain BTC to the submarine swap service contract with an LN invoice
  • Swap provider pays the LN invoice (if not paid in time set in the contract the user can reclaim his crypto)
  • Once the invoice is paid, the LN channel is funded with the amount equal to the original BTC sent

Besides allowing us to refill existing LN channels, submarine swaps have another important feature. With submarine swaps, only one side needs to have the LN enabled to facilitate a transfer. This means that funds can be transferred from/to chains that aren’t LN enabled if the other side has LN capabilities. Such swaps have been previously attempted and accomplished.

Submarine swaps are currently in live testing on the lightning network and the developers point out that the technology is still in its early stages. This means that it isn’t recommended to attempt moving large amounts of value with submarine swaps. Successful Litecoin and Ethereum swaps with BTC have already been completed thanks to this technology, indicating its full potential for everyone to see. It remains to be seen if said potential will be fulfilled.