LNbits Extension for Boltz
Swap IN and OUT of the Lightning Network while remaining in full control of your bitcoin at all times.
Usage
This extension lets you swap in (chain -> lightning), swap out (lightning -> chain) and, in the case of failure, refund your bitcoin. Supported chains are liquid and the bitcoin mainchain.
Swap In (Onchain -> Lightning)
- Click on the "Swap (IN)" button to open the following dialog, select a wallet, choose an amount within the min-max range and choose an onchain address for your refund in case the swap fails after you already sent onchain bitcoin.
![Create Swap](https://imgur.com/OyOh3Nm.png)
- After you confirmed, the following dialog with a QR code for the onchain transaction, onchain- address and amount, will pop up.
![Pay Onchain TX](https://imgur.com/r2UhwCY.png)
- After you sent the exact amount of onchain bitcoin to this address, Boltz will pay your lightning invoice and the sats will appear in your wallet.
Refund of Swap In (Onchain -> Lightning)
If a Swap In fails, you can refund your bitcoin after the timeout blockheight was reached. A swap can fail because Boltz, for instance, can't find a route to your lightning node or wallet. In case that happens, there is an info icon in the Swap (In) list which opens following dialog:
![Refund](https://imgur.com/pN81ltf.png)
When the timeout blockheight was reached you can either press refund and lnbits will do the refunding to the address you specified when creating the swap OR you can download the refund file so you can manually refund your onchain bitcoin to a different address via the boltz.exchange website. If you need help or have questions you can contact us in the LNbits Telegram or the Boltz Team on Discord. In a recent update we added anl automated check; lnbits now checks every 15 minutes if it can refund your failed swap.
Swap Out (Lightning -> Onchain)
- Click on the "Swap (OUT)" button to open the following dialog, select a wallet, choose an amount within the min-max range and choose an onchain address to receive your funds on. Instant settlement: means that LNbits will create the onchain claim transaction if it sees Boltz's lockup transaction in the mempool, but it is not confirmed yet. For urgent swaps we advise to leave this enabled.
![Reverse Swap](https://imgur.com/UEAPpbs.png)
If a Swap Out fails, no further action is required, the lightning payment just "bounces back".
Development
manual testcases for boltz startup checks
A. normal swaps
- test: create -> kill -> start -> startup invoice listeners -> pay onchain funds -> should complete
- test: create -> kill -> pay onchain funds -> mine block -> start -> startup check -> should complete
- test: create -> kill -> mine blocks and hit timeout -> start -> should go timeout/failed
- test: create -> kill -> pay to less onchain funds -> mine blocks hit timeout -> start lnbits -> should be refunded
B. reverse swaps
- test: create instant -> kill -> boltz does lockup -> not confirmed -> start lnbits -> should claim/complete
- test: create -> kill -> boltz does lockup -> not confirmed -> start lnbits -> mine blocks -> should claim/complete
- test: create -> kill -> boltz does lockup -> confirmed -> start lnbits -> should claim/complete