Research Sprint: Polkadex

Motivation

This research sprint was undertaken as part of GDA’s gap analyses on development in the field of decentralized exchanges. In particular, this article takes a deep dive into Polkadex. Polkadex is a decentralized peer-topeer orderbook-based cryptocurrency exchange for the DeFi ecosystem built on the Substrate framework. They intend to augment the traditional DEX architecture by introducing on-chain AMM bots to the system to address several issues discussed in this sprint.

What problem are they trying to solve?

Generally speaking, order book based decentralized exchanges (DEX) do not facilitate many of the features that an advanced trader would ideally make use of, such as high-frequency trading. Order book based DEXs also suffer somewhat from a liquidity issue, as functionality for liquidity provision is somewhat limited. While Ethereum smart contracts theoretically facilitate decentralized finance (DeFi), computational limitations inhibit their actual implementation for functional DEXs. Automated market makers (AMM) were partly created in response to the limitations of both computation and order book based DEXs, however, AMMs require order books, while order books do not require AMMs.

How are they aiming to solve this problem?

Polkadex believes that order book based DEXs can be supplemented with AMMs, fast execution logic, three-second block time, custom trading, bot support and on-chain market making bots (AMMs inside a DEX). They aim to address this by presenting a Substrate blockchain framework which allows users to create application-specific blockchains, avoiding the technical aspects of block production and consensus. Substrate is a modular blockchain framework on which Polkadot (and other chains such as Edgeware and Kusama) are built. It is a rapid, user-friendly framework which enables WebAssembly smart contracts, multi-level permissioning, account level-locking and governance tools.

Polkadex intends to reduce the complexity of the chain, following a philosophy where “only those things that need public verifiability need to be on-chain” — a similar concept to Ethereum 2.0’s Optimistic Rollups. In Polkadex, the on-chain components consist of:

  • Order Book
  • Trader Assets Management
  • Bridge mechanism to Polkadot and Ethereum
  • On-chain market making bots

While the following trading features reside off-chain:

  • Market data aggregation
  • Technical analysis indicators
  • Storage and retrieval of trade history
  • Any other exchange related features

Keeping only crucial architecture components which benefit directly from the security principles of blockchain allows for higher throughput of trades, leading to performance comparable to the efficiency of centralized exchanges.

Polkadex supports limit and market order trades. Market-taking orders incur a 0.2% fee, while market-making orders are free. Market makers are incentivized by rewards of 50% of trading fees in their trades, the remaining 50% goes to the Polkadex team. Due to gas fees, smart contract based trading bots are not economically feasible on DEXs, to facilitate trading bots on-chain, Polkadex charges zero network fees. This is made possible by distributing an extra 0.1% to market makers on their trades, and taking 0.2% from market takers.

However, gas fees exist primarily as a defence mechanism against malicious activity such as spam and distributed denial of service attacks (DDoS), thus, a zero fee network is theoretically vulnerable to such attacks. Polkadex circumvents this issue by classifying transactions and incurring network fees if a potential DDoS is identified. This classification process is based on which network fees are levied from traders, classifying trades as potential DDoS attacks if the execution results in:

  • Invalid Price/Quantity Error
  • Insufficient Balance
  • Invalid Trading Pair
  • Invalid Order Type
  • Very Small price and Quantity

­The performance of this gas fee alternative will be dependent on the accuracy of their classification methods and the effectiveness of their maker and taker fees as a preventative measure against malicious agents. Should this prove effective, it is a promising workaround in lieu of gas fees.

What features do they provide?

In an address to the problem of low liquidity in order book based DEXs, Polkadex presents on-chain market making bots (AMMs) inside of their trading engine, where traders are able to provide liquidity for their preferred AMM curves such as constant product. When a trade is not matched against the Polkadex order book, the trading engine calls its on-chain market making bots to perform a check to make an order that will match.Trades are only executed if the on-chain bots provide a better price, otherwise it is inserted as a market-making order in the order book. This protects against price slippage for traders.

In the first iteration of Polkadex, market making bots will use a constant product AMM curve. These trading bots have access to remote procedure call (RPC) data provided by the full nodes to retrieve market data for specific blocks. Technical analysis of this market data can be done by traders, client side or in the cloud. Traders may also employ their own custom trading algorithms and techniques.

In order to source liquidity, Polkadex incorporates the Polkadot Parachain and Snowfork trustless Ethereum Bridge.

The Polkadex parachain bridges liquidity between Polkadot and Polkadex, allowing traders to bring liquidity without trusting their assets with a centralized service, or the Polkadot team. All assets are secured by Polkadot’s interoperability layer.

Polkadex intends to incorporate the Snowfork trustless Ethereum bridge, allowing traders to lock their assets on Ethereum via smart contracts, and bridge that liquidity to Pokadex. No third parties are involved and all assets are locked by the chain.

The Polkadex order book uses a layer 2 trusted execution environment (TEE) on top of Polkadex which is used for maintaining the order book. The TEE produces cryptographic proofs, in the event of tampering, the blockchain can invalidate the proof by not accepting the submitted tampered state. Users’ funds always remain in the native blockchain, ensuring that only their private key can initiate a balance transfer.

Polkadex scales to 500k transactions per second with sub-millisecond latency, enabling on-chain high-frequency trading, while still taking advantage of the benefits of centralized exchanges and the security of blockchain.

The Polkadex IDO pallet allows token projects to create ERC-20 like tokens with built-in support for parachain transfers.

Polkadex supports fiat currencies in their order book, allowing traders to purchase cryptocurrency with standard currencies.

Upgrades and updates for new features do not require hard forks.

Polkadex makes use of IPFS to store snapshots of the state of balance transfers as a last line of insurance against hardware corruption, loss of network access or malicious operators. In such an event, the blockchain rejects all future transfers from the order book and returns funds to users within 12 seconds.

Tokenomics

An overview of Polkadex’s token distribution philosophy is given below:

The Polkadex native token serves the following utility functions:

  • Pay transaction and trading fees to get discounts on them
  • Participate in Polkadex IDOs
  • Participate in on-chain governance of the network
  • Become a validator of the network by staking
  • Nominate validators and collators of the network

App Demo

Closing Statements

Polkadex comes across as quite a promising project, particularly in its enablement of high frequency trading via on-chain automated market making bots, and in converging the benefits of decentralized and centralized exchanges.

Author: Jack Lodge

References

[1] Documentation 📚. Polkadex, 2021. Accessed: Nov. 08, 2021. [Online]. Available: https://github.com/Polkadex-Substrate/Documentation/blob/500669e72a5126f078ab767ea543378a65221308/polkadex-lightpaper.md

[2] “Welcome to Polkadex.” https://www.polkadex.trade (accessed Nov. 08, 2021).

[3] “Vision | Polkadex Docs.” https://docs.polkadex.trade/ (accessed Nov. 08, 2021).

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
GDA Fund

GDA Fund

222 Followers

GDA is developing the decentralized financial application development environment and rapid financial engineering protocol built on Ethereum.