Hacker News new | past | comments | ask | show | jobs | submit login
A mathematical analysis of Uniswap markets (arxiv.org)
30 points by LolWolf 24 days ago | hide | past | web | favorite | 6 comments

To contextualize this:

A big problem with current cryptocurrency exchanges is that they're centralized. In order to trade on them, you have to take coins out of your own wallet and send them to the exchange's wallet, which you don't have control over. In the event that the exchange decides to take the money and run, you have no recourse.

The Ethereum blockchain's smart contract system has enabled the rise of decentralized exchanges, like Uniswap. What this means is that trades between users' wallets are mediated by the contract's code, never requiring you to relinquish control of your coins.

Unlike the traditional order book of most exchanges (centralized or decentralized), Uniswap has developed a way of trading centered around the concept of liquidity pools (see this [1] post for more information). Traders have wondered if this system provides comparable or better pricing compared to conventional order book exchanges, and this paper makes the case that it works well as a pricing system.

[1] https://defiprime.com/uniswap-liquidity-pools

For those unaware, Uniswap is a decentralized exchange without an order book. Rather than matching orders to buy and sell, it has a liquidity pool. As users buy/sell from the pool, the price to buy/sell automatically adjust to maintain a certain ratio.

The lack of an order book makes it extremely simple (and transaction cost efficient).

The down side is that to "bootstrap" a market, you need a liquidity provider willing to put up twice the value of the asset. There's also slippage costs and front running concerns.

How does the lack of an order book make the process of trading simpler and/or more efficient?

An order book that could handle 1 million TPS could be written in Java and run on a single cheap (sub $1000) piece of commodity hardware. And it wouldn't require much development effort - the mechanics of automated order matching is really very simple - almost trivial and implementations have been around since the 1960s.

In the context of all the inefficiencies and frictions in financial industry, the cost of actually matching orders by computers is effectively zero.

I don't think simple here necessarily means simpler in backend implementation. I'll even argue that the implementation of a decentralized exchange on Ethereum is far more nontrivial than implementing a conventional order book exchange.

Uniswap is simple in the sense that for liquidity takers, the UI makes it feel like you're not trading, but rather that you're buying/selling coins at an offered price, with an assurance that the transaction will be canceled if it's not possible to fill the order without exceeding a certain amount of slippage. Almost like buying from a decentralized Coinbase. Yes, this is essentially just a market order, but you can have unrestrained slippage concerns in limit order books (especially in crypto where spoofing is commonplace), and beginners need to be taught about limit orders to avoid those pitfalls.

For intermediate traders and beyond, it's simply another exchange that can be used, but this paper does give validation that their pricing mechanism is competitive.

I guess the difference here is that a decentralised order book on the block chain would be run by every node, which is why compute in the blockchain (gas) is quite expensive.

For an order book you have two options:

1. An on chain order book. But saving state on chain is expensive

2. An off chain order book. With an off chain order book, you have to hash and verify signatures for every order, which is expensive.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact