As per the explanation provided here: https://github.com/decred/atomicswap

The contract is valid for a certain amount of time (example set to 48h) and in order for the party B to recover the found, he needs the secret that is published on the chain after the party A has redeem the coins on the contract.

As far as I understand, it takes some time for party B to actually recover the secret from the chain and then redeem the coins.

What happens if party A wait last seconds (let's say 5 seconds) before expiration of the contract to redeem the coin, which wouldn't provide enough time for party B to redeem its coin before the contract expiration in which case it would be refunded to party A as well as getting party B coins.

Is the understanding correct and that point valid?

Is it fixable by setting different contract expiration period, lets say party A contract would need longer expiration time to ensure party B ha time to redeem the coins?

2 Answers 2


As you stated, setting 2 different expiration times provides safety.

My recommendation is to select the network with the longest period before immutability as the first contract, and pick a time that is agreeable with both parties.

The second contract on the other chain should use an expiry that is half of the first contract. This gives the redeemer on the first blockchain some time before the expiry.


Before that 48 hours passes, one can't refund funds. The only thing s/he can do is to wait for the initiator to redeem coins.

After the locktime ends, one becomes able to get a refund. However, you're still able to redeem coins.

So, you're still able to redeem coins after the locktime.

  • This is understood, however, the question is a bit different. it describes a potential attack
    – Damien
    Apr 11, 2018 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.