Methods of how to use swap services to move sats between LN channels and onchain wallets
Updated October 17, 2024
Nowadays, we have many Lightning Nodes, but still their operators don’t know how to use at fully potential.
So I will try to explain in this guide, how you can use the submarine swaps in LN.
What are the Lightning Submarine swaps?
Submarine swaps are atomic on-chain to off-chain swaps (and vice-versa) of Bitcoin. 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.
Here is more documentation, explaining in more details what are Lightning Submarine swaps:
- Instant Submarine Swaps
- A detailed explanation by Voltage about submarine swaps
- Submarine Swaps Guide - by aftermath on Stacker News, very good list of swap services and a detailed comparison table of their fees
So basically, with submarine swaps, we can move liquidity in/from a HODL/cache onchain wallet into/from a LN node/wallet. Also could be used very well as a method of coinjoin, to lose trace of your KYC coins.
We will consider two possible use case scenarios:
- Scenario A - a merchant node that need to swap out more often the sats received from payments. Methods used:
- RTL or Thunderhub node management apps or LNbits Boltz extension
- CoinOS web wallet
- External swap services
- Ghetto Swap or PeerSwap method between direct peers
- Bluewallet LNDHUB
- Scenario B - a regular user that buys sats from exchanges regularly. Methods used:
- Robosats swaps
- Buy sats from P2P LN exchanges
- Buy sats from onchain exchanges and use cache wallet level to swap
- Electrum LN wallet
SCENARIO A #
Case: You have a LN node and you want to move liquidity (when is needed) from/to your LN channels. Let’s take the example of a simple merchant, with an online or physical shop, where is taking payments through LN.
So, as having more incoming payments, his LN channels will be every end of the day filled at maximum, so will have to “empty” them, in order to make more space for next day of taking payments. That means, you will have to move out of LN channels those received sats, into an onchain wallet. This operation is named “LOOP OUT”.
The “LOOP IN” is the same process, only that is in reverse mode, from any of your onchain wallets, towards your LN node/ wallet. In this case we some simple methods:
1 - RTL and/or Thunderhub - node management apps
Both have integrated the “loop out” feature, using Boltz and Loop services.
In Thunderhub, you can choose, from which channel you want to loop out or let Thunderhub to calculate the best option. You can choose an internal node onchain address or an external one.
RTL sometimes works better and you can use bigger amounts. You can also go to LN channels, select one you where you have more liquidity on your side and on the right side action buttons you have “loop out” option.
Done, once you set the terms, it will take a while until the loop out is approved and the funds are sent to your indicated onchain address. You can monitor the status in the same page.
Another method: If you run a node with a LNbits instance, you have integrated also the Boltz Swap extension or Deezy swap extension right into LNBits, for easy swaps. As a merchant that use LNbits for its business this is a very handy tool to “empty” your filled channels from payments, with swaps into onchain address.
2 - CoinOS - web wallet, with onchain and LN functionalities
This app also could be used as first level of income wallet (if you do not have your own node) for a small merchant, as described in another guide here.
CoinOS have integrated swaps and could be used anonymously, including swaps with Liquid Network.
Simple swap process with CoinOS will be:
- Open an account in CoinOS (save the login details, if you want to reuse it)
- Create a LN invoice, or use the LN address provided by CoinOS, that will be username@coinos.io. Also you can use the LNURL-pay address provided and you can pay any amount you want.
- Pay to that LN invoice / LN address / LNURL-p address from your node (using Thunderhub is much easier for LN address/ LNURL, also you can use Zeus wallet connected to your node).
- Once you have the funds in CoinOS LN, make a payment to any of your onchain BTC addresses, of your node (for future new LN channels) or any other HODL onchain wallet, or you can split.
- Done, you’ve just moved out from LN to onchain your funds, with minimal fees and hassle, total private.
3 - Using various external swap services
Boltz | SwapMarket | ZigZag | FixedFloat| Deezy | DiamondHands | Submarine SwapsThese are online exchanges dedicated for swaps and using a simple procedure in 3-4 steps, you get your sats swap from LN into any onchain address:
BE AWARE: Sometimes ZigZag.io could have serious liquidity issues and cannot fulfill your swaps. I notice many other users complaining about it.
Yes, they are charging a fee, but all is very transparent and displayed before you click “swap”.
The same process, you are paying a LN invoice from your node and indicate an onchain address where you want to receive.
Here are some more detailed guides about swaps using these services:
4 - Ghetto Swap or PeerSwap- The friendly swap with your direct peers #
A - The "Ghetto Swap" method
WARNING: Do not do this with unknown random people on internet!
Practically is an exchange of sats from LN to onchain, using keysend feature of your node, most used is Thunderhub for this procedure.
You push the sats through a common channel to your peer, he will pay you back onto an onchain address you indicate. This transaction is known ONLY by you two. The keysend tx is not a LN invoice and if you have a common channel, you will not pay fees and also will not pass through any other hop node. You can do it also if you do not have a common channel, but that will cost you more because it will pass through some hops, as a regular LN payment.
Ok, we have a use case scenario like this:
- a bunch of friends/ known peers in a ring group, with BTC/LN nodes ready synced and with funds in onchain node wallet.
- we want to have routing ring of nodes, with balanced channels and ready to send and receive LN txs and routing others txs.
SCENARIO A: Pushing tokens to peer and pay later back
- Establish the amount of the channel, usually is better to start with 1M or 2M sats.
- Establish how will be transferred half of the amount of the channel to the other peer, onchain or LN. Each one preference is related with what will want to do with the funds after that (opening another channel - onchain, or just re-using them for payments - LN).
- One of the peers will use Thunderhub app to open a 2M sats channel, for example. If you use as node software Umbrel/myNode/RaspiBlitz, you can find Thunderhub in your AppStore of the bundle. TH is a powerful app to manage your node.
- As an open channel initiator you role is done. Now give to the other peer your BTC address onchain or LN invoice where to send your half amount of sats you pushed on his side, making them "his" sats.
- The other peer will just pay you the invoice and done.
Go to main TH page - quick action buttons - Open. It will open a small action box with another Open button.
Being a new peer, just paste in the box the nodeID of the peer. Put the amount in sats, 2 000 000 in channel size.
In fee amount put a lower fee, based on the mempool, like 2-3-4-5 sat/vByte
In advanced tab (you will need to click it to open the dialog), leave "public channel" and select "push tokens to partner" as "half".
Click "Open channel" and done, wait that the tx will be fully confirmed (3 confirmations)
SCENARIO B: Open channel and balance it with keysend
- Follow the same steps from "Scenario A" except the point where you push tokens in the opening procedure. Let's say you want first to receive those half sats in your wallet before you push the tokens to the other side.
- So you will have a channel of 2M sats with all liquidity on your side.
- After you receive the sats from the other peer, half of the channel amount, you go to the main page in Thunderhub - Accounts - Lightning and click on Send. Then select "Is keysend".
- Paste the nodeID/Public key of the other peer, click decode. Will appear another window with the name of the node (if is set). Put the amount of sats, in this case 1M sats (1 000 000) and click send. This operation will push 1M sats directly to your peer, with no invoice, no fees, directly through your common channel already opened and confirmed.
- Done! Now you will have a balanced channel with your peer.
If you want a more detailed explanation video how to use Thunderhub in a node, here is a great video tutorial by BTC Sessions
NOTE
Another aspect that should be taken in consideration is the size of the channel you open and the commit fee.
A small channel like 20k-50k-100k will be heavily affected by "commit fee". That means in time, if the miner fees goes high up, also the commit fee will "deduct" from your channel balance.
More to read about commit fees variations here and here
B - The Peer Swap method
Another method to swap between peers is to use the PeerSwap service.
PeerSwap enables Lightning Network nodes to balance their channels by facilitating atomic swaps with direct peers. PeerSwap enhances decentralization of the Lightning Network by enabling all nodes to be their own swap provider. No centralized coordinator, no 3rd party rent collector, and lowest cost channel balancing means small nodes can better compete with large nodes.
PeerSwap currently has a working implementation for both CLN and LND nodes.
At the moment PeerSwap is suitable for power node operators with Linux command line skills. Implementations of control panel GUI interfaces are currently underway which will make PeerSwap easier to use for ordinary end users.
5 - Bluewallet LNDHUB
If your node (Umbrel, MyNode, RaspiBlitz, Embassy) have already installed and configured the BW LNDHUB, this could be an easy method to get quick liquidity from an external onchain wallet.
Steps to do:
- Connect BW mobile app to your node BW LNDHUB
- Create a new LN wallet (will be created on your node, not on BW servers)
- This LN wallet will be “empty” as balance, but will use your node liquidity.
- Save this wallet backup! Go to wallet details and select export backup, will be a URL to your LNDHUB wallet.
- In BW, open this LN wallet and click on the button “refill - from external source”. It will bring up a QR code with an onchain address from your node.
- Once you pay to that address (don’t use small amounts like 100, 10k sats), your LN wallet will have a balance with those sats and your LN node also will have an increased liquidity with that amount.
- The tx will be reflected on your node onchain txs but will be always to a “dedicated” onchain address for that LNDHUB wallet. And the funds will be also in your LN channels (see your LN node txs list).
- Done, in one simple step you moved from onchain to LN, using your node.
More about how to use Bluewallet LNDHUB with Umbrel node here, dedicated guide.
SCENARIO B #
Case: You are a regular user, that only want more privacy and lose trace of some BTC bought from a KYC exchange or you received some BTC from an unknown source and don’t want to be linked in any way with it.
In this case is not necessary to have a LN node, but you can do it from a node or a simple LN wallet.
For this process we have the following methods:
1 - RoboSats - totally anonymous exchange, over Tor and LN only
- Go to RoboSats page, using Tor browser
- generate a Robot identity (save the key if you want to re-use)
- make an offer or pick up an existing one, specifying in swap destination where do you want to receive the sats (onchain or LN)
- Here is a demo of RoboSats
- Done, receive the sats in whatever LN/onchain wallet. Pick one from this list.
2 - Buy BTC with fiat and withdraw into LN wallet/node channels
This method is good for small amounts, or you do not want to deal with onchain addresses, you get more privacy and also you can use it as “loop in” method for your LN channels or LN wallets.
Optionally you could ask (put an order) for LN <-->onchain swaps as trade method
Here you have a comparison guide about all LN wallets with their features.
Tools that you can use:
- RoboSats, previously mentioned, Tor only (soon mobile app), more documentation here.
- Mostro - P2P over NOSTR. More documentation here.
- Bisq P2P Exchange - the new Bisq2 supports trades over LN, here is a detailed guide.
- LNP2P Telegram bot P2P exchange
- SatsMobi Telegram bot P2P exchange
- Azte.co LN vouchers or their Telegram bot too
- more exchanges with LN support here
3 - Onchain KYC exchanges to LN wallet / channels
You should consider not using them and instead using the ones from KYCnot.me.
This is the case, when you bought from a KYC exchange and they do not support withdraw through LN. This part is a bit tricky, because many of them will delay the withdrawal, is not instant, to avoid sending those coins to a swap service or simply for draconian KYC measures.
So you will need a “cache wallet” as described in this another guide I wrote, where you will do the coin control, organizing the swaps, distribution by category etc. You withdraw from exchange to this cache wallet and from there in smaller chunks, swap them through LN, using the indicated swap exchanges: Boltz, ZigZag, FixedFloat, CoinOS etc (are many more).
If your exchange is supporting instant withdraw, that is fine, you can just skip the “cache wallet” part and just send smaller chunks to swap exchanges and from there to your LN wallet as your choice.
For this process I suggest to use an external wallet, not form your node. As I described in this another guide about liquidity between nodes. Blixt, Zeus, Breeze, Phoenix are good choices for this process.
From that LN wallet, you can also send to your own node (if you need more liquidity) and or to any other HODL wallet onchain (using another swap).
4 - Electrum Desktop Lightning
This is a quite powerful (but underated) LN wallet with integrated swaps too. I personally find it very useful.
Steps to do for this process:
- Download and install on your desktop PC Electrum wallet app. Is available for all platforms.
- Create a segwit native wallet (bech32) to be fully compatible with LN
- Save all the details, seed, password etc in your password manager
- Go to wallet options and activate “Lightning” (is not by default)
- You can use trampoline channels (managed by ACINQ and other servers) or your own channels (private) with nodes as you wish.
- You would need to open some channels first. Also save them as backup.
- To make more “space” in these channels, you would need to move out some sats, by sending them to another LN wallet of yours, or if you open a channel with your own node, just push them using keysend towards your node or just a simple LN invoice to yourself.
- So you are ready to receive new sats into these Electrum LN channels.
- Once you buy from other sources and receive into Electrum, you can do an internal swap, in Electrum. Funds will be moved to one of your Electrum adresses.
Here you have a demo how to use Electrum with Lightning (5 min video).
CONCLUSION
Use all these tips for more scenarios for loop in, loop out, you can do more combinations using different LN wallets, exchanges, nodes etc.
TO REMEMBER:
- on one LN channel, let’s say of 1M sats, you can pass through 21 BTC or more, back and forth. When you close this channel, on the blockchain will be “visible” only those 1M sats that were “used” in the tx. All the other 20.09 BTC are not reflected, there’s no trace of them (if you do it well).
- you could use also Inbound Liquidity Providers, that will open towards your node channels and you are ready to receive sats from those swap services and/or LN exchanges. That means the UTXO used to open the channel is not yours. This is another aspect that increase your privacy.
- passing through more hops a payment, also increase the anonymity.
- use MPP (multi part payment) if you can and your wallet apps support it.
- If you want to a LN node quick, for anonymity and don’t bother with running a full node, just for buying some sats anonymously, I recommend to use Blixt LN node or Zeus LN node wallet (this is a very powerful tool, if you know how to use it), SBW, Breez, Electrum. With these you can manage easily channels and liquidity as you wish. Also you can any time, just drain them and start a new instance anonymously.
- The future of transacting is on Lightning Network. Soon onchain txs will be used only for opening / closing LN channels. So be prepared from now, start learning how to use all these LN tools, wallets, run your own node, build your own network of peers, build your own liquidity over LN. Will come that day when will be VERY EXPENSIVE TO DO IT! You have been warned.