Fairly exchanging digital content is an everyday problem. In digital commerce, it's a requirement to include fair exchange, since one or both of the parties are using digital currencies as the subject matter. For example, transactions between different digital currencies, or transactions between digital currencies and physical goods.
Traditionally, transactions between digital currencies are executed on cryptocurrency exchanges. Exchanges achieve this by creating internal accounts, which are also called IOU (I Owe You) accounts. In this mode, it’s easy to achieve high transaction speeds, However with the following issues; security, lack of liquidity, time lag of transactions. Regarding the transaction time lag, transaction results aren’t submitted on the blockchain in a timely manner, and result in not being cashed immediately. The model of decentralised exchanges was built to address the issues of centralised exchanges. Most of decentralized exchanges are based on the Multi-Signature Scheme or Hashed Time-lock
Contract (HTLC) to ensure atomic transactions. However, Multi-Signature Schemes depends on the Trusted Third Party(TTP) which is vulnerable to collision attacks and DoS attacks. For the HTLC scheme, attackers may launch DoS attacks which could result in users unable to make refunds in a given moment.