Author

Topic: What is "swap refund", and how do I avoid it? (Read 198 times)

jr. member
Activity: 51
Merit: 14
October 24, 2022, 04:12:48 AM
#14
Electrum relies on servers for blockchain data but it does not trust them. They are run by random volunteers and cannot be trusted. Getting data from multiple servers and cross checking it is better than relying on any one server. The exception to this rule is if you are running your own server in which case you have a copy of the blockchain locally and don't need to trust anyone else.
You can't send Lightning payments to offline nodes. If you disappear while your Lightning payment is being routed, your channel might end up being closed uncooperatively by the other party.
It depends on the timing.
Because in 'Reverse swap', you'll just have to successfully send your lightning part of the swap to Boltz (+fee that they'll use) and then an inbound on-chain transaction will be broadcasted.
Since your part of the swap are all through lightning, it will take only a couple of seconds;
once the on-chain transaction was broadcasted, you can safely close electrum while it's waiting to be mined.

So in Reverse Swap, you only needs to wait for the on-chain transaction to be broadcasted (status: "Unconfirmed", not "Local").
At that point, it's okay to close Electrum unlike in Forward Swap where you'll have to wait for your outbound transaction to confirm before Boltz initiate to send your lightning funds.

Many thanks to all of you for all this incredibly useful information. Just to let you know, I came here after a net search for “Swap refund” had given one single result, for that matter one that wasn't even relevant.

Short final note: turning 79 next year, it's somehow doubtful that I'll set up my own server in this lifetime.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
Shutting down or closing Electrum while forward swap is ongoing will be an issue since your Electrum client acts as your lightning node.
-snip-
One more question, just to make sure that I'm understanding things correctly. I assume that this would also happen if I should do a “Reverse swap”. But would it also be the case outside of “swaps”, say if the party I'm sending an LN payment to is offline, or if I shut down after sending an LN payment but before they receive it (for whatever reason)?
It depends on the timing.
Because in 'Reverse swap', you'll just have to successfully send your lightning part of the swap to Boltz (+fee that they'll use) and then an inbound on-chain transaction will be broadcasted.
Since your part of the swap are all through lightning, it will take only a couple of seconds;
once the on-chain transaction was broadcasted, you can safely close electrum while it's waiting to be mined.

So in Reverse Swap, you only needs to wait for the on-chain transaction to be broadcasted (status: "Unconfirmed", not "Local").
At that point, it's okay to close Electrum unlike in Forward Swap where you'll have to wait for your outbound transaction to confirm before Boltz initiate to send your lightning funds.
legendary
Activity: 1876
Merit: 3132
But would it also be the case outside of “swaps”, say if the party I'm sending an LN payment to is offline, or if I shut down after sending an LN payment but before they receive it (for whatever reason)?

You can't send Lightning payments to offline nodes. If you disappear while your Lightning payment is being routed, your channel might end up being closed uncooperatively by the other party.
legendary
Activity: 3682
Merit: 1580
Thank you. I hadn't been on this forum for the past couple of years, but I remember that in the past you had given me some very valuable information. It was the LN instructor I mentioned that suggested to use only one node and recommended a couple of them in particular. His point was that that some nodes in the crowd might be a bit dodgy, and that using one node only is slightly better in terms of anonimity. I guess I'll follow your advice, but I'd like to hear your comments, if any, on his take.

P.S. I hope this post gets accepted - my previous reply got me a warning from a moderator which I wasn't able to understand for lack of familiarity with the terminology.

Electrum relies on servers for blockchain data but it does not trust them. They are run by random volunteers and cannot be trusted. Getting data from multiple servers and cross checking it is better than relying on any one server. The exception to this rule is if you are running your own server in which case you have a copy of the blockchain locally and don't need to trust anyone else.

jr. member
Activity: 51
Merit: 14
Shutting down or closing Electrum while forward swap is ongoing will be an issue since your Electrum client acts as your lightning node.
Electrum's lightning feature isn't custodial so it needs to be active to be able to receive lightning funds.
One more question, just to make sure that I'm understanding things correctly. I assume that this would also happen if I should do a “Reverse swap”. But would it also be the case outside of “swaps”, say if the party I'm sending an LN payment to is offline, or if I shut down after sending an LN payment but before they receive it (for whatever reason)?

Btw. — no problems with forward swaps anymore!
jr. member
Activity: 51
Merit: 14
Shutting down or closing Electrum while forward swap is ongoing will be an issue since your Electrum client acts as your lightning node.
Electrum's lightning feature isn't custodial so it needs to be active to be able to receive lightning funds.

But yeah, swap services doesn't always have a reliable connection.
I've been experiencing downtimes sometimes or channel capacity issue in other instant exchange service and I think Boltz isn't an exception.
Well, thank you very much, that's something I wasn't at all aware of. A bit inconvenient, as I may have to reboot or switch servers occasionally, and the fact that I like to shut down when I go to bed. But I'll certainly pay attention to this aspect.

Also, I now understand that there's something called swaps services, or instant exchange services, that have a life of their own.

For the mod's note, they just combined your two-in-a-row posts.
It seemed normal to reply back separately to two different posters, but yes, that's what they did. The tone in their long note was a bit scary, though, like I'd get thrown into a digital dungeon next time I walked out of step Smiley
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-snip-
Concerning connection issues, I can't see that it should have been the case at my end (unless... shutting down the computer? - I had understood that this could be a problem if I had my own node, which is not the case). If it's at Boltz's end that the problem lies, the fact is that Electrum doesn't give us another option.
-snip-
P.S. I hope this reply gets accepted - my previous reply got me a warning from a moderator which I wasn't able to understand for lack of familiarit with the terminology.
Shutting down or closing Electrum while forward swap is ongoing will be an issue since your Electrum client acts as your lightning node.
Electrum's lightning feature isn't custodial so it needs to be active to be able to receive lightning funds.

But yeah, swap services doesn't always have a reliable connection.
I've been experiencing downtimes sometimes or channel capacity issue in other instant exchange service and I think Boltz isn't an exception.

For the mod's note, they just combined your two-in-a-row posts.
jr. member
Activity: 51
Merit: 14
As evidenced by this screenshot:
https://i.postimg.cc/vHTvjh3n/swaps.jpg

the two Forward swaps had gone through perfectly well, and it's only some time later that someone, somehow, in the name of what? was able to initiate the Swap refunds. The second "refund", initiated shortly before I wrote this post, only went through in the night.
In your screenshot, only one Forward swap had gone through perfectly: the "dimmed" one.
The other two (with no BTC amount after "Forward swap" in the description) have failed must be because Boltz failed to send you the lightning funds, that's why they had to send you a refund.
May be at their end or their/your channel's connection issue.

In your screenshot: Lets, label each line as tx1, 2, 3, 4, 5, 6 & 7:
  • tx1 is the refund of tx5
  • tx6 is the refund of tx7
  • tx4 is the successful forward swap.
Thank you, that makes sense. I hadn't realised that the amount showing in the description meant anything in particular. Looking back in time I find that out of good number of Forward swaps there's only one without the amount, about a month ago. But as far as I can see it didn't cause any hassles. I should also think that during the 28 hours that lapsed between tx6 and tx7 I would have had plenty of time to use the funds as I did in tx2 and tx3.

Concerning connection issues, I can't see that it should have been the case at my end (unless... shutting down the computer? - I had understood that this could be a problem if I had my own node, which is not the case). If it's at Boltz's end that the problem lies, the fact is that Electrum doesn't give us another option.

If Boltz fails, as you wrote, to send amounts that are not very substantial, could it be a question of fees? On-chain, in 99 out of 100 transactions, I put the lowest fee, for the simple reason that I'm never in a hurry, but that's maybe not the right thing to do in LN?

P.S. I hope this reply gets accepted - my previous reply got me a warning from a moderator which I wasn't able to understand for lack of familiarit with the terminology.

Connecting to just one server reduces your security somewhat. I would be cautious about doing this.
Thank you. I hadn't been on this forum for the past couple of years, but I remember that in the past you had given me some very valuable information. It was the LN instructor I mentioned that suggested to use only one node and recommended a couple of them in particular. His point was that that some nodes in the crowd might be a bit dodgy, and that using one node only is slightly better in terms of anonimity. I guess I'll follow your advice, but I'd like to hear your comments, if any, on his take.

P.S. I hope this post gets accepted - my previous reply got me a warning from a moderator which I wasn't able to understand for lack of familiarity with the terminology.
legendary
Activity: 3682
Merit: 1580
Connecting to just one server reduces your security somewhat. I would be cautious about doing this.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
As evidenced by this screenshot:
https://i.postimg.cc/vHTvjh3n/swaps.jpg

the two Forward swaps had gone through perfectly well, and it's only some time later that someone, somehow, in the name of what? was able to initiate the Swap refunds. The second "refund", initiated shortly before I wrote this post, only went through in the night.
In your screenshot, only one Forward swap had gone through perfectly: the "dimmed" one.
The other two (with no BTC amount after "Forward swap" in the description) have failed must be because Boltz failed to send you the lightning funds, that's why they had to send you a refund.
May be at their end or their/your channel's connection issue.

In your screenshot: Lets, label each line as tx1, 2, 3, 4, 5, 6 & 7:
  • tx1 is the refund of tx5
  • tx6 is the refund of tx7
  • tx4 is the successful forward swap.
jr. member
Activity: 51
Merit: 14
The other party the channel is connected to can close it at any time. To get around this, open a channel with a more stable node or switch wallets if your current one won't let you pick a node yourself. (also complain to the wallet provider about those funds not coming back to you if you can't pick what node to connect to and it doesn't just select a random one for you).
Thank you very much, and sorry for the delay — I wasn't expecting such a quick reply.

I have been using BTC with Electrum for many years, after moving all funds off the exchanges, but in a rather low-key manner (mostly shopping needs). Lightning is very new for me, so please bear with me, I'm not at all familiar with some of its workings.

Following the indications of an instructor who seemed experienced and reliable, I modified Electrum's config file in order to connect to one node only (instead of various nodes selected at random). He recommended a couple of them. I opted for 'blockstream.info:700'. That same instructor recommended opening the channel with ACINQ. So far it had been going OK — another channel opened with Electrum trampoline got closed on me without my understanding the reason.

Do I understand correctly that you would suggest I reinstate the use of multiple nodes? As far as the wallet itself is concerned, I only use Electrum and I wouldn't know what else to use. Also, Electrum only gives me three options when opening a channel (incidentally, 'hodlister.co' was also recommended by the instructor, but only as a single node, not to open a LN channel with).

I'm not sure how I should complain to Electrum (the wallet provider) — anyway, the fees lost were really minimal, single-digit euro cents.

Last, is the 'Boltz backend', which Electrum designates as "powering submarine swaps" in any way related to all this?

Anyway, whether it's Boltz, ACINQ or blockstream.info that's responsible for this, what could be the reason for it or they doing it?



-snip-
Just make sure that your channel has enough inbound liquidity to accept the swapped amount.
You can check it in "can receive n BTC" value in the 'Channels' tab.

If it's not the inbound capacity, there must be a reason why Boltz can't send your "swapped" lightning funds
like poor channel connectivity, etc.

That was two hours ago. At time of writing this “refund” isn't even confirmed on the Blockchain yet.
It's in mainnet so it's bound to the Bitcoin network's confirmation time which isn't consistent 10minutes.

You'll have to excuse me, but that's not what I wrote. Or maybe I didn't explain things properly. As evidenced by this screenshot:



the two Forward swaps had gone through perfectly well, and it's only some time later that someone, somehow, in the name of what? was able to initiate the Swap refunds. The second "refund", initiated shortly before I wrote this post, only went through in the night. Note that the part that's greyed/dimmed is a new Forward swap I did after writing the post — I kept an eye on it, and as soon as it was through (very quickly) I did the Lightning transactions before that same someone somehow came and did a new "refund".

[moderator's note: consecutive posts merged]
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-snip-
Just make sure that your channel has enough inbound liquidity to accept the swapped amount.
You can check it in "can receive n BTC" value in the 'Channels' tab.

If it's not the inbound capacity, there must be a reason why Boltz can't send your "swapped" lightning funds
like poor channel connectivity, etc.

That was two hours ago. At time of writing this “refund” isn't even confirmed on the Blockchain yet.
It's in mainnet so it's bound to the Bitcoin network's confirmation time which isn't consistent 10minutes.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
The other party the channel is connected to can close it at any time. To get around this, open a channel with a more stable node or switch wallets if your current one won't let you pick a node yourself. (also complain to the wallet provider about those funds not coming back to you if you can't pick what node to connect to and it doesn't just select a random one for you).
jr. member
Activity: 51
Merit: 14
Hi,

A few days ago, I did a Forward swap to the Lightning channel. About 28 hours later a “Swap refund” showed up for the whole amount (minus fees, it seems). I didn't understand why, but I left it at that. Today, I did a new Forward swap, for a lesser amount. This time it took only three hours before a Swap refund was once again initiated (by who? the “Boltz backend”?). That was two hours ago. At time of writing this “refund” isn't even confirmed on the Blockchain yet.

I'm in a bit of a fix - no funds left in the Lightning channel. What is going on? What should I do to have this not happen?
Jump to: