Lightning Network getting popularity from the day of launch and a lot of developments and improvements happening to make LN easy to use and scalable.
In this article, you will learn about one of its important feature known as submarine swaps. How do submarine swaps work? and the applications of submarine swaps.
2 What Are Submarine Swaps?
The concept of Submarine swaps is first proposed by Lightning Labs CTO Olaoluwa Osuntokun and Lightning Labs Infrastructure Lead Alex Bosworth.
In starting, the main goal of developing submarine swaps is to perform the transfers of BTC from the On-chain to the Off-chain Lightning network but now it is also used to perform the transfers between other cryptocurrencies also like LTC from on-chain to Btc on off-chain and vice versa.
Submarine swaps are very useful as only one side needs to be lightning enabled whereas in atomic swaps both sides must be lightning enabled for cryptocurrencies.
Visit https://submarineswaps.org/ to perform submarine swaps.
Check Github – Swap Services
3 How Do Submarine Swaps Work?
When someone wants to use the Lightning network then the LN channel must be set up with some other node on LN by sending an amount of BTC to the channel from on-chain
The main problem arises when your funds on the LN channel run out then you cannot refill your channel directly and you need to open another new channel in order to use LN again by paying an on-chain transaction fee in order to send BTC to the channel.
Also, you can do an unlimited number of transactions on the lightning network until your funds run out on the LN channel. Continuously opening multiple channels is not a convenient and efficient way as it cost more on-chain transaction fee.
So the submarine swaps are introduced in order to overcome the problem of refilling the LN channel with BTC without opening a new channel every time when you run out of funds on the old channel.
Submarine swaps allowed users to send BTC from on-chain blockchain address and to receive BTC on the off-chain lightning network. It is very helpful to refill the lightning channel from on-chain BTC directly and there is no need to open or set up the LN channel every time when you run out of funds.
Submarine swaps provide a trustless intermediary for transferring Cryptocurrencies from on-chain blockchain to the off-chain lightning network and vice versa.
This is practised by leveraging hash-time locked contracts in which the receiver of a transaction needs to acknowledge the payment receiving before a given specific deadline by providing cryptographic proof of payment. If it is not done honestly, then the receiver gets the financial penalty by losing the ability to claim the tokens, and they are returned to the payer.
For example, Let Monty is using LN for a long time and now his LN channel is run out of funds as he spends all the funds on the LN. Now he wanted to refill that old channel with more BTC in order to use LN again with the same channel. So he used submarine swaps for this purpose.
There is another user Naveen already using the lightning network and have enough funds on the lightning network.
Naveen wanted to transfer his funds from off-chain LN to on-chain without closing the lightning channel. So Naveen used submarine swaps for this purpose.
Now Monty wanted to send funds from on-chain to off-chain LN and Naveen wanted to send funds from off-chain LN to on-chain.
So both used submarine swaps for this as Monty sends his on-chain BTC to the Naveen on-chain BTC address and Naveen sends his off-chain LN BTC to the Monty off-chain LN address through the submarine swaps.
This is how Submarine Swaps works in a non-technical way.
You can also check the technical explanation of How do Submarine Swaps work by Torkel Rogstad.
Currently, only one-way functionality of submarine swaps is live as users can only send from on-chain bitcoin address to the off-chain lightning network. But developers are working to develop two-ways functionality where users will also able to send from off-chain lightning network to the on-chain bitcoin address.
Lightning developers also working to develop the functionality in which users can send LTC from on-chain and can receive BTC on off-chain in exchange. So the submarine swaps are still under development.
4 Applications Of Submarine Swaps
Submarine swaps act as a useful tool for the filling of channels with cryptocurrency on the lightning network without creating the new ones.
There are some most important applications and uses of the submarine swaps as follows:
- Cross Chain Transfers: As the submarine swaps required only the one party to be lightning enabled for exchange cryptocurrency, so it makes it possible to execute the cross-chain transfers with those chains that are not enabled with the lightning network until the opposing side enabled with the lightning network.
- Swaps Between Different Blockchains: Lightning network developers already tested the submarine swaps between different blockchains of different cryptocurrencies. An on-chain Litecoin swap to off-chain Bitcoin LN functionality is successfully build-out by the developer Jason Wong. Finally, this submarine swap from on-chain LTC to off-chain LN BTC is available to use for everyone on the Submarine Swaps contract.
Not only LTC but recently the developer Jason Wong also proposed an on-chain Ether to off-chain LN BTC transaction by successfully testing it using the Ethereum’s Rinkeby testnet. You can also check out the full guidelines provided by the Wong on how to swap between Ethereum and a BTC Lightning channel.
- Lightning Decentralised Exchange: As the submarine swaps can be used for doing transactions between different blockchains of different cryptocurrencies with only one side required lightning enabled and with no third-party involvement, so it can be easily possible to create a lightning decentralised exchange.
The technology of the submarine swaps is still under development and is in its early stages. So there is risk involving while using this technology at the current stages.
There is a great risk involving especially for large transactions swaps.
Also, the submarine swaps integrated with the lightning network and the lightning technology is also in its early stages but the developers are working hard and made great progress with healthy results so far.
The submarine swaps are the one of the important innovation of the lightning developers that provide a trustless mechanism to transfer cryptocurrencies from on-chain blockchain to off-chain lightning network as well as for doing cross-chain transfers between different blockchains.
Submarine swaps open the door for the wide adoption of the lightning network as well as for public blockchains and decentralized exchanges throughout the world.
Finally, it solves the problem of refilling of the lightning channels with cryptocurrency and there is no need to set up new lightning channels every time in case of running out of funds.