How to swap XMR <> BTC privately on pDEX with normal rates (practical instruction)

Incognito pDEX is the first-ever private cross-chain decentralized crypto exchange in the blockchain space. In the current phase, the interoperable setup of pDEX with non-Ether cryptocurrencies such as Bitcoin or Monero is still trusted. However, after turning your BTC or XMR into their privacy version via the trusted bridge, you can still swap XMR <> BTC back & forth with no one able to track your swapping activities on the DEX thanks to the trustlessness & privacy by design of pDEX. So currently, think of pDEX as an improved experience of trusted swapping services such as changenow, MorphToken or xmr.to with the anonymity going along.

After turning BTC & XMR to privacy version, now you have pBTC & pXMR in your hand. If you put them into pDEX and do the swap now, you might encounter unexpectedly bad rates because of the small liquidity pool sizes of pBTC <> pXMR pairs. The purpose of this article is to recommend you a way to swap XMR <> BTC on pDEX with normal rates: using PRV as the middleman and your swap can be done on 2 pairs PRV <> pBTC and PRV <> pXMR.

How Incognito pDEX works

Let’s mention a bit of how pDEX works. The order matching method on pDEX is automated market maker algorithm, which is the same as the order matching method of Uniswap. You don’t exchange your coins with anyone’s but with the liquidity pools

Let’s say you are trading the pBTC <> pXMR pair with the 2 liquidity pools of pBTC & pXMR. When you use pBTC to buy pXMR, it means that you send your pBTC into the pBTC pool and the pXMR you get will be extracted from the pXMR pool. The similar thing happens when you use pXMR to buy pBTC. The rule here is

Current pBTC pool size x Current pXMR pool size
= New pBTC pool size x New pXMR pool size
(new pools means the pools after your trade)

From the mathematical perspective, since the equality above needs to be maintained, you can see that the larger pBTC or pXMR you send in the pools, the huger the changes you can make of the pool sizes. If you trade with a very big amount of assets compared to the current pool sizes, you can end up getting the unexpectedly higher exchange price compared to which on other public exchanges. For example,

The 2 current pool sizes are 0.01 pBTC & 0.66 pXMR.
You swap 0.1 pBTC to pXMR
=> 2 new pool sizes are 0.11 pBTC & 0.06 pXMR
('cause 0.01* 0.66 = 0.11*0.06)
=> You exchange 0.1 pBTC to 0.6 pXMR (0.66-0.06)
=> The price you get is 1 pXMR = 0.166 pBTC, much higher compared to the price on public exchanges (1 XMR = 0.0072 BTC)

Swap privately XMR <> BTC (practical instruction for the present)

The pBTC and pXMR pool sizes used to be quite high, enough for you to trade back and forth pBTC & pXMR with normal volumes & rates. On April 10th, the day we launched the pDEX mining program for PRV-related pairs, it seems like folks withdrew liquidities out of the pBTC <> pXMR pair to add liquidities to PRV <> pXMR and PRV <> pBTC pairs, an activity which is purely market-driven and isn’t controlled by anyone.

At the moment, you should use PRV as the middleman when privately swapping XMR <> BTC. The liquidity pools or PRV <> pBTC & PRV <> pXMR are large now and you can trade pBTC & pXMR to PRV without getting unexpectedly high price. So for example, to trade pXMR to pBTC, you trade pXMR to PRV and then trade PRV to pBTC .

XMR

Step 1: Trade 1 pXMR to PRV

Current pool sizes of pXMR <> PRV are 175.6 pXMR & 17,718.28 PRV.
You put in 1 pXMR into pXMR pool
=> 2 new pool sizes are 176.6 pXMR & 17,617.95 PRV
(175.6 * 17,718.28 = 176.6 * 17,465.95)
=> You exchange 1 pXMR to 100.33 PRV (17,718.28 - 17,617.95)

BTC

Step 2: Trade 100.33 PRV to pBTC

Current pool sizes of PRV <> pBTC are 123,147.1 PRV & 8.93 pBTC.
You put in 100.33 PRV into PRV pool
=> 2 new pool sizes are 123,247.43 PRV & 8.923 pBTC
(123,147.1 * 8.93 = 123,247.43 * 8.923)
=> You exchange 100.33 PRV to 0.0073 pBTC (8.93- 8.923)

Finally you end up exchanging 1 pXMR = 0.0073 pBTC as you do on public exchanges. Then here you go, swap XMR <> BTC in confidentiality with normal rates!

4 Likes

Hi Jason. I read your post on Reddit and your chat in Monero group. I tried out pDEX. The experience when trading is good but I got stuck when I withdrew XMR. The support team helped me and I got back XMR but if the setup is still trusted, I think the smooth withdrawing is crucial to not make users like me think you are doing some bad things with my fund. I would angry if the exchange holds my money and doesn’t let my money go.

I was impressed my the tech you are implementing. I have some feedbacks, hope that it can be heard

  • How the privacy on pDEX is expressed?
  • It is comical to use a ‘private exchange’ on the spy Google f-droid. Do you have a desktop wallet?
  • If we talk about trusted service like morphtoken or shapeshift, the experience is very convenient, only 1 send transaction and I get coin in my wallet. With pDEX, I need to do many steps. Do you plan to make it more simple?
  • I added myself some liquidity for BTC <> XMR but I withdrew it because no reward for me add liquidity there. I can move my money to other PRV pairs. Yes, you are correct, there are people like me and the liquidity of XMR BTC decreased. Do you plan to run the same reward program on XMR BTC pair?
  • Do you have dark mode?
2 Likes

Hi @uche_franc. First of all, I’m so sorry about your withdrawal experience. Recently, there has been a spike in the number of transactions on Incognito chain. The network congestion might make you wait for the withdrawal transactions to be confirmed a few more minutes. Thanks for bearing with us!

Let me answer your questions

Let’s say you have BTC or XMR in your Incognito wallet address now. When you trade them on pDEX, your BTC or XMR are automatically transferred to another random Incognito wallet address, which is named ‘your pDEX account’. Since on-chain transactions are all confidential, no one, even us, is able to know your pDEX account. You will trade BTC & XMR from your pDEX account, not from your original Incognito wallet address. For us, the database on pDEX just looks like many random wallets trading with liquidity pools and there is no connection between these random wallets with any Incognito ID or real-life iD of users. This is how the privacy works on pDEX.

I think this point is valid. That’s why we are planning to make another version of Incognito wallet in Q2. The mobile wallet brings you the convenience and to be honest, deploying cryptographic primitives like ZKP on mobile is much harder than doing the same thing on the web. Seems like we made the decision to do the hard thing first :sweat_smile:

I think a bit of inconvenience you were mentioning comes from the transfer public cryptos to privacy cryptos lying on the privacy layer. In the whole process, this opening step bringing you the privacy is very important. The same step can be seen in other layer 2 products. So, my answer for this is that it’s just a price for privacy.

I think this point is worth considering. I’ll have a discussion with andrey on whether we should run a same pDEX mining program with the pBTC <> pXMR pair, so that users can swap XMR <> BTC privately in a more direct manner.

FYI, the by-user liquidity adding and withdrawing is purely market-driven and we just can’t control it. We are working on the in-app notification for unexpectedly bad rates users can encounter with low-liquidity pairs.

haha I personally love dark mode like you. However, since there hasn’t many users giving feedback on that, we have put dark mode in the pipeline but it’s not our priority now.

2 Likes

Thank you @jason. I look for the new version of the app. What is this new version anyway? Are you working on web app or desktop app?

Hey uche, the version I’m mentioning is the web one. It would ease the integration with other products on the crypto space, which I think would very hard with a desktop app. Can you recommend us any more version of the Incognito web that we should make? :grinning:

Got it. My recommendation is the desktop app proves the privacy the best. I made some BTC XMR trade on pDEX but believe me trading it on a desktop app would help you to bring more guys in Monero community. Still looking forward to the web app.

Great advice. Desktop app is in the pipeline!

3 Likes