Hello defiers! 0x’s ZRX token holders yesterday approved a proposal to upgrade the 0x decentralized exchange protocol, whose relayers are among the top five dexes transacting the most volume. Sharing an interview with 0x co-founder Will Warren, who explains what the change will entail; how it tries to better answer the question “does your protocol really need a token?” and improve liquidity and prices for its users. He also talks about his larger vision for a future where millions of assets will be tokenized and traded on Ethereum. Before doing all of that, he lays down the basics of decentralized exchanges so that we can all be dex-perts :)
I edited the interview for length and clarity and bolded by favorite quotes. Subscribers get the full version.
Camila Russo: Before we get into the latest with 0x, it would be great if you could give me an overview on how the different decentralized exchanges work. I’d like to really understand how the different pieces fit together.
Will Warren: There are many different ways that decentralized exchanges have been designed on Ethereum. The first dex that was ever created was OasisDEX. Maker created their own dex because in order for Dai to be useful, there has to be markets for it. OasisDex took all the functionality of a traditional centralized exchange and put it into a smart contract on Ethereum. The order book, the list of offers to buy and sell different assets, was stored within a smart contract.
The problem with this approach is that interacting with Ethereum is expensive. Every single time you want to place an order on the order book or cancel that order or modify the price, you have to create an Ethereum transaction, and it's costly. And so basically the takeaway from it was that it's really inefficient.
Then there’s a class of decentralized exchanges called automated market makers, and this is Uniswap and Bancor, and there are a few other projects too. Basically, you get a smart contract and you put in two different types of assets into that smart contract. So say you want to trade ether for Dai. You get this big pool of ether and this big pool of Dai, you put them in that smart contract and then that smart contract will look at the ratio of those two different assets and it will offer a price that you can buy and sell at. So if the the ratio changes and maybe there's more ether and less Dai, the price of Dai becomes more expensive.
It's very elegant because it's simple and has a smart contract taking care of a lot of the things that traditionally an exchange or a market maker would. But the downside is that due to its simplicity, you can't really support large markets. And you can't have large trades because if you try and buy or sell too much of an asset, you're going to rock the price up or rock the price down. And so you're kind of limited in how much can be traded by the size of the pools of assets in the smart contract.
I kind of view them as like more of a toy honestly. And I don't mean that in a condescending way. I just mean that they're really cool gadgets, but they're not necessarily designed for really robust exchange markets.
CR: But the problem with the order book model is that while it does allow for maybe more sophisticated trading, it's more expensive to have everything on chain, and I imagine slower too, right?
WW: It's way more expensive and you're right, it is slower.
CR: Which type of exchange is more susceptible to front runners?
WW: Front running is relevant for on-chain order books. It's relevant for automated market makers, and it's also relevant for certain types of off-chain order books too, which is what 0x is focused on.
CR: So what 0x is doing unlike on chain order books and liquidity pools, is that you have an off chain order book model. Can you explain what, how that works?
WW: So it's good to note that on 0x you don't have to have an order book at all. The way that most people use 0x is through an order book, but 0x is actually like a message format. It's a way for people to settle trades. The important part here is that you're only interacting with the Ethereum blockchain when a trade is occurring. But if you're not actually moving value, then the blockchain isn't being used. And so the way 0x works is it's an off-chain order relay. On-chain order book orders are living in a smart contract, but in 0x these orders are pieces of data that have the assets you want to trade and the price and how long you're willing to do that trade.
It's just a chunk of data that lived off-chain. And then you cryptographically sign it with your private key and it's still off chain. Then you can share that order with anyone in a private way. But if you don't know your counterparty, then you'll probably use an order book. And so the analogy I use for off-chain order books is a check. You can write a check and it gives someone the right to pull money out of your bank account if someone cashes it. But they could just keep the check and not cash it and nothing would happen. In this case the bank is the blockchain and the check is the order. The order isn't on the blockchain until it gets cashed out at the bank.
Will Warren, 0x co-founder and CEO
CR: And that piece of data, or the check in the analogy, where does it actually live? Does it live on a 0x server or where specifically?
WW: So that's the important piece is that the 0x protocol doesn't say that there is a specific place or server where that order has to live. The protocol only cares that you're following the format as defined and that eventually if it is sent to the Ethereum blockchain so that a trade will occur. You don't need to have a server. I can just create an order right now on MetaMask and I could just send it to you over this video chat and then you could go and submit it and fill it. But if I don't know a counterparty, then you need a server to host the order, and this introduces the concept of relayers. Relayers are basically companies that have a database and a server. And what they do is they allow people to come and share their orders with them and they take those orders and arrange them into the form of an order book and display them.
CR: So there are relayers that work specifically with 0x orders, with people who want to trade using the 0x protocol. Are they just like independent companies?
WW: They're just independent companies and they can charge fees because they're the ones hosting the server. They only accept specific orders that meet their needs and in their case their need is a fee. So they'll say you can send in your order and I'll host it, but your order has to pay me a fee, otherwise I'm not going to accept it.
CR: And I guess what's interesting there is because you can allow competition between relayers, fees should tend to not be as high, right?
WW: Yeah, that's right. And there are a bunch of different types of relayers and actually it isn't just as simple as they host a server with orders inside of it. There are different ways to have the market work as well. Some relayers charge zero fees right now because they're just focused on getting users. Some of them charge a percentage of the trade. It really varies and it also varies depending upon what kind of markets that they're supporting.
Radar Relay focuses on supporting liquid ERC20 tokens. It really looks just like a traditional, centralized exchange. Another type of relayer works the same way underneath the surface, but trades digital collectibles, like cards and Cheese Wizards and stuff like that. You create these orders off chain, they host them in their server and then someone else can go to the website and find your order there.
CR: So there's these off-chain order books and then what happens? A trade is executed, then that goes on the Ethereum blockchain?
WW: Yeah, exactly. So the relayer isn't doing anything. They're just hosting the orders. The trader is actually going and picking that cryptographically signed order off of the website and sending it to MetaMask and telling it to send this order to the 0x smart contract. So the 0x smart contracts, all they are able to do is accept these orders that are sent to it, process the orders, make sure that all of the conditions that need to be satisfied for a trade to occur are satisfied. And then it will move the assets between the different parties on either side of the trade.
CR: Okay, and for a trade to be made, you still need to wait for that transaction to be confirmed on Ethereum.
WW: Yeah. So it isn't like a centralized exchange where it's instant, it takes 30 seconds or so.
CR: And so what have you learned so far about this system? What are some of the pros and cons that you're seeing versus the other ones?
WW: I'd say that because it's off chain it is more efficient and it can support more liquid markets than automated market makers. But because it uses this architecture, it isn't as like simple and intuitive for people. Uniswap is much easier for people to develop with and trade because it's either buy or sell and that's it. On 0x you actually have to get these orders from somewhere and it's either a counterparty directly or it's from one of these relayers and then you have to send that order to the 0x smart contract. And so it's a little bit more work to integrate 0x.
CR: And it also supports more liquidity and maybe more functionality?
WW: Yeah, it definitely supports more functionality. So 0x supports all of the popular token standards today; ERC20, 721, and then this kind of second-generation token standard called ERC1155. Most dexes today only support ERC20. We think that there are going to be all sorts of different types of assets that people want to trade and we want to make sure everyone can trade them.
0x also supports significantly better prices, with a lot less slippage, than Kyber or Uniswap because of its architecture.
CR: How does this immediate new update fit in into that? Like what are your trying to achieve with it?
WW: Yeah, so there are a few different main points here. The first one is that we completely redesigned the token economics. So the first thing to note there is there is a token associated with the protocol. A lot of people see a token associated with 0x and they're like, come on, does that really need to exist? That's definitely a fair question, but the answer is actually yes, it really does have to exist. The problem that we're solving for with the token, I think now with this new update we'll finally be able to address it in a much better way than we have been to date.
[ … ]
Paid subscribers have access to the full interview! Subscribe now so you don’t miss any of The Defiant content :)