0 sats \ 6 replies \ @aoeu 5 Dec 2023 \ on: I'm Kilian, Co-Founder of Boltz. AMA. bitcoin
If a swap fails, generally why is that? Lack of liquidity on your side? How does the recovery process work?
Lack of liquidity almost never, we got a lot better in managing our liquidity over the past months :)
It's usually due to constraints on Lightning, depending on the direction:
Chain -> Lightning: usually user doesn't have enough inbound capacity (usually personal nodes) or LSP fails to open channel on the fly for X,Y,Z reason (mobile wallets like Phoenix) or route to user is more expensive than our fee threshold (happens when sending to very popular high volume destinations like CEXes) OR some other mobile wallet or implementation-specific weirdness. But for most weirdness we have workarounds in the code by now. If it fails though, users have to go through a refund process and since this is a pain we are constantly improving things on this front.
Lightning -> Chain: if user doesn't manage to route the required amount to us, no biggie. Nothing happened. If user managed to route and we ran out of liquidity (almost never happens as mentioned above), lightning payment just bounces back. So this direction is less problematic.
reply
If a swap fails, generally why is that?
for me so far is 1. lockup failed 2. failed to pay LN invoice due to not enough inbound liquidity or no route
Refund Process
a. wait after the lock time and go to refund page
b. upload the refund file
c. input a Bitcoin address for refund, done.
Again, choose a low-fee time for a refund because the fee would be deducted from your refund sats!
But I'm really curious how the refund works under the hood? how can it be so automatic 👀 @boltz
reply
Hello Natalia, are you aware that this AMA is only happening because of you? So big THANK YOU for luring us onto Stacker News!
Re your questions:
- lockup failed
Don't remember if you told us already: but was the reason that you locked up too little e.g. the network fee was deducted from the amount by your wallet?
But I'm really curious how the refund works under the hood? how can it be so automatic 👀
Haha, a lot of magic happening. No but really: what is happening is that there is a "refund path" when you are locking up coins on the chain that can be used after the timeout blockheight if you know a set of secret information only you have. This info is stored in your browser as well as the refund file if you downloaded it. Here an example of what information a refund file contains:
{"id":"G8LwLT","asset":"BTC","privateKey":"f3ac710b058726ceeee17e7aebcbad64b4222b3aa02f14bbc027a50c34322308","redeemScript":"a914c8bd6f30ae123f70961fdeaaec471ced3f2efb9687632102c89b401b7902c000640f39c54e9a4fac2c5b7fbbc19a222f7f2a96955d0061c5670331c926b17521020e045994c22ce920d04418c517446fec0837e09467a0e31fadd09871966de53968ac","timeoutBlockHeight":2541873}
So what is concretely happening that our web app locally in your browser crafts and submits the refund transaction when you use https://boltz.exchange/refund.
Let me know if you want more depth on that
reply
are you aware that this AMA is only happening because of you? So big THANK YOU for luring us onto Stacker News!
my pleasure!
but was the reason that you locked up too little e.g. the network fee was deducted from the amount by your wallet?
yes, I was playing around with Boltz for different situations so that I could have more fun things to share 😂 learning opportunities can be created:) haha
what is happening is that there is a "refund path" when you are locking up coins on the chain that can be used after the timeout blockheight if you know a set of secret information only you have.
this is so cool! curious what would happen in a failed swap - if the user didn't download anything and accidentally closed the browser, then how can he prove that he is the one to refund to?