AtomicSwap refunds in DCRDEX

Unless you’ve been through the process of an atomic swap refund, it’s difficult to understand the process and personal emotions

AtomicSwap refunds in DCRDEX
AtomicSwap refunds in DCRDEX

Unless you’ve been through the process of an atomic swap refund, it’s difficult to understand the process and personal emotions. For this reason, I’ve deliberately held off making this video.

I’m pleased to say that this week I experienced first hand a failed swap and the refund process. And after a little nervousness, I came out the other side unscathed with a full refund, all completed autonomously with no manual help or system reboots. So let’s walk through the process and demonstrate what to expect if and when you experience a failed swap.

An important thing to remember with AtomicSwaps is the swap either competes or it doesn’t, there’s no in between.

In my case, I was conducting a DCR to BTC swap. In this instance, I was the “taker”, which means I picked up an existing order rather than placed a new order on the order books.

  • A “taker’s” refund will be processed 8 hours after the refund has been triggered
  • Whereas a “maker’s” refund will be processed 20 hours after the refund has been triggered

When the swap process starts, it will look like a normal swap and try to obtain the correct number of confirmations on each of the blockchains. In my instance, the initial swap transaction for the BTC chain completed without error with 2 confirmations.

It wasn’t until the first confirmation came through on the Decred blockchain that I started getting notifications that something was wrong. At this point, I knew that the transaction was likely to fail because there was a communication error with the server.

The confirmations continued to come in. Normally, on the Decred blockchain, 3 confirmations would trigger the redemption process on both chains. But in this case, the confirmations went to five, which in turn triggered the refund process.

The next part was simple, set my alarm for 8 hours time. To make sure my DCRDEX software is active and ready to receive the refund. It’s important to note that it’s better that DCRDEX is not turned off during this time. But as my system has a tendency of going to sleep, I knew that I would likely need to be available to wake it up.

After 8 hours, the refund was processed automatically and just needed two on-chain confirmations to completely settle and to be unlocked, ready for my next swap.

If you’re the “maker”, this is the same process, but your wait time is 20 hours for the refund to be processed after it’s initially triggered.

As a final note, if a swap does fail, it’s likely both parties will pick up penalty points. If you’ve completed regular successful swaps, you’ll not be affected by this penally, as you’ll already have a good enough reputation to offset this reduction in points. On the other hand, if you’re frequently processing failed swaps, this will impact on your score and could even lead to the loss of your fidelity bond.

Key points:

  • Check notifications error + issue
  • Leave DCRDEX running
  • Taker waits 8 hours
  • Maker waits 20 hours
  • Check for refund confirmation

Currently, the reputation system isn’t visible in DCRDEX and is undergoing various iterations. But as we move forward, this will become an important part of the system to keep an eye on and to make sure you are in good standing with.