Episode 222

0x Protocol and the Decentralized Exchange Frontier

Amir Bandeali Will Warren

Decentralized exchanges have been a holy grail in the cryptocurrency space, since at least the MtGox hack. They promise to derisk the act of exchanging cryptocurrency by leaving custody of funds in the hands of the users. And they should be resistant to regulatory pressure, creating a permissionless way to trade cryptocurrencies.

Among decentralized exchange projects, 0x has gained by far the most traction in the short time since launching. Co-founders Will and Amir joined us to discuss the 0x protocol, the emerging 0x economy and the vibrant community they’ve built.

Topics discussed in the episode

  • How Will and Amir started 0x
  • The definition of a decentralized exchange and why decentralized custody is key
  • The 0x architecture
  • Why 0x built a protocol and not just a decentralized exchange
  • The role and business model of relayers
  • The 0x token and its economy
  • The 0x governance process

Meher Roy: Today, we’re going to talk on the topic of decentralized exchange with Will Warren and Amir Bandeali, who were the co-founders of the 0x project. The 0x project had a very successful token sale last year, and followed that successful sale, with really good releases on their technology and development of their community. Will and Amir, welcome to the show.

Will Warren: Thanks for having us. Pleasure to be here.

Amir Bandeali: Yeah, thank you. Very excited.

Brian: So I should actually also make a disclaimer right now because I did participate in this token sales, so I am not unbiased.

Meher: All right. So with that disclaimer, let’s get into your background, Will. Tell us how you ended up starting this project.

Will: Yeah, absolutely. So I initially became interested in Bitcoin around 2011. I was in the investment club at UC San Diego. You know, my background isn’t in kind of investing or anything like that. I was studying engineering and I think I came across an article about Bitcoin on Hacker News or something like that. I thought it was interesting technology. There weren’t really any use cases for Bitcoin at the time, except Silk Road. But I thought it was really interesting technology and kept an eye on it. My wife, then girlfriend, also thought Bitcoin was really interesting. And once Coinbase kind of legitimized, the technology and the use cases by partnering with Overstock, she left New York, she was doing finance in New York. She left and join Coinbase pretty early on. And when she joined Coinbase, you know, I kind of became a much more interested in cryptocurrency and was keeping up with it much more closely, but I was kind of on a research track. I was doing, I was kind of planning to do research for my career either in academia or in industry.

I was in grad school studying engineering, but when Ethereum came out, it struck me as the most important invention since the Internet, and I really quickly lost interest and everything else, and basically decided to drop out of grad school to focus on Ethereum full time. And so what I was focusing on, this was back in June of 2016. What I was focusing on back then was creating, essentially, a standard for tokenized derivatives. And the rationale for that was that cryptocurrencies are extremely volatile assets, and it makes cryptocurrencies not that useful for quite a few different use cases. And I felt like, you know, derivatives would provide the ability to hedge against this volatility and that felt like an important thing to work on. So kinda got pretty far along building out that project and that’s about the time I met Amir in San Francisco. And so we were, Amir and I were focused on kind of, you know, how do we take this technology and bring it to market? And what we realized is that tokenized derivatives are not very useful if there’s nowhere to exchange them. And so this, you know, Amir and I met, and we started working together formally in October of 2016. And back then, you know, EtherDelta wasn’t a thing. There were no decentralized exchanges that people were using at the time, you know. So we basically decided, okay, if no one else is going to build this infrastructure and no one else is going to work on this and someone needs to do it, so might as well be us.

Brian: I just want to kind of ask here. So you said when you discovered Ethereum and so you knew about Bitcoin, you’re kind of following Bitcoin, but then when you discovered Ethereum or when Ethereum came about, you felt like, oh, that was the most important thing since the Internet. Why that reaction to Ethereum?

Will: Yeah. I think it’s because I’ve been following Bitcoin for a long time. The technology is completely open and globally accessible ledger for payments is really compelling. But you know, I think this was around like late 2015, early 2016, you know, Bitcoin was chugging along. It was doing fine doing payments, but there is also a lot of infighting in the community and, you know, it seemed like not much innovation was occurring. People were talking about layer two solutions and stuff like that, but, you know, at the end of the day, it’s really just a network for payments which is incredibly valuable, but Ethereum, you know, held the promise for basically an infinite number of different use cases and it felt like something completely different.

Amir: Yes, a little bit about my background too. So I have a background in trading. I was a trader for about five years first at a company called Chopper Trading in Chicago and then later at DRW. Gone to Bitcoin, I think it was 2014, right around the first run up. And initially, it was mostly from the trading angle, you know, watching these crazy price moves. But I started learning more and more about the technology, became a pretty big believer in Bitcoin. And then learned about Ethereum in early 2016, started getting more into the technical aspects of things, and ended up meeting Will through a mutual friend and I knew he had just recently dropped out to work on his derivatives project, and decided to join Will in San Francisco to work on that.

Meher: Amir, when I look at your LinkedIn profile, the thing that stands out and jumps out is your educational background is not in computer science. There’s finance and then you worked for five years as a trader. You are the chief technical officer of 0x. Tell us, did you go through a phase where you transition, like you changed your field from traditional finance to cryptocurrency, but did you have to spend a lot of time to build a completely new skill set in order to do this?

Amir: So it wasn’t completely new to me. I was minoring in computer science in college also, you know, I ended up not completing the minor because I just got a job and graduated a year early. But yeah, I’ve been kind of coding along the way, did some data analysis and stuff like that when I was trading. But yeah, I had to have to definitely build it up over the years. I think in the crypto space, there are very few experts or at least back then. So when I started learning about it, it’s kind of a more even playing field with everyone else and I’ve just been really deeply diving into the text that time.

Meher: It’s a super interesting. Perhaps we can start with discussing decentralized exchanges in general. Tell us what is a decentralized exchange?

Will: Yeah, so I think first of all, before we discussed what is a decentralized exchange, it’s probably first important to discuss what is a centralized exchange and what exactly are the implications of having an exchange that is centralized and trade cryptocurrencies. So a centralized exchange is, you know, in some ways the backend infrastructure or at least the blockchain infrastructure for a centralized exchange. It’s a massive hot wallet and cold wallet. So, you know, all the people that are trading on this centralized exchange are depositing their valuable digital assets. They’re basically handing it off to this team that’s operating the centralized exchange. And all of this money is being, all of these cryptocurrencies is being pooled in one central location. You know, oftentimes, hundreds of millions or billions of dollars just sitting in one address. And on top of that, a kind of blockchain infrastructure is, you know, some infrastructure for exchange. So when you deposit, when you give your money to this centralized exchange, they credit you with some virtual cryptocurrency that exists on a database that they maintain and that they own and they kind of allow you to exchange those virtual units of value with other people that are also plugged into their centralized database. And you know, in the brief history of cryptocurrency existing at all, there’s been numerous examples of centralized exchanges getting hacked and losing hundreds of millions of dollars or billions of dollars, and it just happens consistently every six months or more frequently even.

And so now getting back to the question of what is a decentralized exchange? A decentralized exchange, first of all, it’s decentralized in the sense that custody of the cryptocurrency or the digital assets remains in control of each kind of individual, each peer in that network, so there’s no large kind of honeypot where all the cryptocurrencies being pooled. And also, a decentralized exchange is trustless, so you know, there’s a variety of different kinds of architectures for how a decentralized exchange can be designed. But generally, across the board, a good decentralized allows you to remain in custody of your cryptocurrency and you do not have to trust anyone to, you know, knock it hacks, not run off with your money and so forth.

Brian: So the custody aspect is one, but do you also think it’s an essential part of a decentralized exchange that you don’t have to trust anybody that it’s fair, you know, that I actually get kind of the best deal compared to other people.

Will: Yeah. So it sounds kind of like you’re asking is transparency around kind of price time priority or is transparency around trade execution kind of a piece of that system?

Brian: Yeah, transparency and fairness, right. So I mean, one thing is, okay, I know nobody can steal my phones, but another thing is I know that there’s no central party, for example, you know, match my order sub optimally today or advantage or something like that.

Will: I’d say, I mean, that’s super important. I wouldn’t say that that’s probably secondary to catastrophic failure, right? So what’s the first thing I want to work? What’s the first problem I want to solve? Well, I don’t want someone to, you know, steal all my money. I don’t want catastrophic failure. You know, once that box is checked, it’s like, okay. Well, now that I’m not worried someone’s going to steal all my money, how do I ensure that what I am trading, I’m getting a decent deal. And I think that that’s also, you know, it really depends on the architecture of the decentralized exchange and I think it’s extremely important, obviously. So yeah, I mean, I guess, maybe, you know, are you saying is that kind of a requirement for an exchange, a decentralized exchange to be considered trustless?

Brian: Yeah, I think you’ve kind of answered the question in putting these in order of priorities. So I think that makes perfect sense. I’m curious. Did you guys, I guess you guys anticipate it, because we have seen just huge explosion in interest in decentralized exchanges over the last years. Did you guys foresee that this was gonna happen and what do you think are the main reasons why this has occurred?

Amir: I definitely did not foresee this explosion happening this quickly. I mean, it was always our thesis that this would happen and that there would thousands, potentially, millions of tokens on various blockchains. Why has it happened? I mean, it seems like institutions and just the general public has started to become aware of cryptocurrencies. I think most people recognize that the impact it will have is just massive. It’s not a question of if it will have an impact, it’s kind of a question of when will it have an impact? So yeah, there’s mass speculation on that front right now.

Meher: So if I scan across the decentralized exchange space, there’s lots of different projects, right? So there’s EtherDelta, which is probably the first that came online. There’s Idexx, there’s AirSwap and of course, there’s 0x. In addition to that, there are these theoretical proposals for cross chain mechanisms. Walk us through the different architectures that are being pioneered by these projects. And what does the design space of decentralized exchanges as a whole look like?

Will: You know, a lot of the decentralized exchanges that we’re seeing today or that already exist, they’re kind of for-profit operations that are owned by a small group of people that, you know, kind of setup this system that they bring people into and they can kind of extract, they can charge fees. So back when Amir and I got together in October of 2016, you know, our original plan was let’s create a for-profit decentralized exchange that we own and that, you know, all the fees that we charge, we get to feed into our corporation or whatever it might be. And you know, we’re working on it, but the longer we were in the Ethereum community and the more that we talked with various projects in this space, the more apparent it became that what the community and what the ecosystem really needs isn’t a kind of walled garden. You know, there’s all of these different decentralized applications that require exchange functionality. So things like prediction markets, decentralized fund management platforms, stablecoins and a variety of others as well. You know, so we would meet with the different projects that are building these things and discuss with them. And they all need exchange functionality.

And so, you know, what we kind of came to realize is that, rather than having each one of these projects create their own walled garden, their own kind of custom and proprietary smart contracts for exchange, you know what, there really needs to be as a public piece of infrastructure for decentralized exchange that any dApp can hook into that’s completely free to use and that’s completely open and globally accessible. And so, I think that was a huge realization for us is that maybe instead of focusing on building something that we want and that will like make, you know, allow us to kind of generate a revenue stream, maybe we just build something that everyone can use and that benefits everyone. And maybe, you know, we don’t need to have a business model attached to it. So you know, I think it’s important to bring that up prior to jumping into the different decentralized exchanges that exist and their architectures. I think it’s important. You know, one of the things that really makes 0x unique is that it is a protocol, it’s public infrastructure. Anyone can build their own for-profit business on top of it, so anyone can create a decentralized exchange and charge fees. And you know, I think that we’ll see a big shift towards this model compared to things like EtherDelta where they’re really, you know, when EtherDelta was the only game in town, there really wasn’t much competition around fees and user experience. And yeah, I think we’re starting to see that now, which is really a good thing for everyone.

Brian: So you talked about this kind of shift to thinking of 0x more as this basely infrastructure that, you know, wouldn’t be owned by you guys. Was this also driven in part by this coming of ICOs and of, basically, funding through tokens and critic community, did that shape kind of your development in that direction?

Will: Oh, actually, not really. So we’re pretty much set that building an open protocol was the way for us to go around January of 2017. It just seemed like it would add the most value for the most people. But back then, that was way before the ICO craze had really taken off. You know, I think the biggest token sale at that time was Golem and they raised like $8 million or something like that. I think one of the things that the ICO craze kind of embraced is that projects raise a bunch of money pre-product. But that was definitely not something we were interested in doing. So, you know, back in March of 2017, when we kind of decided that we wanted to build this open protocol, you know, we raised a small seed round. It was led by ApolloChain capital, it was just enough money to cover our legal fees, to hire a couple people and enough to kind of get us to the point where we had a fully functional product that people could use. In the following months, that’s when we really saw the ICO craze to kind of take off. It was just insane. But yeah, I don’t think that our decision to create an open protocol was at all driven by the kind of ridiculous amounts of money flying around and the irrationality of speculators. That’s actually something that we very much want to distance ourselves from. I think that’s kind of a toxic culture and we don’t want that. Yeah. I don’t know. Does that answer your question?

Brian: Yeah, sure. I think you can look at the ICO in several ways. As one, as you know, having all these aspects you mentioned, but the other one, of course also, there’s enormous power and building a community and incentivizing people and all that. And to be honest, you know, when the 0x, when you guys did your token sale, I actually put in money. Really, I didn’t actually look very deeply at 0x as a technology, but I really liked how you approach the token sale, which was also very noble and very different. And I felt there was a lot of issues in how token sales were happening at that time. So we had these crazy things like for example, Brave, they did the BAT token, right? So the idea is, this is browser that hopefully billions of people will use, I guess that’s their plan, right? And you have this token that can then be used to kind of pay for advertisement and pay for attention and stuff like that. But then they had their token sale sell out in three blocks, three Ethereum blocks, so about half a minute or a bit more. And there was some, I don’t know, a hundred people or some tiny number of people basically bought the entire token sale. So you’ll also have these perverse distributions and it’s totally a contrary to, I think the idea of is decentralized technology where you have also control that decentralized and it’s owned by community. If in the end, it’s really a bunch of sort of oligarchs that control it. So I really like how you guys built in a very different direction with the token sale and you know, I’ve felt that was great.

Amir: Yeah, wide distribution was super important to us. You know, 0x protocol is a platform and it’s nothing without people building on it. So we wanted there to be as many stakeholders as possible and I think it’s really worked out in our favor. I think that’s a big part of the reason why there are so many people developing on 0x right now and why we have such a great community.

Meher: Of course, the other nice part about tokens is, as you mentioned, as Will mentioned, that 0x is not trying to be a central player that extracts rents out of each trade that is happening on using the technology, essentially, right? So it is basically a set of smart contracts and protocols and ways to do things, ways to do exchanges that other parties can use in order to build their own systems. And at some level, we might argue that 0x is solving a public goods problem, right? So a decentralized exchange, a generalized protocol for decentralized exchange on Ethereum is valuable, yet if there isn’t a very obvious rent seeking mechanism in the protocol itself, then who exactly would build it? And from that perspective, the ICO model, at least the past year and this year, seems to work well to bootstrap these projects. So that’s sort of my opinion. That’s I think the strength of the ICO model that these people are willing to put money to fund public goods development without necessarily the expectation of revenue flowing into the token itself. But perhaps, we’re jumping a little ahead of ourselves and should really talk about what 0x is. So Will, tell us what exactly is 0x in the nuts and bolts of it.

Will: At its core, 0x protocol is a message format, so a way of kind of specifying your intent to enter into a trade. And you know, so you can think of this large chunk of data that consists of different parameters such as the different tokens that you would like to exchange, the exchange rate, kind of how long you’re willing to honor that commitment to trade. You can specify whether or not you want to enter into a trade with a specific counterparty or you can leave your order open to be filled by anyone. And so this, you know, the message format basically specifies how do you create an order in a range that data into a packet, and so that everyone can interpret it and know exactly what it means, you know.

And the second component of 0x protocol is a system of smart contracts that exist on the Ethereum blockchain. And this system of smart contracts is broken into a couple different modules. The first module is a smart contract that accepts these packets of cryptographically signed data, processes them, and allows trades to be settled on the blockchain. And you know, that module is responsible for authenticating signature, cryptographic signatures, making sure that both parties have the sufficient funds to actually settle the trade, ensuring that an order hasn’t already been filled or that is expired. So it’s kind of the core business logic for settling trades. The second module is a governance module. And the governance module allows the exchange, kind of the trade settlement module to be upgraded over time. I think it’s kind of early right now. There aren’t very many decentralized applications that have existed for very long. So, you know, I think a lot of people see the need to upgrade a system of smart contracts. It doesn’t really hit home for many people. But I think it’s extremely important that this system of smart contracts, that all of this infrastructure is being built around and that all of these smart contracts and businesses are plugging into, can be upgraded without bringing all of the markets to a haul. And by reducing the friction associated with migrating to a new version of that exchange logic overtime.

And, you know, just for an example, like I think EtherDelta is probably the best example. You know, EtherDelta is a decentralized exchange kind of owned by one person. It’s been operating for a while now, probably one of the longest, the dApps has been around for the longest. And EtherDelta, you know, EtherDelta had to upgrade their smart contract four times. So there are, you know, there’s EtherDelta versions 1 through 5. And I think that’s not a knock on it, I think that just tells you that it’s important to upgrade smart contracts. The technology stack that we’re building on top of is rapidly evolving and there are, it’s unavoidable that we’re going to need to upgrade these smart contracts over time if there’s new token standards come out, et cetera. But, you know, with EtherDelta, every single time there was an upgrade, it was one person that was making that decision. Everyone that was using the old smart contract would have to kind of withdraw their funds and then deposit into a brand new smart contract. If they were responsible, they would probably want to see a security audit report of the new smart contract to make sure that it does what it’s advertised to do. I think people just kind of accepted the person that created the contract was not going to steal her money. But that’s a very disruptive process. So the way the 0x protocol is designed, you know, we have this logic for settling trades. We have this logic for upgrading the system over time as new token standards emerge, et cetera. And it allows us to upgrade the system without requiring users to migrate, without making all of the markets stop functioning and you know, I think, ultimately, that’ll be a model that we see much more frequently going forward.

Brian: And you mentioned governance before as one of the core modules and now we’ve been talking about upgrading. So is governance the way to upgrade the system both now and is that what you see their role in the future?

Will: Yeah, I mean, absolutely. It’s kind of crazy. Just between when we did our token sale and now the crazy amount of developer interest that we’ve seen, don’t think Amir or I were really expecting it, I think we thought we would have to really kind of go out and convince people to build on top of 0x protocol, but we’ve kind of seen this explosion of interest in development activity. And it’s really exciting, but it’s also a lot of responsibility. Because at the end of the day, all of these people have kind of changed their career trajectories and now, you know, their career is building this business on top of infrastructure that we’re building. And you know, if I were them, I’d be terrified if we had 100 percent power to make all the decisions about how the protocol should change. You know, so I think one of the reasons why all these different relayers, these decentralized exchanges that are building on top of 0x. I think one of the reasons why they took that risk is because we’ve been very clear from the beginning that this is public infrastructure. It’s owned by the public and the people that are actually using the system, the people that are stakeholders, they’re the ones that are going to drive the governance process and make the technology evolve over time, not Amir and I. That’s too much responsibility for a small group of people. It needs to be the entire ecosystem that drives the governance.

Meher: We could compare it to sort of Ethereum. So Ethereum itself is being upgraded and there’s this EIP process, Ethereum improvements process, which is basically a set of new standards and like potential comments that are discussed over GitHub and once the community, which probably is a quorum of people that are involved in Ethereum development are comfortable with it, get included into the next upgrade. How will a future 0x, how will this look different in the future for 0x? What changes from the Ethereum improvements are done today?

Amir: So right now, the process is very similar to Ethereum. But in the future, there will be some form of token voting. Your vote is weighted on the amount of tokens you own. And I think the reason this works better specifically for 0x than an Ethereum-like process kind of goes back to the reason we made 0x in the first place. So that decentralized exchange ecosystem was very fragmented. There are all these different siloed exchanges. And it’s more important that we have sort of a way of soft working on-chain using our governance to keep everyone on the same shared protocol. If we were just like pushing out upgrades in a centralized way and people are deciding to stay on the old version or whatever, you kind of just end up back to square one where you just have this fragmented decentralized environment.

Meher: So on the topic of voting, right? So essentially, you have this 0x token and they vividly could imagine it is, in the future, let’s say you have right now, let’s say it’s version 0.8.0 and your team develops version 0.9.0, it might be some other team that develops that version as well. And there’s a proposal to accept 0.9.0 as the canonical version of it, and we say that we’re going to have a vote of all of these 0x token holders and provided a sufficient quorum and majority is reached. Then the upgrade will take place. My question with a mechanism like that is, does this process actually enable the best people to have their voice heard? So let’s think of it like this. So you have Emin Gün Sirer’s team at Cornell. Now, that team might have very talented PhD students and these PhD students might be of the kind that can actually analyze a protocol upgrade for its security, for its challenges. But if you know the American PhD student, you pretty much know that American PhDs don’t get paid a lot in stipend, right? So you cannot expect people with constraints like this to actually hold a lot of 0x tokens and therefore these people will not have a lot of voice in that governance process. Yet, they might be the ideal people to actually vote in the process. How do you resolve this problem, or do you even seek to resolve it?

Will: Yeah, so I think you’ve identified that not just decentralized governance, but real-world governance is an extremely challenging problem. You know, specifically to your point around are the right people, you know, are the right people driving the governance process? Yeah, it’s absolutely something we’re thinking about. So yeah, just to provide a little background. Right now we’re collaborating with the Aragon team and their really interesting project. They’re creating a general tool set and a framework for decentralized governance systems, kind of plug and play building blocks. And one of the things that we’re collaborating with them on, is research into this concept of liquid democracy. And the way liquid democracy works is that the people that are stakeholders in the ecosystem can delegate their voting power to someone that they deem, you know, capable to vote on their behalf. So, you know, I definitely don’t want to claim that liquid democracy is the way and it’s the best decentralized governance approach. But I think it’s an interesting step from fully centralized towards more decentralized. And it allows the people that have expertise and that are comfortable voicing their opinions to kind of have voting power within the system without necessarily having financial resources at their disposal. And yeah, I think that’s one interesting approach that we’re considering right now.

Brian: Cool. Yeah, I agree. I think that’s going to be one of the very exciting things about blockchain. It’s because it will necessitate all this innovation around decentralized governance decision making. Of course, they are also very revolutionary things down the line like using prediction markets in the future are key to do things like that. Maybe that will also work. So we started talking about how 0x works and what kind of the architecture looks like. So you talked about how people can basically send these messages with orders and then you have a set of smart contracts allow us to trade to be executed it and settled on the blockchain. But there’s also in 0x the whole, you know, a different kind of ecosystem of participants to have roles in that. And in particular, there’s that role of a relayer. Can you explain what a relayer is and what their function is in 0x?

Amir: Yeah. So a relayer’s job is essentially to host an orderbook and broadcast that orderbook to the public or in any way that they see fit. Since all of the orders and 0x are stored off-chain, this is a requirement in order for people to actually find counterparties to their trades. I think, initially, the first decentralized exchanges we’re largely using on-chain orderbooks which means that people are paying transaction fees whenever they even place an order and value is not necessarily being transferred. And this is just not sustainable in the long-term. But yeah, by having an off-chain orderbook, you can drastically decrease the cost of trading, but you do need some mechanism to find a counterparty and that’s kind of the relayer’s job. And they earn fees for doing that.

Meher: So what is the trust model between a pair of users wanting to exchange using 0x and a relayer? So I might be buyer or maker for Ether and the seller and Will might be the relayer. What are the kinds of trust we are putting on Will?

Amir: Just to preface this a little bit, there are various strategies relayers could use with varying degrees of trust. I would say the most basic strategy would be just a more open orderbook model, kind of similar to EtherDelta. I’m broadcasting my orderbook to the public. Anyone can see an order and fill that through their own Ethereum node. That’s probably the most trustless model. You know, relayer can’t really do anything to steal money or anything like that. I think the worst they could probably do is hide orders, but I don’t see why that would be in their best interest. There are other models that involved a little bit more trust. For example, a relayer can act as a central matching engine, and then obviously, you need to trust the relayer to actually match your orders. We kind of touched on this earlier, but all of these models are non-custodial, and I think that is probably what matters most. But it’s up to the end users to decide which relayers they’re comfortable using.

Brian: Is there also a risk here that, let’s say, I, as a miner, I see you’re sending, can I gain this somehow? Can I like front run their ICO, this is kind of order coming in and I’m gonna interject my own and then kind of take an opposing position elsewhere and make an arbitrage or something like that?

Will: So really depends on the way that the relayer is structured, the way that they were kind of operating. So, you know, one of the ways, actually, I’ve been writing a blog series on front running specifically, and the different ways your 0x protocol can be. There are ways that it can be used and the ways those different approaches can be gamed or front run. And so generally speaking, if I create this 0x order and I allow it to be filled by anyone in the world, anyone that just happens to see it, that type of order is subject to front running. So you know, someone you know, maybe my counterparty sees my order, they want to take the other side of that and enter into a trade. They kind of inject that quarter into the Ethereum kind of pending transaction pool, the mine pool, and that transaction kind of sit there waiting to be mined into a block. And so anyone that’s watching the pending transaction pool can see what I am attempting to do or can see that my counterparty is attempting to fill my order. And so, you know, anyone can kind of take that order, say, oh, actually, I’m going to fill this order and they can set a higher gas price and they could front run my counterparty and they would be my new counterparty.

And you know, what’s interesting is that miners, they don’t even have to think about gas prices. So miners, they can order trades, or they can arrange transactions into any order they want. It can be completely arbitrary. Miners can mine blocks with zero transactions in the block. You know, typically, a rational miner will prioritize transactions that pay the highest fee per unit of gas. But if a miner is attempting to front run sort of one of these open orderbooks, they can do whatever they want. It’s kind of like god-mode for them. So that’s not very good. You know, the good thing about 0x protocol is that we don’t define the way that people enter into a trade or the way that these orders are transported off-chain.

So there’s a variety of different ways that 0x protocol can be used. So the first way that I just discussed is called the open orderbook strategy and it’s kind of like the EtherDelta approach. A different approach is sort of this order matching strategy. So the relayer, which in this case we call the matcher, they only accept orders onto their orderbook if they are specified as the only party able to execute that trade. So what they do is they wait for two orders to show up on either side of the orderbook that are equivalent in price or overlapping and price, and then they kind of batch fill, they’ve kind of package those two orders together and inject them both into the 0x smart contracts and kind of batch them simultaneously. And so in that model, the matcher has full control over trade execution. So you can imagine that can be a really good thing. It prevents front running for traders and miners. You know, no one is able to kind of see that batch of transactions sitting in the pending transaction pool and able to kind of go in, swoop in, it just doesn’t work. They’re locked out and miners can’t do that either. But you can also imagine that maybe giving this matcher kind of full control over the trade execution process, maybe you don’t want to give them that, you know, you don’t want to give up that ability, that power. And there’s a variety of other ways that 0x protocol can be used to kind of solves both of these problems at once. So instead of getting too deep into it right now, I would encourage people to go check out the blog post I wrote. It goes real deep. It’s called Front-running, Griefing and the Perils of Virtual Settlement, and there’s part 1 and 2 that are out right now.

Brian: Cool. That’s super interesting. Thanks so much for expanding on this. There’s just something kind of came to mind here. I mean, there’s a lot of projects in the kind of adjacent blockchain space that are trying to create tools so that you can basically run code on a server that, you know, it’s the central server, but that someone else from outside can say, okay, this was done correctly and it’s kind of tamper proof and stuff. So Intel SGX is one example, but there are others. Wouldn’t you be able to build, basically, some kind of like matching engine using something like Intel SGX that, you know, I, as a user, can have a very high trust that this is a fair, there’s nothing funny going on, but at the same time, it can have all the benefits of being a centralized entity on a server. It can be performant. And of course also, that way, immune to the front running of the miner that you talked about.

Will: I think there are directions that are worth exploring. Yeah, I think potentially, there are ways that a matching engine could be designed to be trust with, so kind of like what you’re saying. Perhaps instead of relying on a person to do trade, kind of do trade execution according to kind of whatever rules they set, instead, let’s all agree on what the rules are and kind of dump them into an Intel SGX type of system where we can all kind of publicly observe what’s going on and we know that it’s being done, you know, according to the rules we all agreed upon. I do think that there are challenges around that that need to be explored further. So things like data availability, you know, it’s very easy if everyone agrees upon the current state of an orderbook and everyone agrees on the kind of time at which different orders are kind of coming in. You know, if we all agree about that dataset and we all agree are about the rules that were kind of enforcing over trade execution in this Intel SGX type system, then yes, we can all say, okay, this trade execution system is performing exactly how we want it to. Everything is good. But you know, I think the most challenging part there is ensuring that everyone has the same kind of state of the orderbook and everyone is viewing these orders coming in at the same exact kind of cadence rather than the same order. So that’s kind of like the data availability problem and I think that’s pretty challenging. It’s a challenging problem to solve. But I absolutely believe that we can create interesting systems that work. You know, it’s just going to take some time and more people exploring them.

Amir: And I think one of the challenges with these more theoretical approaches to solving front running is that a lot of them are not going to give the user experience that we want. You know, there are going to require security deposits, long lockups, long withdrawal periods. And this really reduces the ability for other decentralized applications to login to the system. And then the second point I wanted to make is that, I think front running is actually one of the larger problems in the blockchain space in general. I think people view it in the context of decentralized exchange a lot because decentralized exchange is one of the first use cases in production of smart contract based blockchains. But yeah, I think we’ll see more and more applications having these issues as they start going into production. And I can see in the long run, the end solution might be something like zero knowledge mining where you can’t actually tell, you can’t look at a transaction in the mine pool and see all its properties, but you can only prove that that transaction will pay the miner x amount of fees or whatever.

Meher: So one other aspect of this model of relayers and users is the question of privacy, right? So today, in the 0x model and virtually, all these exchange models, when I’m making an order or I’m taking an order, the linkage between what asset is being traded, how much is being traded, and my address is visible on the blockchain. This address traded this in this much quantity for this much price. Do you see a lot of innovation coming from your side or in the ecosystem around obfuscating this linkage? And what are the interesting approaches and projects here?

Amir: Yes, I think privacy is a pretty big challenge. I think in the context of decentralized exchange, there are probably people would prefer for everything to be private. I think there are some advantages of being transparent as well. You know, if you see someone doing something shady like wash trading or something like that, that’s pretty easy to notice. But, you know, I think in the long run, we do want everything to be as private as possible. I think both zk-SNARKs and ring signatures are potential approaches that we can take to that. The issue right now is probably the cost associated with doing those things. It’s just not viable to, you know, have private transactions because of the per trade cost is going to be too high. But yeah, I’m excited about a handful of different approaches. I think Keep Network is doing some good stuff in that space as well. Different signature types also, I think it can add a decent amount of privacy. We’re looking into BLS signatures right now, which comes with the benefit of being able to share fees in a more private way.

Brian: So speaking about relayers before now, it seems you guys have, I mean, this is one of the amazing things and you guys mentioned a little bit before, that I have noticed sort from periphery that after your token sale, there was all these announcements, okay, this project’s building a 0x project, 0x projects, 0x project. So there’s really just a ton of vibrant startup ecosystem that’s DevOps, which is something quite unique actually for blockchain projects or projects that, token sales, especially, recently as you guys. So what are the business models that people are trying to realize when they’re building a 0x business?

Amir: So I think the business model is very straightforward right now is just hosting the orderbook, broadcast that orderbook and charge fees for trades. And I think that’s actually a big part of why we’ve been so successful. The business model is just so clear, and this is a kind of one of the first ways to monetize blockchain applications in a very cheap way without doing a token sale. I think down the line, we’re gonna see more business models where you have things like wallets where just rebroadcasting orders from other relayers and taking a cut of fees. And I think that’s when we’ll kind of see an explosion in use of 0x.

Brian: Yeah, absolutely. But what I’m curious here, it seems to me that the relayers, I mean, as a user, I don’t really care too much about which relayer. In the end, if my order gets settled, it’s on the chain, then I get the other tokens and I just want the best price. I want like reliable execution. You don’t care about brand, you don’t care, it’s not really trusted very much as we’ve talked about. So I don’t have to worry too much about someone like Coinbase have to been around for years. They have like insurance; all of these things are not relevant. So how would it be possible for those relayers to build a sustainable, profitable businesses that aren’t just going to be kind of a little commodity thing that’s gonna get, you know, driven to zero when it comes to their profit margin?

Will: We’re definitely going to see competition between the different relayers and I think it’s going to be extremely healthy for the entire kind of decentralized exchange ecosystem as a whole. You know, EtherDelta has been extremely successful and I think that it’s incredibly impressive what, you know, Zack Coburn, the founder of EtherDelta, did on his own. That being said, I think teams, you know, some of these relayers since we kind of massively lower the barrier to entry for new dev teams entering the space. I think what we’re going to see over time, is just no competition around user experience. And as a result, and this is something that we desperately need in the blockchain space. You know, creating a decentralized application that talks to the blockchain and does it in a way that the user can understand and feel comfortable with, is extremely hard. And you know, if there’s multiple teams that are competing for market share, one of the first things is providing a great user experience. Everyone benefits from that. Competing on transaction fees, you know, I think these will not go to zero, but they will go to an economic equilibrium that makes sense. And that’s also very healthy for everyone that uses decentralized exchanges.

But I think one of the biggest assumptions that kind of plays into this, you know, hey, there’s like 12 different relayers. There are all kind of trading the same tokens. Do we really need 12 relayers that are doing the exact same thing? And I think the answer is no, but what we’ll end up seeing, you’re kind of—an assumption that’s built into that statement is that there’s a finite number of tokens people are interested in trading and I think that is going to turn out to be false. I think that over the next few years, just you know, there’s been this explosion in the number of tokens that exist, and I think that’s going to continue. There’s going to be a massive number of tokens that are kind of created through token sales. There’s going to be just a Cambrian explosion of non-fungible tokens and video game items that are coming out once the community kind of come to consensus on the token standard for non-comparable tokens. I also think that securities tokens are going to be an incredibly huge new area where there’s tokenization.

And so over the next few years, I think the number of tokens that exist is going to trend towards infinity. And you know, relayers are not going to list millions of tokens. What they’re going to do is they’re going to find a market niche, they’re going to kind of plant their flag, carve out that market niche and you know, there’ll probably be one or two relayers that dominate the specific market niche, but there’s going to be hundreds of market niches. And you know, relayers that focus on real estate tokens. That’s going to have to be a completely different user experience than relayers that offer prediction market tokens. And even within prediction markets, there are so many different kinds of verticals that can be focused like basketball, betting on basketball games, you know betting on elections, politics, science. There’s an infinite number of niches that can be kind of captured by relayers that want to kind of crate, kind of tailor their product for that specific market.

Brian: I mean, my feeling is now, of course, I don’t know nearly as much about this as you. And this is sort of an intuition, but this sounds kind of weird to me. I mean, it feels to me that, you know, let’s say something like Google, right? Well, they can do email. They can do Gmail. I mean, they can literally have most of the world. I mean, they could have the entire world running on Gmail, I think, if people wanted to, they would be able to build out that kind of capacity. I mean, I agree that probably when it comes to user interface, that will vary. And when it comes to marketing and you know, maybe community will matter and stuff like that, right? So I could see there being maybe you won or if you kind of, relayers that just dominate everything and then maybe them having some sort of affiliate type things where anybody can build their real estate funnel on top or their security token funnel on top of that.

Meher: So Brian has sketched out this future. I don’t know. I don’t sort of agree with Brian here and maybe I can sketch out a different future and then we can discuss sort of what will lead to either of the two futures being realized. I think if we look historically on how wallets have monetized. It has almost always been through referring users to exchanges. So when you go to Jaxx and you click on, okay, I want to sell my Ether and get Litecoin, Jaxx refers you to ShapeShift and ShapeShift makes the transaction fee on that exchange and ShapeShift forwards part of those transaction fees to Jaxx. Strangely enough, in the token economy, the UX Maker seems to have this kind of power to influence where the transaction fees are going to flow. And I think that this is going to hold true for prediction markets and the relayer economy. So it might be the case that the application with which people access the CryptoKitties, there might be a few successful applications that people downloading to get access to their CryptoKitties. The UX Makers of those few two or three applications can basically make or break the relayers in the CryptoKitties exchange market. So if there’s a company like Google that let’s say tries to dominate each and every kind of asset in the relayer space, right? It might be the case that there might be a small startup that comes into the market and focuses only on being a CryptoKitties’ relayer. And then it makes really good deals with the UX Makers of the CryptoKitties application and because these UX Makers always referred to this small startup for their exchange needs there, that small startup is still able to carve out a niche against that big Google like relayer that’s trying to dominate every niche. But this is just a feeling. I’m not sure. Maybe Brian is right and this is like one relayer or a couple of relayers to rule them all. What are your opinions on it?

Will: This large relayer that kind of dominates everything, I think rather than being like Google, I think it would be more similar to like a Reddit where there’s literally infinite number of topics and communities that, you know, kind of formed around very specific topics. And you can go to Reddit and you can find your community and then you can subscribe to that community and you can become a part of that community and you can kind of just click on the different communities that you want to become a part of. And you know, I could see something similar to that happening with relayers where there’s this kind of this large dominating relayer that’s kind of similar to Reddit and they offer these sub communities, but if it’s kind of hard to come up with a great example off the top of my head, but if you compare like Reddit and its ability to kind of create communities, you know, there are still places where communities form off of Reddit and that provide like a more tailored experience for the community that they’re serving. You know, there’s a limited amount of customizability that you can provide to your subreddit community using Reddit. So I don’t know, like I could see both of them existing in parallel. I don’t know if that analogy was very clear, but that was my sense.

Amir: I also think that there are going to be enough ways to differentiate yourself as a relayer and some of those ways kind of compete with each other in a way that a single relayer probably won’t do all of those. So to give an example, you know, maybe one relayer is offering trades with a certain derivatives and margin trading protocol and another relayer is offering that with a different protocol. I highly doubt you’re going to have one company that’s offering both protocols, but it was both cater to different users. That in combination with the various different strategies you could take as a relayer would significantly affect user experience and the APIs are available to provide to end users. You know, kind of like the difference between the open orderbook model and the matching models that we discussed earlier is pretty big and it’s not really something that a single relayer would not really be able to offer both of those things. So I think if you take all these different product offerings, all of these different strategies, all of these different demographics that relayers are targeting, we’re going to see a pretty diverse environment.

Brian: So of course, there’s the 0x token. What do you see the 0x token kind of its evolution or he economy of the 0x, what’s that gonna look like in the long run?

Will: So the 0x token, first and foremost, it is a governance token. It allows us to upgrade our system of smart contracts over time without bringing all of the markets built on top of 0x to a haul. And the second thing that the 0x token is used for in the 0x protocol, is for paying transaction fees to relayers. So relayers, if they want to, they can charge trading fees on every trade that kind of goes through their orderbook. And I think a lot of people kind of view this 0x as a payment or like a fee token. They kind of view that as like, oh, this is why this year 0x token exists. You know, it was kind of like a fundraising mechanism that was kind of bolted on as an excuse for us to, you know, our token sale. But it really couldn’t be further from the truth. So the 0x token is a governance token. And the reason why we made the design decision that the 0x token should be used to pay fees is because we think it’s super important that all of the stakeholders in the ecosystem or all of the people that are accessing the protocols functionality have at least, we’re driving them to participate in the governance process by forcing them to have some amount of 0x tokens to access the protocols functionality.

And you know, one of the problems that we’re trying to avoid is if the only people participating in the governance process are the relayers, that can be really bad. Because they’re for-profit businesses and their incentives and their interest and necessarily align with their end users. And so, you know, it could be feasible that if the relayers band together, they could change the protocols in ways that are not in the best interest of the people that are actually using this infrastructure. Or I guess it’s the other half of the people using the infrastructure or the users, the people trading. So, you know, I think this is a really controversial point. A lot of people do not like that the 0x token is used to pay trading fees. You know, a lot of people think if it feels pretty arbitrary, it’s kind of annoying that you have to go and acquire some of these tokens. But you know, I think it really makes sense for the long-term health of the ecosystem. You know, typically, if the governance process is really imbalanced to serve one group of people over another, that ecosystem or that civilization tears itself apart over time. And we don’t want that to happen. We want everyone that uses 0x protocol to have a stake in the way that evolves over time.

Brian: Cool. You know, that makes perfect sense. And it will be interesting to see how those current experiments in 0x turn out.

Will: Yeah, hopefully, it doesn’t rip itself apart.

Brian: Yes, exactly. Although that would also be interesting to watch that. [Laughs]

Will: It would be interesting, but very sad; I would say.

Brian: It will be sad, yes. So tell us what is kind of the roadmap and timeline and what can we expect from 0x in the next 24 months?

Amir: So yeah, currently, we are working on two of the protocol. Major changes are going to include like there are a bunch of efficiency gains, essentially. It’s going to become much easier to arbitrage across the different layers. Per trade transaction costs will be lower. We want to support new token standards such as non-fungible tokens and then we want to improve our upgrade mechanism so that adding new token standards would be easier as well. And as kind of a technical piece, but without getting too into the weeds, we’re going to make it a lot easier for people to kind of build higher level protocols on top of 0x. They get essentially funnel all of their trades through their own smart contracts which would enforce any arbitrary set of rules or logic around filling an order. So that’s kind of on a timeline for the next version. But I think v3, we’ll see some more decentralized governance built into the system for sure. And then, it could really go anywhere from there, right? There are scalability solutions. We’re interested in plasma chains, potentially. You know, having like a Cosmo zone, things like that. Launching on other EVM compatible blockchains. Yeah, I think it’s going to be wild, but v2 is kind of what we’re looking at right now.

Brian: Cool. That sounds very interesting. And yeah, so thanks so much for joining us today, guys.

Will: Thank you so much. What a pleasure.

0:00:00 | -:--:--

Subcribe to the podcast

New episodes every Tuesday