Submarine swaps are atomic on-chain to off-chain swaps (and vice-versa) of cryptocurrencies. Conceptualized by Lightning Labs CTO Olaoluwa Osuntokun and Lightning Labs Infrastructure Lead Alex Bosworth, they are designed to facilitate the transfer from on-chain BTC to an off-chain Lightning Network (LN) channel. Currently, this is not directly possible without submarine swaps and requires an additional step where a user has to transfer LN funds to their on-chain Bitcoin wallet.

Submarine Swaps

Described as “on-chain ramps to the LN,” submarine swaps have several profound use cases and potential implications. Unlike atomic swaps — where LN needs to be enabled on both cryptocurrencies participating in an exchange — submarine swaps only need one side to be lightning enabled. As such, the future application of submarine swaps could see them becoming a vital infrastructure for decentralized exchange across various blockchains.

How Do They Work?

The primary problem that submarine swaps address is that transactions between on-chain Bitcoin addresses and off-chain LN addresses are not directly compatible. This creates a transaction barrier between the Bitcoin blockchain and the off-chain LN.

An additional limitation of the current LN implementation is that setting up an LN channel requires an on-chain transaction (and subsequent fee) as well as a prefilled amount of BTC sent to the channel. Once that supply of BTC in the channel runs out, there is no method to refill the channel, and another channel needs to be opened. This costs more on-chain transaction fees, and although essentially unlimited transactions can be sent within an LN channel as long as there is enough BTC, it is inconvenient and inefficient to repeatedly open multiple channels.

Bitcoin Lightning Network

Read: Lightning Network: the 2nd Layer, Off-Chain Scaling for Bitcoin



Submarine swaps provide a solution to this problem by allowing LN channels to be refilled through an on-chain transfer from the Bitcoin blockchain to the off-chain LN channel. Submarine swaps are derived from atomic swaps so they work with similar functionality.

Submarine and atomic swaps utilize a trustless intermediary for transferring tokens between blockchains or intra-chain (i.e., Bitcoin on-chain to off-chain LN). This is accomplished by leveraging hash-time locked contracts where the receiver of a transaction needs to acknowledge receiving the payment before a specific deadline by providing a cryptographic proof of payment. If not, the receiver forfeits the ability to claim the tokens, and they are returned to the payer.

Atomic Swaps

Read: What Are Atomic Swaps?

The best example of how this works in a submarine swap is from a transfer from the Bitcoin blockchain to an off-chain LN channel, which is currently the one-way functionality of submarine swaps that is live. Submarine swaps employ a “swap provider” as the trustless intermediary.

A user sends their on-chain BTC to the submarine swap service contract with an LN invoice, where the swap provider pays the off-chain LN invoice. If the invoice is not paid within the specific hash time-locked contract, then the payer (on-chain address) can reclaim the initial on-chain BTC sent. The preimage in the swap contract is used by the swap provider as proof of payment to claim the on-chain BTC at the swap address. The swap provider will not know the preimage unless the LN invoice is paid. The result is that the funds are reimbursed to the payer if the invoice is not completed. If it is successful, then the LN channel is funded with the amount corresponding to the on-chain BTC sent.

The process works the same way for an inverse transaction from an off-chain LN channel to an on-chain Bitcoin address. However, this functionality is still in development and is not an available option on the submarine swaps contract yet.

Insufficient liquidity may be a potential problem for submarine swaps, particularly in its early stages. However, the swap rate provides an incentive for on-chain users to front their BTC for swap transactions, earning a fee for doing so rather than letting it sit in their wallet. Swap providers can technically even be the payer in a transaction, making the swap process very flexible.

Application, Further Development, and Future Implications

Submarine swaps provide an effective tool for the previously mentioned problem of refilling LN channels without having to open new channels continually. At first glance, this is the most practical use case in its current iteration. However, due to the nature of submarine swaps only needing one side of the transfer to be LN enabled, submarine swaps are capable of facilitating cross-chain transfers with chains that aren’t LN enabled, as long as the opposing side is LN enabled.

Submarine swaps between different blockchains have already been successfully attempted. Developer Jason Wong successfully forked the submarine swap project and built-out the functionality to achieve an on-chain Litecoin swap to off-chain Bitcoin LN. The swap from on-chain LTC to off-chain LN BTC is now available on the Submarine Swaps contract.

More recently, Wong successfully tested an on-chain Ether to off-chain LN BTC transaction using Ethereum’s Rinkeby testnet. Essentially, items that were priced in lightning could be purchased with ETH by leveraging the swap provider as an Ethereum smart contract which is deployed on the testnet here. Wong also provides a step-by-step guide on how to swap between Ethereum and a BTC Lightning channel.

Wong’s work demonstrates the potential of submarine swaps in becoming an integral component of the proliferation of decentralized exchanges. Only a few cryptocurrencies have LN capabilities enabled. With atomic swaps, a future of blockchains swapping assets would require that capability be built into any participating blockchain, which is challenging and time-consuming. Conversely, submarine swaps only need one side of the transaction to LN enabled, vastly extending swap support to numerous cryptocurrencies.

Eventually, a future of two-way compatible submarine swaps between various blockchains could provide the necessary infrastructure for genuinely trustless exchange of tokens and assets between blockchain networks. That is the goal sought by many cryptocurrency community participants, and while it may be a while before that point is reached, submarine swaps offer some promising advance towards that end.

Bosworth and other developers working with submarine swaps identify that the technology is still in its early stages, so it is risky to use at this point — particularly for large transfers. Submarine swaps will develop in parallel with the Lightning Network, which is also in its early stages but has made some meaningful progress so far.

Conclusion

Submarine swaps are another clever and innovative mechanism for trustlessly transferring tokens. They bridge the transaction barrier between on-chain transactions and off-chain LN channels that will be vital to the future scalability of public blockchains and decentralized exchanges. Eventually, submarine swaps may help provide the utopian future of interchangeable assets across trust-minimized networks.

Posted by Brian Curran

Blockchain writer, web developer, and content creator. An avid supporter of the decentralized Internet and the future development of cryptocurrency platforms.


All content on Blockonomi.com is provided solely for informational purposes, and is not an offer to buy or sell or a solicitation of an offer to buy or sell any security, product, service or investment. The opinions expressed in this Site do not constitute investment advice and independent financial advice should be sought where appropriate.

Leave a reply

Your email address will not be published. Required fields are marked *