Skip to content

[Electrum Swap,WEX] Third party client forward swaps require different protocol on swap server side #10611

@dejfcz

Description

@dejfcz

Description

Follow up based on X request https://x.com/ElectrumWallet/status/2048374535578062988 to move the discussion to an issue.

We are trying to expand Electrum Swap ecosystem by creating interface for people who do not use Electrum Wallet. We have released the first public version where we implemented reverse swaps and we would like to support forward swap as well in order to provide complete swap gateway to Electrum Swaps.

The research of forward swaps lead us to discovery of a change in Electrum's implementation (

Old (removed) flow:
) from an "old flow" (based on standard Bolt11) to a "new flow" (based on HODL invoices).

As we do not have any control of the client's LN wallet and because HODL invoices are not commonly supported by wallets, the new flow does not seem to be viable for us to use. The old flow only requires the user's wallet to be able to generate a standard Bolt11 invoice, so it'd be perfect for us. However, the support for the old flow on the server side has been removed (

elif req_type == 'submarine':
) from Electrum's code base.

We would like to ask for ideas on how to reach support for forward swaps.

The only idea we currently have is to reintroduce the server side support for the old flow:

  • new extra flag goes into swap announcement, so that we can distinguish providers that we can use for forward swaps from others; this should be backwards compatible with old swap servers and clients, who would still use the old swap announcement and ignore the extra flag
  • swap server code would implement both versions of the swap, the new flow that is used by current Electrum swap clients as is, and the old flow, for the purpose of enabling third party access to the ecosystem
  • optionally, we could add a setting that could enable/disable the old flow, depending on whether it would be opt-in or opt-out feature

Would Electrum be happy to accept such contribution? Or is there a better solution?

Further, it has been suggested that

Note: If the server uses our protocol (not Boltz), then a reverse swap failing will not result in the user losing fees, because the invoices are bundled.

I am personally unaware of how we could use that. Bundled invoices is something that does not seem to have wide support either. I'd be happy to discuss how we can improve our reverse swap support. Currently, the swap server does not complete the fee invoice before the main swap invoice is also sent, so an honest swap server would not take the fee if the main invoice is not paid. However, a malicious swap server can steal the funds, but the original post I found about this (https://diyhpl.us/~bryan/irc/bitcoin/bitcoin-dev/linuxfoundation-pipermail/lightning-dev/2023-June/003977.txt) mentions that the theft by malicious provider is not prevented either in case of bundled. Of course, the advantages of having just one invoice are still great, so even if the theft cannot be prevented, we would like to improve the UX. So any help understanding what can be done here would also be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions