By Mikael Ohlsson, software developer at Scila
The crypto currency market is once again hitting a rough patch as the integrity of a few crypto currency exchanges has come into question. This may lead to investors demanding their funds to be held by better managed companies, or perhaps make them look in the other direction, to Decentralised Finance (DeFi) services.
Automated Market Making
Like everything else in the crypto currency space, allowing trading of digital assets in a decentralised manner is a recent invention. The most commonly used underlying technology of Decentralised Exchanges (DEX) is called Automated Market Making (AMM) where liquidity providers lock their funds into a “smart contract” referred to as a “liquidity pool”, of which traders are then able to interact with to swap one asset for another. The pricing of the assets in the pool are completely handled by the smart contract and is calculated by a fairly simple mathematical equation based on the relationship between the amount of the two assets in the pool.

So when a trader swaps asset A for asset B, more A is added to the pool while asset B is taken out, changing the relationship between the amounts of the two assets and in turn raising the price of B for the next trader to interact with the pool. The participants providing liquidity do so to earn a yield based on the trading fees paid by the traders and so there is an economic incentive for all the actors participating in the market hosted on the DEX.
Order Book Trading
In 2022 we have seen even more DeFi services launching on various blockchains. Multiple DEX:es have recently launched which not only provide just AMM type trading, but also order book based models functioning in the same way as trading conducted on traditional financial markets. Examples of such exchanges are Algodex launching on the Algorand blockchain, Polkadex which became a parachain on Polkadot earlier this year, Spectrum Finance which eventually aims to tie into both the lesser known Proof of Work (PoW) blockchain Ergo and the better known Proof of Stake (PoS) chain Cardano and MuesliSwap which has already launched on Cardano.
Order book based trading of digital assets is of course highly anticipated by the crypto currency community and will likely track the attention of members of the traditional financial market because of its familiarity. One of the hurdles of implementing order based trading on a public blockchain is to handle the sheer magnitude of transactions that one can expect a successful exchange to attract, especially considering trading by HFT bots. As anyone familiar with the Ethereum blockchain is aware of, transaction fees can become extremely expensive when a blockchain becomes congested, which is why it makes sense for the order book based exchanges to host the order book off-chain and only to commit trades on-chain when necessary, or use otherwise clever on-chain methods to prevent network congestion.

Market Surveillance of Decentralised Exchange Trading
Regardless of how exchanges implement their order books, they will all risk subjection to the same old tricks of malicious actors trying to part fools, and folks, from their money. Up until now, trading on DEX:es has had fewer, or at least other, attack vectors because of the design of the AMM trading model. Order book based trading opens up the opportunity of anyone with the know-how to manipulate the market via its order books. As the decentralised market expands, DEX:es will need to mature as both retail and institutional investors eventually will come to expect the same sense of security trading on decentralised and centralised exchanges. If the market does not self-regulate and does its best to protect investors from market manipulation the already agitated financial market regulators across the world will gear up and do their best to intervene on behalf of their citizens, much to the libertarian crypto currency idealists despair. Implementation of some type of market surveillance will become necessary to protect market participants from market abuse such as layering, ramping and front running regardless of the organisational form of the development team – being registered as a non-profit, Decentralised Autonomous Organisation (DAO) or a traditional company.
Order book trading being just the latest addition in the DEX arms race, market surveillance doesn’t yet seem to be top of mind among the development teams focusing on time-to-market. On the other hand, (seemingly few but) clear attempts are being made across the industry to comply with the rules of the established financial markets. Polkadex for example are working on a decentralised version of KYC with the aim to be compliant with the anti money laundering (AML) regulation in Estonia.
At the core, trust in the financial markets comes from transparency. Traditional exchanges achieve this in large part by reporting to regulatory agencies, providing information about suspicious transactions and behavioural patterns of participants trading on these markets, all while keeping customers’ trading activity private from the eyes of the general public. DEX:es however do not have this luxury.
To provide confidence to both retail and institutional investors that they are not being conned by malicious actors manipulating the orderbook or other internal functionalities of the exchange, it is absolutely essential that DEX:es provides a fully transparent and expressive Application Programming Interface (API) where data can be queried for deep analysis. It is not enough to provide a simple API that enables programmatic trading for retail investors and HFT firms. In fact, much more data about the orders and trades must be available to provide effective market surveillance. You do not only need the current state of the order book, but all events such as order inserts, updates and cancels. You also need to be able to link these market events together with the acting participant. With that said, it does not have to be linked in a way that reveals the participants’ full identity, but without some type of common identification for the trading activity of a participant it is anyone’s guess if interactions with the order book are of good or ill intentions.

In summary, retail and institutional investors alike might have to prepare for the wild west that is the incredibly innovative and fast growing DeFi sector to become a little wilder before it gets as comfortable as the traditional financial markets.
About Scila
Scila AB is a leading software company in providing market surveillance, AML and risk management tools to the financial and energy sector. Among them are clients dealing with crypto currencies like the digital asset trading platforms Archax and D2X, as well as other larger crypto currency exchanges and brokers.
