AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

Trick for Swaps with XMR as Takers #499

Open stubbrn opened 1 year ago

stubbrn commented 1 year ago

Sorry in advance if I'm forgetting something essential:

Wouldn't it be possible to achieve "XMR as taker" swaps without any downside by adding a step/layer to the beginning of the "XMR as Maker" protocol, instead of trying to create a "mirror" process from scratch ?

Meaning that an ETH maker would be able to essentially say to the network "Hey, I have 10 ETH, and would like to exchange them at this rate; if any of you XMR makers create an offer with my parameters I promise that I'll take it instantly".

So ETH "Makers" could advertise a "promise-offer" to XMR "Takers", that will still end up being regular offers created by the XMR side but with parameters defined by the ETH side (in the "promise").

Before creating the offer to respond to the "promise", the XMR side could verify that the ETH side has the funds (Either the ETH or the Token by requesting the concerned contract), with the ETH address contained in the "promise", but as the ETH side is the one that needs to lock the funds first, this may not be necessary.

Different possible scenarios:

It might be even better to do this instead of the "real thing" because it reuses the same process.

What's the catch ?

dimalinux commented 1 year ago

Here's the catch:

The ETH provider pays the gas to create the swap on chain. If the ETH provider were to create the swap automatically, and the XMR provider could trigger this gas commitment from the ETH provider at no cost to himself, someone can write a bot that will just bleed out the funds from all the ETH providers.

Suggestions on how to get around this problem are welcome from anyone reading this.