User Incentives on Decentralized Cryptocurrency Exchanges (with BarterDex as an example). Part 2. After the Process Starts

After the Process Starts


A deposit from liquidity provider

Once liquidity provider Bob accepts a trade offer from Alice, he needs to send a deposit in the amount of 112.5% of the transaction to BarterDex. At this step, if Alice does not proceed with the next step, she will lose her transaction fee and get a negative review on her public BarterDex profile.

Bob will get his deposit in full back from BarterDex, so at this stage of the process there is no risk for Bob and the only scenario in which Alice loses something is when she chooses not to proceed with a transaction that she has previously agreed to participate in.


Liquidity receiver releases the funds

The next step in the atomic swap process is Alice sending the funds designated for the transaction to a special escrow BarterDex wallet. If Bob bails at this point, the protocol of the exchange will allow Alice to claim Bob’s deposit. Since the deposit is 12.5 more than the amount of the transaction, at this point Bob is really motivated for the transaction to go through, yet if something goes wrong, Alice has nothing to fear because there is no scenario at this step in which she loses money. There are only two scenarios for Alice at this stage: in one of them she gets 100% of the money, in another one she gets 112.5%, both of which are very attractive.


Liquidity provider releases the funds

During this step, Bob releases the funds for the transaction. These funds need to come from a UTXO in his wallet that is equal to 100% of the transaction (this UTXO is different from the 112.5% deposit UTXO). If Alice does not claim the payment from Bob within two hours of Bob releasing the payment, Bob can claim the payment. He can also claim his deposit back in additional two hours, four hours after he releases the payment to Alice. All of this means that Bob’s money is safe no matter what Alice chooses to do.

All the steps of this transaction become part of users’ public records on BarterDex, which means that in addition to risking their money in case of misbehavior, they also risk their reputation. It is also important to note that the protocol of the decentralized exchange always performs steps in proper order, which means that the funds of the parties are always safe and secure.


Liquidity receiver moves the funds of the provider

At this step, Alice moves Bob’s funds from a secure BarterDex wallet to her own wallet. At this point, there is no risk for Alice whatsoever because the exchange has Bob’s funds in a secure wallet. It doesn’t matter to Alice at all if Bob claims his funds that came from her, because she has already received the money that she was supposed to receive.

Bob at this stage can’t hurt Alice at all and can only hurt himself. His goal is to withdraw the money that BarterDex received from Alice. If he doesn’t do that, Alice can claim his deposit in addition to having previously claimed his payment. If Bob realizes later that he made a mistake, he will be able to get the money that Alice has sent him, but his deposit may be gone (if Alice claims it).


Final steps by liquidity provider

If everything goes according to the plan, by now Bob has claimed the payment from Alice and he can now claim his deposit and get it back. If he doesn’t claim his deposit within 4 hours of transaction, Alice can do so, which means that liquidity providers are interested in acting quickly and getting their money back as soon as they can.

Once Bob gets his deposit back, the atomic swap is over. Alice paid a transaction fee and received a payment from Bob and Bob received a payment from Alice and got his deposit back. Both Bob and Alice had incentives to move on with the transaction during all stages of the process. In addition to this, the urgency of completing the transaction has also been increasing. In the beginning Bob could have lost his deposit if he were to act irresponsibly. At the end, he could have lost the deposit if he were to simply not act in a timely manner.


Scalability and unforeseen circumstances

One of the biggest benefits of the process outlined in this article is that the process is not dependent on a single cryptocurrency. It can work with a wide variety of currencies and coins. A trade that doesn’t complete right away can carry on for as long as the BarterDex protocol allows.

At the same time, the implementation of the protocol is not as easy as this article may have made it look like. Generally speaking, it is somewhat easy to create the software and then run tests with two or even multiple currency swaps. Opening such a decentralized exchange to users worldwide is a completely different matter because on a live decentralized network it is impossible to guarantee that users who want to trade will receive relevant matches.

For example, a person may see a potential trade on the network, but by the time the person replies, someone else would start the trading process, by this leaving the person in the original position. The number of real-world scenarios for how and why the initial connection may not happen or be interrupted is huge, but once a connection is established, the process can proceed very reliably and safely for users.

Naturally, there may be outside forces that prevent users from completing transactions even when users have full intent to finish. For instance, participants in a trade may have an Internet outage or an electricity outage. Because the exchange is decentralized, the rules stay in place even if a user can’t complete a transaction because of unforeseen circumstances. Just like with Bitcoin, there is no support phone number to call, no office to stop by and no employees that could help. Transactions are irreversible and the process has to continue no matter the personal circumstances.