pDEX: The first privacy-protecting decentralized exchange

The first generation of exchanges includes centralized exchanges like Binance and Coinbase. The second generation of exchanges comprises of decentralized exchanges (DEX) like Bancor, Kyber, and Uniswap. pDEX is an upgraded DEX. Like decentralized exchanges, it is trustless. It also implements additional features such as privacy via zero-knowledge proofs, high throughput via sharding, and inter-blockchain trading via interoperable bridges.

DEX pDEX
Trustless YES YES
Privacy NO YES
High throughput NO YES
Low latency NO YES
Inter-blockchain NO YES

Trustless

pDEX is code (beaconpdeproducer.go, beaconpdeprocess.go) that is deployed to thousands of Nodes powering the Incognito network. It runs entirely on-chain and is completely decentralized.

The Automated Market Making mechanism of pDEX is somewhat different from typical exchanges. This post offers a high-level overview of the mechanism and argues for its major advantages. pDEX borrows heavily from Nick Johnson’s reddit post in 2016, Vitalik Buterin’s reddit post in 2016, Hayden Adam’s Uniswap implementation in 2018.

pDEX does not use an order book. Instead, it implements an Automated Market Making algorithm that enables instant matches, no matter how large the order or how small the liquidity pool is.

Trading on pDEX

The traditional order book is replaced by a bonding curve mechanism known as constant product. On a typical exchange such as Coinbase or Binance, market makers supply liquidity at various price points. pDEX takes everyone’s bids and asks, and pools them into two giant buckets. Market makers no longer specify prices at which they are willing to buy or sell; pDEX automatically creates markets based on an Automated Market Making algorithm.

Here is a simple example of how trading plays out on pDEX. Let’s say there is 100,000 DAI and 10 BTC currently in the pDAI/pBTC pool. The goal is to keep this product equal to 1,000,000 at any trading volume.

DAI pool : 100,000

BTC pool : 10

Constant : 10 * 100,000 = 1,000,000

A buyer sends 10,000 DAI to buy BTC. A fee (in this example, 0.1% or 10 DAI) is taken out for liquidity providers, and the remaining 9,990 is added to the DAI pool. The constant product is divided by the new amount of DAI in the liquidity pool to determine the new BTC pool. The buyer receives the remaining BTC.

Buyer sends : 10,000 DAI

DAI pool : 100,000 + 10,000 = 110,000

BTC pool : 1,000,000 / 110,000 = 9.090909

Buyer gets : 10 – 9.090909 = 0.90909 BTC

The price has now shifted. A buyer who makes a trade in the same direction will get a slightly worse BTC/DAI rate. A buyer who makes a trade in the opposite direction will get a slightly better DAI/BTC rate.

Becoming a liquidity provider

Liquidity providers play an essential role. As the name suggests, they provide liquidity to various pools on pDEX and earn rewards. More info here.

Inter-Blockchain Liquidity

pDEX leverages Incognito’s bridges to other blockchains like Ethereum and Bitcoin to enable inter-blockchain trading. So you can trade BTC and ERC20 tokens on pDEX – with complete privacy.

When the pDEX launched at the end of 2019, the Incognito <> Ethereum Bridge was the only trustless bridge on the Mainnet. With the recent launch of Portal, other bridges are now migrating to a trustless implementation.

Bridges Current Implementation
Ethereum <> Incognito Trustless
Bitcoin <> Incognito Trustless
Binance <> Incognito Trustless
Polkadot <> Incognito (TBD)
Cosmos <> Incognito (TBD)

Privacy

All transfers are private by default on the Incognito network. The user can freely trade without disclosing their identity. Read how Incognito achieves privacy.

High Throughput

pDEX leverages Incognito’s sharded architecture to deliver high throughput. The workload is shared among shards and trades are processed in parallel. Incognito’s throughput scales linearly by adding more shards, so it can grow to support large transaction volumes. Read about privacy at scale.

Low Latency

One of the benefits of Automated Market Making is instant matching . If you enter an order, it will match right away. The current block time of Incognito is 40s.

Once the block is produced on a shard, it is sent to the beacon chain, which takes another 40s. A trade will complete within 80s. Incognito plans to reduce the block time to 10s, once transaction size is further optimized.

Conclusion

Along with trustlessness, pDEX combines several advanced technologies like zero-knowledge proofs for privacy, sharding for high throughput, and interoperable bridges for inter-blockchain trading. We hope that pDEX will be a helpful product for the crypto community.

15 Likes

When I provide PRV liquidity to pDex, it didn’t ask me which pool I am adding liquidity to. Does it mean that the PRV liquidity is shared across various pairs?

Hey, this was for our first instance of liquidity providing, which at times caused impermanent loss.

You can still add liquidity to a specific pool by providing both sides of the trade as liquidity. This is now called Add on the incognito app.

Provide is our newest mechanism, which was built to make it simpler for users to provide liquidity as well as to remove that impermanent loss factor. For provide, this is the best place to start: Pool

-Hope that helps!

1 Like

Thanks! Now I understand how the “Provide” function and “Add Liquidity” differ. Apart from the link you shared, is there any other article which can help me understand how the “Pool” really works under the hood?

1 Like

Unfortunately, i believe there isnt documentation yet But you can always try the seach bar on the forum and type “Pool” for some more info.

Hi @culgin there are several difference on how Provide & Add works. Here are high-level diagrams. Hopefully, it helps you to see the bigger picture.

Provide

Incognito-Povide

Add

Incognito-Page-6

You can see that “Provide” has additional functionality while “Add” interacts directly with the network.

5 Likes