How Liquality Addresses Commonly Known Limitations of Atomic Swaps
This article highlights the limitations of atomic swaps and how Liquality addresses them.
To continue to be as transparent with our users as possible and identify where we can turn our weaknesses into strengths, we wanted to publish a list of all the limitations of using atomic swaps and Liquality software, as well as how we address them. We will be adding this content to our FAQ as well.
Hope you enjoy the read and find it informative. If you have questions or comments, feel free to reach us on Twitter or Telegram.
What is the free option problem for atomic swaps and how does Liquality mitigate it?
The free option problem / inadvertent call option enables the initiating party (User A) to delay or back out of an atomic swap after both users' funds have been locked into escrow.
To do so, (1) User A must first lock his funds into an escrow (ie. a Hash Time Locked Contract - HTLC) for an atomic swap. Then (2) User B must lock her respective funds into another escrow after User A.
The expectation is that after User B does so, (3) User A will claim his new funds from User B’s escrow, which will then allow (4) User B to claim her new funds from User A’s escrow.
However, after step 2, User A has the option to delay the completion of the swap for as long as possible and only complete the swap if the market has moved in his favor.
The Liquality team has taken a few steps to minimize the impact of the free option.
Firstly, the atomic swap protocol introduces longer penalty times for User A, so that if User A does not claim his new funds and complete the swap in step 3 before a predetermined expiration time (eg. 3 hours), then User A will not receive his refund until hours after the expiry (eg. another 3 hours). This imposes a higher opportunity cost on User A if they do not act in good faith.
Secondly, if User A is using the Liquality Wallet chrome extension, then his wallet will automatically claim and complete the swap as soon as it is able, eliminating the ability for User A to leverage the free option problem. In this way, transaction automation not only enables a faster and smoother swapping experience, but also eliminates the free option problem for Liquality Wallet users.
There are also other proposals recommended by researchers, like adding premiums to atomic swaps (to resemble traditional American Call Options). However, Liquality has not yet had to introduce these kinds of changes into the atomic swap protocol, as the free option problem hasn’t been much of an issue in our live production environment.
What is Liquidity DoS-inig / Trolling for atomic swaps and how does Liquality mitigate it?
Liquidity DoS-ing (Denial of Service) / Trolling is where User A escrows his assets into an HTLC to begin an atomic swap, but User B does not reciprocate in step 2. If User B does not lock her assets into escrow, User A will end up in a situation where his funds are locked and can only be refunded back to himself once the atomic swap expires.
A programmatic market maker acting as User B can ensure fulfillment 100% of time, making it impossible to intentionally troll User A’s liquidity.
What is the sleeping vulnerability for atomic swaps and how does Liquality mitigate it?
Both parties involved in an atomic swap must remain online for the duration of the swap. The Sleeping Vulnerability is where User A has claimed his new funds from User B’s escrow (step 3), and User B has not yet claimed her new funds from User A’s escrow. If User B does not claim her new funds before the atomic swap expires, then User A can refund his original funds back to himself, essentially ending up with both his and User B’s funds. Furthermore, User B is left without recourse and cannot get a refund.
Liquality eliminates this issue by automating the transactions involved in an atomic swap. Because User A is swapping against an automated market maker (User B), User B is always online and will claim the new funds as soon as it is able.
Why do I need to be online throughout the entire atomic swap process?
Though transaction automation in the Liquality Wallet offers a simple way to complete cross-chain atomic swaps within 11 minutes by only clicking one button - the one-click atomic swap - a user must still be connected to the internet with his browser window open during the atomic swap until his claim transaction confirms and completes the atomic swap.
Atomic swaps are synchronous, meaning they require both parties of an atomic swap to be online throughout the swap (eg. browser window is open and connected to the Internet). This means that as a user, you must keep your browser open and connected to the internet during your entire swap - from start to finish - otherwise, you risk not claiming your funds before expiry and being exposed to the penalty time before your refund.
Whereas other non-atomic swap services and dexes only require users to be online for one transaction to confirm (their swap initiation transaction), atomic swaps require users to be online to not only initiate their swaps, but also to claim their new funds.
Atomic swaps can’t really be private - there is a secret that is shared cross-chain that can link transactions on different blockchains to a single atomic swap!
The smart contract escrows (HTLCs) involved in a cross-chain atomic swap must be able to talk to one another to trigger a chain of atomic transactions - this is done through a shared secret.
Unlike instant exchanges and other centralized exchanges, only the transactions and their respective addresses are linked through this shared secret, not personally identifiable information like your driver’s license, billing info, etc. This may be attractive to those who look to maximize their privacy and retain personally identifiable information (PII), but unattractive to users who look to circumvent chain analysis.
Given the public nature of blockchains, one can easily identify shared secrets between transactions on different blockchains, and link the transactions together. In an atomic swap, it’s easy to identify which HTLC escrows belong to the swap.
In an atomic swap, HTLC escrows must communicate in order to know whether to send funds to the intended recipient or refund the original sender. They are able to identify and communicate with one another through a shared secret cryptographic proof. This shared secret is broadcasted through a transaction on one blockchain, then acknowledged and reciprocated by another transaction on the other blockchain. The shared secret is able to be monitored cross-chain by blockchain nodes (eg. clients like Geth, Bitcoin Core). By broadcasting shared secrets, we can chain and trigger conditional transactions on different blockchains, like with cross-chain atomic swaps.
It looks like I can’t use Liquality software everywhere?
Yes - just like Uniswap and other protocols, Liquality software & services are geo-blocked from users in China [CN], South Sudan [SS], Myanmar [MM], Syrian Arab Republic [SY], Côte d'Ivoire [CI], Iran (Islamic Republic of) [IR], Cuba [CU], Korea (the Democratic People's Republic of) [KP], according to US sanctions.
Though our software is not available in those countries, developers are free to explore our code, all of which is free and open source, including the Chain Abstraction Layer.
Can I be a market maker? How many market makers are there in the Liquality network?
Though it is possible for users to spin up their own market maker through our open source software, it requires technical expertise and deep knowledge of atomic swaps to properly set up and operate one. Liquality has plans to enable users to easily spin up their own market makers in the near future.
Liquality currently operates a programmatic market maker that charges a ~1% spread, which users can atomic swap with for the best possible experience.
With all the quirks associated with atomic swaps, we do not want to expose non-technical users to the complexities of making markets for atomic swaps. Instead, we are first learning as much as possible about market making operations for atomic swaps. This way, when we introduce an easier way for users to make markets, they will encounter minimal difficulties and risks.
Why are there so many transactions in a cross-chain atomic swap, especially for ERC20s? Don’t I end up paying more in network fees?
As defined in the Tier Nolan atomic swap protocol, atomic swaps must require multiple transactions for users to realize the security benefits of atomicity - guaranteed execution or refunds, minimized counterparty risk, etc.
Depending on the asset being swapped, an atomic swap collectively involves 4 transactions, two on each side of the swap (User A initiates, User B reciprocates, A claims, and B claims).
The exception of this relates to ERC20 tokens, which require an additional transaction for transferring the ERC20 to the swap contract. This is comparable to wrapping ETH or approving tokens in order to swap ERC20s on Ethereum-based Decentralized Exchanges (DEXes).
- So if you’re looking to swap an ERC20 to BTC, you will transact 3x (2 to send the ERC20, 1 to claim the BTC), and your counterparty will need to transact 2x (1 to send the BTC, 1 to claim the ERC20).
- If you’re looking to swap BTC for an ERC20, you will transact 2x (1 to send BTC, 1 to claim ERC20), and your counterparty will need to transact 3x (2 to send ERC20, 1 to claim BTC).
- If you’re looking to swap ETH for an ERC20, you will transact 2x (1 to send ETH, 1 to claim ERC20), and your counterparty will need to transact 3x (2 to send ERC20, 1 to claim ETH).
That being said, we’ve conducted a gas-fee-calculation analysis and have found that atomic swaps can often be cheaper to execute than DEX-based swaps. Additionally, there are potential improvements (like Ruben Somsen’s Succinct Atomic Swaps) being proposed to the atomic swap protocol to decrease the number of transactions involved in a swap, while maintaining the same benefits that atomic swaps have to offer.
With the swap expiration time associated with a single atomic swap, it seems like I always need to overpay network transaction fees for faster confirmations to ensure the entire atomic swap completes successfully. If I use too low of a transaction fee, my atomic swap will likely fail, and I’ll have to wait hours to issue my refund, right?
There are certainly tradeoffs for atomic swaps. Users have more convenient alternatives like instant exchanges when attempting to swap assets across blockchains, but those services also have expiration times (for your initial deposit transaction) and other risks too.
In order to gain the security benefits of atomic swaps, the protocol requires multiple transactions and expiries. First, User A must successfully escrow his funds before his quoted rate expires. Then (step 2) User B must successfully escrow her funds before User A’s escrow expires and refunds User A. Then (step 3) User A must claim his new funds before User B’s escrow expires and refunds User B. Finally, (step 4) User B must claim her new funds before User A’s escrow expires and refunds User A. To learn more about an atomic swap’s transactions, you might find our explainers on atomic swaps and hash time locked contracts informative.
By paying higher network fees, users can be more confident that their transactions will confirm faster and their atomic swap will complete successfully, just as with any other type of transaction on a blockchain-based network. The multiple transactions and expirations involved in an atomic swap, though inconvenient from a network fee perspective, are critical to delivering on the benefits of atomic swaps.
As such, we encourage users to get comfortable using network fee estimators, mempool visualizers, and block explorers as possible.
For Bitcoin-based transactions:
- To see the state of your Bitcoin transaction, you can use the Blockstream block explorer link we provide.
- To see the state of the Bitcoin network, you can use mempool visualizers like Mempool.Space to view spikes in network congestion and unconfirmed transactions’ fees.
For Ethereum-based transactions:
- To see the state of your Ethereum-based transaction (ETH, ERC20), you can use the Etherscan block explorer link we provide.
- To see the state of the Ethereum network, you can use tools like Eth Gas Station to view spikes in network congestion and unconfirmed transactions’ fees.
Furthermore, swapping from the Liquality Wallet, users can also use the timeline detail to better visualize their atomic swap’s progress. If your transaction doesn’t seem to be confirming quickly enough, you have the option to speed up your transaction and get a confirmation faster by paying higher network fees.
We agree that reducing on-chain network fees is ideal to end-users. Our roadmap includes plans to minimize users’ on-chain network fees by scaling atomic swaps through layer 2 solutions like the Lightning Network.
Why do I need an ETH balance when swapping?
We recognize that needing ETH in advance is inconvenient for users and are brainstorming ways to mitigate that pain point.
Every transaction involved in an atomic swap will incur network fees (eg. BTC for miners in the Bitcoin network, ETH for gas fees in the Ethereum network). It’s important that you have a sufficient balance to cover the fees and amount for the swap.
- If you’re looking to swap an ERC20 for BTC, then you’ll need a balance in the ERC20, as well as a balance in ETH to deploy a contract and send the ERC20 to it. When claiming your new BTC, you don’t need a BTC balance in your wallet in advance, as the network fees associated with your claim BTC transaction will be deducted from the BTC that’s been escrowed.
- If you’re looking to swap BTC for an ERC20, then you’ll need BTC to cover both the amount you’re looking to swap and the network fees you need to pay to miners in your initial transaction. When claiming your new ERC20, you’ll need to have ETH in your wallet balance in advance to pay the network fees associated with your claim ERC20 transactions.
- If you’re looking to swap BTC for ETH, then you’ll need BTC to cover both the amount you’re looking to swap and the network fees you need to pay to miners in your initial transaction. When claiming your new ETH, you’ll need to have ETH in your wallet balance in advance to pay the network fees associated with your claim ETH transaction. Unlike BTC HTLC escrows, ETH HTLC escrows cannot deduct ETH from the amount that’s been escrowed to pay the network fees associated with your claim ETH transaction.
What kind of marketing tools does Liquality use? How can you claim to be private if you’re spying on me?
We absolutely recognize and respect users’ privacy. We make it a priority to never share your data with third parties. We never ask users to share private information like private keys, wallet seeds, or other sensitive data. Sensitive data like those are stored in users’ local browser storage, inaccessible to us.
We encourage users to explore privacy-preserving tools like VPNs, alternative browsers, etc. We will continue to work towards a better opt-in policy for our users.
Does Liquality depend on 3rd party APIs?
All interactions are intentionally developed to ensure that you can run the Liquality stack on your own equipment without any dependence on a third party. The Liquality stack includes:
- Nodes [Bitcoin, Ethereum]
- Block explorers [Liquality Transaction API, Esplora]
- Exchange rates fees [Configurable options]
Try out our products on mainnet: