Firstly, Let's buy some Decred (DCR) with our Litecoin (LTC). I’ve gone ahead and unlocked the advance options. Toggle open the link to see all three.
In this case, placing my order, requires an over lock of 0.086 LTC on top of my 0.38 LTC bid. By activating this option, the overlock will be reduced, but for several reasons it’s best to not select this option.
How pre-size funds work is related to your utxos (unspent transaction outputs). Balances on utxo-based blockchains, such as Decred, Litecoin, and Bitcoin, are the result of summing up all the utxos, and it’s also worth knowing that each utxo is an arbitrary amount. For instance, whenever you spend coins on-chain, you're really spending some combination of those utxos and creating a change output (a new utxo) with the difference, less the transaction fee.
An example of this, is if the price of something is £15, and to make that payment you pay with two £10 notes. The change of a £5 note is the new utxo.
When you make a trade with an atomic swap, you're spending coins or utxos to a smart contract and locking the entire value of those outputs until the trade completes.
Image, you only have a single large utxo, in this instance, the entire amount is locked until the swap completes. After this, the change comes back.
The “pre-size funds” option, in reality, creates two transactions behind the scenes. The first transaction spends the large utxo, splitting it into two outputs. The first is an output (utxo) with the exact amount needed for the trade, and a second output (utxo) is the change of whatever is leftover. The second transaction then spends the output with the exact amount required for the atomic swap contract. Since the first transaction is just a regular transaction, you immediately have its change available to spend.
The big downside is that you have to pay more on-chain transaction fees because it's two on-chain transactions instead of just one. That’s why you generally should NOT check that box unless you really and truly need to spend the change before the swap completes.
For this advance option, we need to remember that atomic swaps have two parts to the settlement process, the initial swap and the redemption. The Fast Swap option deals with the initial swap, in this case Buying DCR, which requires LTC fees.
The default amount of LTC is 1 litoshi/vB (or the smallest unit, e.g. 0.00000001 LTC). In times of congestion, you might have to increase this amount to 2litoshi/vB. Recently, on the Litecoin blockchain, I had a transaction that got stuck for over two hours, by moving the fee up on a consecutive trade, the transaction completed with no delay issues.
The same issue is true for the redemption part of the atomic swap. Raising the rate is useful during times of congestion. In this case, there is no need to raise the rate because the DCR blockchain is not congested. But we’ll need to look at this in the next trade when we buy Litecoin.
Settling the order
With fast swap activated, we’ll settle the order. On the Litecoin chain, this increase in fees is still only a fraction of a penny. We'll have a look at this after our next trade.
This time we’ll sell some DCR to buy Litecoin. You’ll notice the fast swap is priced in DCR and the fast redemption is priced in LTC. We can leave the fast swap as is but increase the fast redemption. Deciding on whether you need to use the fast swap and fast redemption will depend on if the blockchains you are using are congested or not. To find out this information, consult the relevant block explorers.
Let’s have a look at the price for a 2 litoshi/vB swap and redemption. This first transaction is the swap, which needed LTC and cost 306 litoshi’s.
The second transaction is the redemption, also in LTC and cost 286 litoshi’s. If we copy and paste this amount into a conversion calculator, you’ll see the price is $0.000221.
To contrast this, let’s look at how much this would have cost at 1 litoshi/vB. First, the swap transaction, which cost 153 litoshi’s. And the redemption transaction, which cost 143 litoshi’s. Let’s copy and paste this amount into a conversion calculator to see the price is $0.000110. Even after combining this amount with the DCR’s fees, the full settlement costs less than a fraction of a penny.
Hopefully, that helps explain how to use the advance trading options and will make your DCRDEX trading experience even smoother.