Can somebody explain me why atomic swaps are not flawed in that way:

When I give him/her my secret he/she could decide wheter to make the trade or not. If the price does favor him/her after a certain amount of time he/she will execute the trade if not wait for the timeout. Do I miss something?

  • 1
    What's the flaw?
    – Osias Jota
    Mar 17, 2018 at 3:18
  • I mean not flaw, but it is communicated way better than it actually is imo. I mean is my statement true?
    – Ini
    Mar 18, 2018 at 1:18
  • I'm not sure if I understood, but maybe yes. I think people doing that would be blacklisted or something for trolling.
    – Osias Jota
    Mar 18, 2018 at 3:12
  • 1
    I think it's a very valid point. perhaps can be addressed by limiting the period to a few minutes and automate the channel.
    – Damien
    Apr 11, 2018 at 12:39

2 Answers 2


There is a problem with the transaction favoring a party, and they can use the timeout to their advantage. But it is not as dire as some think.

Here is an example:

Alice creates a contract on the Bitshares blockchain that will pay Bob 1 Bitcoin if Bob can come up with the secret. If he does not do this within 24 hours, Alice gets her Bitcoin back.

Bob creates a contract on the Litecoin network that will pay Alice 2.5 Bitcoin if she comes up with the same secret within 12 hours.

Alice has a small advantage here. She has the secret. She can wait until near the 12 hour mark to decide if the price moved in her favor. If the price is not to her liking, she does nothing. Bob gets his Litecoin back, and Alice waits another 12 hours to get her Bitcoin back.

If Alice decides to take the Litecoin, Bob has few choices. He has to take the Bitcoin or leave empty handed.


In the normal case where nobody wants to betray the other party, an atomic swap consists of four transactions:

  • a hashed timelock contract (HTLC) from party A on chain A. It contains an if-statement with two paths: One with a check for the hash of the secret and the public key hash of party B and one with the timeout and the public key hash of party A.
  • another HTLC from party B on chain B. Same structure but the public key hashes are swaped. The locktime is shorter, but the secret is the same.
  • a claiming transaction from party A on chain B. Party A now wants to claim the transaction value by providing the secret. As party B watches the blockchain, he sees the transaction from A and now also knows the secret.
  • With the secret he now can claim his part of the trade on chain A.

That's of course a bit of an abstraction, becaus in reallity all of this is further devided into input and output scripts, but for a general understanding I hope, my short explanation is sufficient. For more deteil (but also more confusion), read https://en.bitcoin.it/wiki/Atomic_cross-chain_trading

So, when you are party A and "give" the secret to party B (by sending your claiming transaction)*, you already have received your part of the trade and don't need to worry about anything anymore.

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.