From b13588dcef67c6bf10b87c1bb02b381081776a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 23 Jan 2023 10:16:27 +0100 Subject: [PATCH] DOCS: improve boltz fee information (#1386) * improve fee information an docs * review @michael1011 Co-authored-by: ben --- lnbits/extensions/boltz/README.md | 10 ++- lnbits/extensions/boltz/crud.py | 1 - .../boltz/templates/boltz/_api_docs.html | 76 ++++++++++++++++--- 3 files changed, 73 insertions(+), 14 deletions(-) diff --git a/lnbits/extensions/boltz/README.md b/lnbits/extensions/boltz/README.md index 28289b73a..9ca38d491 100644 --- a/lnbits/extensions/boltz/README.md +++ b/lnbits/extensions/boltz/README.md @@ -5,11 +5,12 @@ move **IN** and **OUT** of the **lightning network** and remain in control of yo * [Documentation](https://docs.boltz.exchange/en/latest/) * [Discord](https://discord.gg/d6EK85KK) * [Twitter](https://twitter.com/Boltzhq) +* [FAQ](https://www.notion.so/Frequently-Asked-Questions-585328ae43944e2eba351050790d5eec) very cool! # usage This extension lets you create swaps, reverse swaps and in the case of failure refund your onchain funds. -## create normal swap +## create normal swap (Onchain -> Lightning) 1. click on "Swap (IN)" button to open following dialog, select a wallet, choose a proper amount in the min-max range and choose a onchain address to do your refund to if the swap fails after you already commited onchain funds. --- ![create swap](https://imgur.com/OyOh3Nm.png) @@ -22,14 +23,14 @@ This extension lets you create swaps, reverse swaps and in the case of failure r if anything goes wrong when boltz is trying to pay your invoice, the swap will fail and you will need to refund your onchain funds after the timeout block height hit. (if boltz can pay the invoice, it wont be able to redeem your onchain funds either). -## create reverse swap +## create reverse swap (Lightning -> Onchain) 1. click on "Swap (OUT)" button to open following dialog, select a wallet, choose a proper amount in the min-max range and choose a onchain address to receive your funds to. Instant settlement: means that LNbits will create the onchain claim transaction if it sees the boltz lockup transaction in the mempool, but it is not confirmed yet. it is advised to leave this checked because it is faster and the longer is takes to settle, the higher the chances are that the lightning invoice expires and the swap fails. --- ![reverse swap](https://imgur.com/UEAPpbs.png) --- if this swap fails, boltz is doing the onchain refunding, because they have to commit onchain funds. -# refund locked onchain funds from a normal swap +# refund locked onchain funds from a normal swap (Onchain -> Lightning) if for some reason the normal swap fails and you already paid onchain, you can easily refund your btc. this can happen if boltz is not able to pay your lightning invoice after you locked up your funds. in case that happens, there is a info icon in the Swap (In) List which opens following dialog. @@ -37,4 +38,5 @@ in case that happens, there is a info icon in the Swap (In) List which opens fol ![refund](https://imgur.com/pN81ltf.png) ---- if the timeout block height is exceeded you can either press refund and lnbits will do the refunding to the address you specified when creating the swap. Or download the refundfile so you can manually refund your onchain directly on the boltz.exchange website. -if you think there is something wrong and/or you are unsure, you can ask for help either in LNbits telegram or in Boltz [Discord](https://discord.gg/d6EK85KK) +if you think there is something wrong and/or you are unsure, you can ask for help either in LNbits telegram or in Boltz [Discord](https://discord.gg/d6EK85KK). +In a recent update we made *automated check*, every 15 minutes, to check if LNbits can refund your failed swap. diff --git a/lnbits/extensions/boltz/crud.py b/lnbits/extensions/boltz/crud.py index 621fd3656..1c9eb700a 100644 --- a/lnbits/extensions/boltz/crud.py +++ b/lnbits/extensions/boltz/crud.py @@ -15,7 +15,6 @@ from .models import ( ReverseSubmarineSwap, SubmarineSwap, ) -from .utils import create_boltz_client, execute_reverse_swap async def get_submarine_swaps(wallet_ids: Union[str, List[str]]) -> List[SubmarineSwap]: diff --git a/lnbits/extensions/boltz/templates/boltz/_api_docs.html b/lnbits/extensions/boltz/templates/boltz/_api_docs.html index bdcbc8ca2..f8474c576 100644 --- a/lnbits/extensions/boltz/templates/boltz/_api_docs.html +++ b/lnbits/extensions/boltz/templates/boltz/_api_docs.html @@ -6,30 +6,88 @@ style="padding: 5px 9px" alt="" /> +

NON CUSTODIAL atomic swap service

- Boltz.exchange: Do onchain to offchain and vice-versa swaps + Providing trustless and account-free swap services since 2018. Move IN and + OUT of the lightning network and remain in control of your bitcoin, at all + time.

- Submarine and Reverse Submarine Swaps on LNbits via boltz.exchange API
-

-

- Link : + Link: https://boltz.exchange -

-

+
+ README: More detailsread more

Created by, + >Extension created by, dni

+ + +

+ Fee Information +

+ + Every swap consists of 2 onchain transactions, lockup and claim / refund, + routing fees and a Boltz fee of 0.5%. + +
+ + + You want to swap out 100.000 sats, Lightning to Onchain: +
    +
  • Onchain lockup tx fee: ~500 sats
  • +
  • Onchain claim tx fee: 1000 sats (hardcoded)
  • +
  • Routing fees (paid by you): unknown
  • +
  • Boltz fees: 500 sats
  • +
  • Fees total: 2000 sats + routing fees
  • +
  • You receive: 98.000 sats
  • +
+

+ onchain_amount_received = amount - (amount * boltz_fee / 100) - + lockup_fee - claim_fee +

+

98.000 = 100.000 - 500 - 500 - 1000

+
+
+ + + You want to swap in 100.000 sats, Onchain to Lightning: +
    +
  • Onchain lockup tx fee: whatever you choose when paying
  • +
  • Onchain claim tx fee: ~500 sats
  • +
  • Routing fees (paid by boltz): unknown
  • +
  • Boltz fees: 500 sats (0.5%)
  • +
  • Fees total: 1000 sats + lockup_fee
  • +
  • You pay onchain: 101.000 sats + lockup_fee
  • +
  • You receive lightning: 100.000 sats
  • +
+

+ onchain_payment + lockup_fee = amount + (amount * boltz_fee / 100) + + claim_fee + lockup_fee +

+

101.000 + lockup_fee = 100.000 + 500 + 500 + lockup_fee

+
+
+