Submarine swaps are an important feature of the lightning network. They allow lightning users to swap funds on lightning for funds on the base layer, or vice versa, without needing to open and close channels, and without needing to give custody of their money to other people. They also allow easier channel rebalancing and they are also the basis for important wallets and services like muun, lightning loop, and boltz exchange.
However, there are not very many submarine swap providers. Sometimes I wonder if the ones who exist are overcharging, and I also just think it would be cool if anyone could profit by offering submarine swaps easily from their own lightning node. With lots of participants, costs may be driven down close to zero.
Swap service tries to be an easy tool for anyone to do that.
Yep. Projects of this kind could also become sort of giant mixers, allowing anons to swap coins or to directly pay in a really private way if the liquidity is enough and not to concentrated.
Do you plan to make it more pleb friendly one day ? Like kind of an Umbrel app for anyone to be able to easily connect to their own LN node and quickly add liquidity ?
And other question, does it work both ways reverse submarine swaps and submarine swaps as well, or just LN-->on-chain ? I think their may be a trust issue for on-chain -->LN swaps but I'm not sure.
Yep. Projects of this kind could also become sort of giant mixers
Yes I'd love to see a privacy focused version someday. If you use musig-based submarine swaps instead of segwit-based htlcs then the cooperative case looks like a regular bitcoin transaction, except the two parties swap their utxos. Which is awesome for privacy.
Do you plan to make it more pleb friendly one day ? Like kind of an Umbrel app for anyone to be able to easily connect to their own LN node and quickly add liquidity ?
I don't personally plan to submit it as an umbrel app but it's public domain software. If it grows in popularity I expect that someone will make an umbrel app for it, which I would love to see.
other question, does it work both ways reverse submarine swaps and submarine swaps as well, or just LN-->on-chain ?
This is an interesting question. Technically it works both ways because every submarine swap from Alice's perspective is a reverse submarine swap from Bob's perspective. In other words, if you want to buy sats on the base layer, use the website, and if you want to sell sats on the base layer, run the software. Technically that means it supports both.
But I definitely want to update it so that people who run the software can also post offers to buy sats on the base layer and pay a lightning invoice in return. Then I can make a clone of muun wallet but based on a distributed network of coordinators (i.e. everyone running this software) rather than relying on a single company to do all the swaps.
this is amazing and something I was imagining would be cool to build.
You went and did it.
LL just shit their pants because this is basically a better and end-to-end open-source and decentralized Loop!
Yeah a zero day exploit was discovered by Boltz Exchange so I borked the code til I fix it, which will hopefully be a matter of minutes (it's a very small bug, I neglected to validate the size of the lightning preimage, which means you can submit an invalid one and the service provider will treat it as valid -- but checking the size should be a very simple code change)
Great concept, I am sure it will see a lot of use!
What I find most tricky is managing the onchain fee.
Using the minimal fee is good for the Maker, but not suitable for the Taker.
As required by the submarine swap model there are two transactions:
first the Maker deposits to the swap address - this can be a minimal fee transaction, but needs to be CPFP-d by the next.
then the Taker sweeps - using the minimal fee here as well results in transactions stuck for days in the mempool in the current environment. Even if there would be choice (which should be!) the sweep transaction needs to account for the deposit as well so even trying the next block fee might not be enough. For example a deposit could be a large, consolidating transaction which would have a much larger weight than the 1in-1out sweep txn. Prediction is difficult since all the fees need to be agreed beforehand.
For now there should be a warning to only swap to an own address and not use the platform to pay directly to a third party as the sweep transaction might need CPFP itself.
(also a bug report for the testnet page - querying the testnet mempool api returns a CORS error)
I reviewed and merged your pull request. Thank you for contributing!
back at you, thank you for building this and iterating fast!
Check if you have something like ublock origin running. For me, it did that til I turned off ublock origin.
I definitely have adblockers running. Will try again once bootstrapped a testnet node. On that note testnet channels would be welcome to:
0340a5fc39195696d42e4f43cc01f8c6726a0ef2c4b25e836352437e32d121b97c@rcl5jtbxbqqo5ttygooi53dyk7h33r4j5somy7xulkgosoytgjwa7kad.onion:9735
hourFee
aka Low Priority instead of theminimumFee
which results in funds in swaps being stuck for days: https://github.com/supertestnet/swap-service/pull/10340a5fc39195696d42e4f43cc01f8c6726a0ef2c4b25e836352437e32d121b97c@rcl5jtbxbqqo5ttygooi53dyk7h33r4j5somy7xulkgosoytgjwa7kad.onion:9735