Pay From Bitcoin Mainnet to Lightning and Back: Submarine Swaps Are Now Live
In order to make payments on the lightning network — Bitcoin’s second layer solution for instant and cheap transactions — users must first fund lightning channels. This process, however, creates a slight disconnect between lightning users and on-chain users. Lightning users can pay lightning users, and on-chain users can pay on-chain users, but they can’t pay one another directly.
To solve this, “Submarine Swaps” allow users to make trustless transactions between lightning addresses and on-chain addresses in either direction. The technology could be a game changer for both Bitcoin lightning and mainnet users, as it would remove the transaction barriers between them.
“[I] think this makes it a lot more attractive to [run] a lightning-only service,” Submarine Swap’s developer Alex Bosworth told Bitcoin Magazine, as on-chain users wouldn’t beexcluded. “You don't have to [...] worry about including the on-chain people,” he said. “You can outsource that to somebody else, and you don’t have to trust them.”
Using the same cryptographic tricks as those used in the lightning network, Submarine Swaps use a trustless middleman to link a Lightning channel transaction with an on-chain one. This middleman, likely a program called a swap provider, is tasked with settling both the on-chain and off-chain transactions with both users, bridging the gap between Bitcoin’s network and the lightning network.
If one lightning network user wants to send funds to an on-chain user, for example, the middleman will transfer these funds to its own lightning wallet, if (and only if) he sends a transaction with comparable funds on the Bitcoin
blockchain to the desired on-chain address. The process works the same in the inverse if an on-chain address wants to send funds to a lightning address.
“There's lots of different ways it can be used,” Bosworth said. “So let's say an
exchange wants to send to a lightning invoice but it doesn’t have lightning funds, or it doesn't have a lightning wallet; in that case, it could ask somebody who does have that to assist them, and then they could do so in a way where its locked to their on-chain unit.”
He continued to explain that the feature could ultimately be integrated into wallets, enabling an on-chain client “that doesn’t even know about lightning” to transact with its users.
Bosworth also pointed out that the swap providers could be the one and the same person. “It’s flexible in that respect. So you can have it be either a [third party] or it could even be yourself.”
When asked if the swapping mechanism would want for liquidity, Bosworth said that he believes transaction rewards will incentivize enough users to front their bitcoin for transactions. “[Users] are incentivized by the swap rate to provide liquidity, I think that will attract more liquidity. This is a low risk operation, so I can either have my coins just sit there doing nothing or I can have them available for swaps and generate some revenue,” he stated.
The Submarine Swaps concept was originally conceptualized by Lightning Labs CTO Olaoluwa Osuntokun — though Bosworth came up with the same idea independently. The technology can be applied in various use cases, as Bosworth envisions.
The technology is still in its infancy, as Bosworth explained, and it’s also contingent on the development of existing lightning network applications.
“I’ve started doing tests on mainnet, and you can try testing it out on Submarine Swaps so you can see a swap in action, but there’s lots of stuff to work out and the LND still needs work; they’re working on a major new release, so things are moving along but I wouldn’t say it's like super safe because not everything is 100 percent yet.”