This is a primer on marketplace design, market microstructures, and market-making from our combined 30+ years of experience in electronic trading at Tower, Citadel, Goldman Sachs and SGX. Whether you are a trader, a project launching a token, or an academic, we hope you find this four part series useful.
Part I: Marketplace Design: General theories and background information
Part II: Crypto Marketplaces: A discussion of some of the unique features of crypto marketplaces and how they are distinctive from traditional financial exchanges
Part III: Market-Making on Crypto Marketplaces: What does market-making actually mean, and how does it work?
Part IV: How to Work with a Market-Maker: Choosing and working with the right partner
Table of Contents
Since 2010, a new kid on the block emerged in the form of “crypto exchanges”. Starting as nothing more than an online marketplace for the exchange of magic cards, MtGox subsequently introduced Bitcoin trading and quickly grew to become the dominant exchange of its time, availing the new asset class to millions of users with as little as $1 in their pockets. Over the following decade — marked by a plethora of booms and busts, scandals and controversies — crypto exchanges leapfrogged their traditional finance peers to offer superior design and user experience via all possible surfaces: from web to mobile and even APIs exposed directly to end users.
How crypto exchanges differ from traditional financial exchanges
Three major distinctions (both to the advantage and detriment of crypto exchanges) set them apart from their cousins in traditional finance.
1. The asset class itself
Unlike stocks, cash, and commodities, which need to be held by a broker, a bank, or a warehouse, crypto assets are accounted for on a blockchain — a giant “book” continuously synchronized between numerous “book-keepers” called nodes. The advantages of not having to entrust a single entity with one’s asset holding has been made evident many times.
Consider these recent examples from traditional finance: MF Global, a broker and a prop trader, whose commingling of funds in 2011 caused losses for clients to the tune of billions of dollars. Or that time when the newly elected Venezuelan government got cutoff from their gold held in reserve by the Bank of England due to political disagreements with the UK. In 2014, a scandal broke out at a Qingdao metal warehousing, when it transpired the copper certificates had been duplicated and pledged multiple times as collateral, resulting in a cascade of losses for depositors and traders all over the world and triggering the exposure of more “holes” in a web of warehouses.
What all these cases have in common is the fact that a central authority was entrusted with the custody of the assets, and, due to fraud or politics, breached its the fiduciary duty. Usually the public only discovers such breaches of trust after they’ve gone on for months or even years, which means that even as you read this sentence, there are likely more breaches happening.
The blockchain addresses the above problems in that an asset holder need not trust any single entity, but rather the majority of nodes — an admittedly lower bar. Yet that exposes the asset owner to a whole host of different risks like loss, theft of keys, or sybil attacks. There are stories of folks sifting through landfills in search of lost Bitcoin. And as for granting one’s private keys to a third party for safekeeping, this gets us back to the very problem that crypto was invented to fix.
2. Disintermediation
Unlike crypto exchanges, which onboard retail users directly, traditional financial exchanges only have brokers as clients. The reason for that is rooted in history. In the distant past, exchanges were formed as associations or “mutuals” for members of one particular industry or guild. Their direct members were themselves corporations or professional traders, who in turn liaised with retail clients.
Crypto exchanges were born in the time of the internet — the ultimate disintermediator delivering any service directly to the doorstep of users. That has allowed crypto exchanges to grow exponentially, on-boarding hundreds of millions of users from all over the world in the span of a couple of years. This proximity to retail users has also allowed crypto exchanges to iterate quickly on product design and to be more innovative.
The downside of disintermediation is that it places the onus of “know your client” (KYC) squarely with the crypto exchanges, whereas in traditional finance this work and these risks are outsourced to the brokers. To some extent, the brokers insulate the exchanges from the clients and vice versa. Removing this layer of brokers introduces risks for both sides. The exchanges take on risks stemming from illicit uses of the platform, e.g. for money laundering, and retail users assume risks stemming from the exchange operator’s ability to seize their fund at will.
3. Governance
The third — and arguably most critical — distinction between crypto and traditional exchanges is the form of governance. In contrast to traditional exchanges which are subject to heavy oversight by regulators and multiple layers of internal and external risk controls, crypto exchanges are almost always privately owned and controlled by a handful of individuals, have a tendency to incorporate in exotic island-countries, and sport minimal internal safety checks. This has led to some notable financial debacles, most notably the fall of iconic players MtGox in 2014 and FTX in 2022.
In the context of governance, it is important to distinguish between :
- centralized exchanges, like Binance, which are managed and owned privately and which partake along the entire value chain — trading, clearing, and custody; and
- decentralized exchanges, which are governed by an entire community as DAOs, and which generally specialize in one area of the value chain.
4. Availability
Cryptocurrencies were practically incepted as 24/7/365 and were always accessible from anywhere in the world. The blockchain never sleeps, and neither should the exchanges dealing in crypto. No other market before crypto, not even FX as a global market, has come close to this level of temporal and geographical breadth.
5. Technology
In some ways, the crypto markets have leapfrogged previous technology. The market was electronic from day one, leapfrogging the eras of shouting on a trading floor, shouting in a phone receiver, and shouting over messaging boards. From the onset, crypto exchanges availed the market via APIs (restful at first and streaming later), disintermediating the broker/dealers and doing away with the shouting. To no surprise, it was the traditional high-frequency trading (HFT) firms who were the first to migrate to crypto.
However, in other ways centralized crypto exchange trading engines and APIs are slow by comparison to the engines produced by Nasdaq OMX and Cinnober. They have been built around websocket communication with the retail user in mind (web and mobile first), and they may adequately address said retail users’ needs. Yet they are no match for industrial grade engines that power the likes of NYSE and Nasdaq, which utilize low latency ITCH/OUCH protocols. One consequence from this is that the trading competition in crypto happens in the milliseconds, while HFTs in the traditional stock market compete in the sub-micro second level (i.e. in nanoseconds) — several orders of magnitude faster.
How major exchanges function differ between DeFi and CeFi
The original blockchain — Bitcoin — gave us a real-time synchronized ledger; later on, Ethereum gave us an entire Turing-complete state machine, enabling the porting over of entire functions of the financial industry onto the blockchain. Now, a smart contract can act as a bank, clearer, a matching engine, or even a market maker. That opened the door to whole new industry, which over time became known as Decentralized Finance, or DeFi. Some of the first players in the DeFi space were the decentralized exchanges (DEX) — essentially smart contracts that perform some (or virtually all) of the functions of their centralized exchange (CEX) brethren.
Arguably, DEX differ from crypto CEX in many more ways than crypto CEX differ from traditional exchanges. We’ll take a look at the three main functions of an exchange and how they compare between DEX and CEX.
But before we delve into it, we must address the most salient features of a blockchain first: it is slow. Yes, the blockchain is safe and unhackable; yes it is 24/7 and does not require human intervention to run. Yes it is fail-safe, as it relies on a multitude of nodes to run. But precisely those requirements come at the cost of constant synchronization across the world, and the ultimate sacrifice is speed. Better mousetraps keep being invented to reduce the synchronization effort (and in equal measure the environmental footprint) — proof of stake, sharding, parallelization, MEV — yet the problem of speed is quite innate to the blockchain as it links to its basic tenets. To put some numbers in perspective, the most popular blockchain — Ethereum — can handle up to 400 transactions per block, and each blocks is proposed on average every 12 seconds.
1. Matching (aka trading)
The core function of an exchange is to match buyers and sellers, and as discussed in part I, the basic principle that unlocks the most efficient trading — best price and largest transacted amount — is the networking effect, inciting sellers to come to where there are is a pool of buyers, and buyers to come to where there is a pool of sellers, in turn growing the pool of buyers and sellers and the efficiency and attractiveness of the exchange. But pooling invariably means centralization — a concept at least seemingly at odds with the underlying premise of decentralized finance. But that is an optical illusion — while the blockchain may be hosted in a decentralized fashion across numerous nodes, it is precisely that one single state of truth that is constantly being negotiated and synchronized between the nodes, and a single state enables the implementation of a matching mechanism on the blockchain itself. Several DEX have managed — with various degrees of success — to replicate the principles of a central limit order book (CLOB)— the most popular matching mechanism in CEX — via smart contract.
However, we must admit that the CLOB is not native to DeFi. Price formation — a topic we will expound upon in the final part of this series when we discuss market making — requires agility in order management, namely placing, amending, cancelling, and replacing orders, and agility translates to speed and costs, neither of which is a forte of the blockchain. A well-written single threaded CEX matching engine can easily handle 200,000 sequential order-related transactions per second, each of which practically free, save for the shadow value artificially introduced by rate limiters.
In contrast, a DEX matching engine requires each transaction to be synchronized across all nodes, which incurs time delay and fees in the form of gas. Astute readers would note that a block can easily contain numerous transactions, yet we must note that a CLOB does not easily lend itself to parallelization (even if parallelization across contracts is possible in the Solana ecosystem), which shifts the battle between traders from the CLOB to the mempool, introducing further complexity.
It is undeniably the case today that CEXs still trump DEXs when it comes to the function of matching. Uniswap, the largest DEX, has a volume of transactions greater than that of most CEXs, but its high costs and latency prevent the pools from becoming a source of price discovery. Instead, price discovery happens in CeFi, and Uniswap prices follow CeFi as a result of arbitrage activity which is hampered only by the significant pool fees. One consequence is that liquidity providers (LPs) in Uniswap are habitually picked off of by arbitrageurs and tend to suffer consistent losses that outweigh the fees earned.
2. Clearing
Now clearing is something up DEX’s alley. In contrast to trading, clearing is less speed-sensitive, parallelization is an option, and the function of swapping asset ownership is native to the blockchain. Thus smart contracts are perfectly capable of clearing trades… up until leverage shows up at the door.
To understand the issue here, we must lift a heavy curtain of financial jargon and peek at what leverage truly means. Let’s start with a simple example. Trader A has $1 in their pocket. They like a certain asset, say gold or a cryptocurrency, and decide to buy $1 worth of it. The value of the asset appreciates by 2%, so A is now sitting on $1.02 worth of assets, where the $0.02 profit is the 2% return on their investment (we are ignoring transaction fees and financing charges for the moment). At no point was Trader A at risk of losing more than the $1 they invested, even if the value of the asset were to drop to the ultimate 0. The same holds true for Trader B who sold the asset to A. Trader B didn’t even incur a loss, save for the opportunity loss of $0.02 should they have not sold to A the appreciating asset. And finally, no risk was borne by the exchange, which helped pair/match A and B and settle the trade (i.e. deliver the cash from A to B and the asset from B to A).
This is an example of a fully funded trade, where the asset had to be paid for (funded) in full. And the one problem with fully funded trades is that they are boring.
That is where leverage comes in. Imagine the exchange allowing A to acquire the same $1 of assets by committing less than $1, say by only pledging $0.20. This can be effected in many ways, e.g. via lending or via a product that has the leverage built into it, like futures or perpetuals.
That makes the trade much more interesting, because the same 2% asset appreciation would not translate to 10% return on the invested capital of $0.20. But nothing in life comes for free. Leverage magnifies both profits and losses, and the minute there is some leverage, there is the chance to lose more than is invested. In the example above, if the price of the asset was to drop by more than 20%, trader A would lose everything they have invested and will still owe money. If the exchange was acting as clearer, then A would owe the money to the exchange and the exchange would be responsible for the profit to B. At that point, A could walk away, leaving the exchange holding the bag.
The exchange, on its part, really doesn’t wish to be in this position, hence they must act before the value of the asset has dropped 20%. They do that by employing a slew of measures discussed in part I, most notably collecting additional collateral (margin) dynamically (i.e. as the asset value changes), liquidating a trader’s position when they fail to post sufficient margin, and committing the exchange’s own capital when everything else fails. Yet no matter how comprehensive this waterfall list of backstops is, there will always be a risk to the exchange incurring losses and ultimately going down, and the risks are proportional to the leverage offered, squeezing exchanges between two competing needs:
- the need to remain attractive to traders and competitive in the space, i.e. to offer high leverage; and
- the need to remain solvent, i.e. to offer low leverage
The problem is fundamental to all exchanges but is particularly acute in the context of DEX, where discretion is not an option and where every possible scenario must have been pre-programmed into the smart contract to handle. A CEX can lean on a number of discretionary measures like public communication, temporary stop of the market, forceful unwinding of trades, arrangement of temporary financing by a consortium of investors, or placate a government to intervene in “too-big-to-fail” cases — all in the name of saving the market for everyone’s benefit. On their part, DEX can’t do that, because removing the discretionary element — the “trusted third part” in the language of Satoshi Nakamoto — was the very premise of DeFi. One can’t have their cake and eat it too.
It comes to no surprise that few DEX players have mastered the space where lending or leverage is involved, yet the search for a better mousetrap continues.
3. Custody
The function of custody is what the blockchain was originally built for — to act as a shared source of truth on who owns what without the reliance on any single trusted authority. The main drawback here is the convenience of having to handle private keys, and the stories of people losing all their savings along with the private key (and scouring landfills in search of a hard drive) have plagued the evolution of crypto from its infancy. Yet any attempt to improve upon that has traded gains in convenience for delegation of authority.
4. Market making
Traditionally, market making is not the function of an exchange, but is rather a complementary function provided by third parties. So much so that in Tradfi regulation specifically precludes exchanges from engaging in market making (or any principal trading, for that matter). That isn’t to say that exchanges don’t do it. It also isn’t to say that there is necessarily a conflict of interest. There is rather the potential for conflict of interest, which suffices for most regulators.
But since DEX is autonomous and the code is open source for everyone to see, the function of market making can be built into a smart contract. The first attempts in the space to gain traction were Uniswap’s Automated Market Makers (AMM), and the model has proven resilient enough to replicate by other players. AMM continue to evolve in search of a better mechanism satisfying the needs of the diverse community of traders.
The above functions are not an exhaustive list, and each can be implemented differently by a given DEX or even outsourced altogether. For example, many DEX employ a centralized order book (running on a private server) in combination with on-chain clearing. Many others outsource the discretionary element to an Oracle, an independent source of truth, which in itself introduces a different set of risks.
Concluding remarks
Crypto exchanges are newer and less mature than their TradFi peers, yet they obey the same laws that govern all exchanges. Crypto CEX specifically bear great similarity to traditional exchanges in the way of product, matching, and downstream functions like clearing and custody. At the same time, they benefit from having emerged several centuries later, thus trudging less political and technological baggage and being at an arm’s length from end users. DEX, in contrast, are quite a different species, as the blockchain ecosystem does not lend itself to a direct port of the CEX model, yet it supports natively new ways of effecting exchange. As a result, DEX are charting their own path towards the mastery of the craft of exchange, and we are yet to find out where that path leads.
A smarter person once said that the world often overestimates where we will be in two years and underestimates where we will be in ten. The same applies to the nascent industry of crypto and, in particular, the marketplace for crypto. Looking back at the tumultuous years behind us while also trying to peer through the veil of the future, we can’t help but think that the journey will be long and bumpy… but worth it.