0x an open protocol for trustless, low friction exchange of ERC20 tokens

0x is an open protocol for decentralized exchanges, and in this article we will just give you a little bit of background and timeline on 0x protocol. We will describe the problem that 0x is trying to solve, and let you know about existing work that is done on it already. This article is an overview of Will Warren’s presentation about 0x protocol, which he held in Mexico at the Ethereum Foundation Developers Conference in November, 2017.

Will, a co-founder of 0x protocol, said that the motivation behind 0x protocol came from their long term vision that now we can see coming into existence. Anything that can be assigned to a value in the real world can be tokenized and moved to an open network like Ethereum blockchain. Things that could be tokenized are traditional assets like fiat currencies, stocks, bonds, debt, digital goods like video game items, loyalty points, airline miles and even things that are more abstract. Naturally, with all of these different tokens that are going to eventually find their way onto the blockchain, there needs to be an easier way to exchange them.

The situation within Ethereum ecosystem is not ideal

Today, we have quite a few decentralized exchanges on the Ethereum blockchain, but there are many decentralized applications that require exchange functionality in order to operate. Things like prediction markets, stable coins or decentralized fund management platforms require exchange functionality, so the problem that 0x team wants to solve in the ecosystem is that every single one of those exchanges and apps creates their own proprietary and custom smart contracts from scratch. This means that not only each exchange has to bootstrap liquidity from scratch, but they also expose end-users to a bunch of different smart contracts. Those smart contracts have different levels of security and efficiency, even though they all do the same thing, which is not a very efficient approach.

Another issue with having a bunch of different implementations of exchange smart contracts is that there is no interoperability between any of them. It fractures the ecosystem and results in less liquidity for everyone. According to Will, smart contracts should behave like modular building blocks which can be assembled and reconfigured. In the long term, open standards are at an advantage.

There are different kinds of decentralized exchanges

The very first decentralized exchanges created on the Ethereum blockchain took the same functionality of a centralized exchange and pulled it into an Ethereum smart contract. The Ethereum smart contract would store an order book within the contract. This means that every time someone wants to post, modify or cancel an order, they must pay a gas fee and create an Ethereum transaction. For any sort of market maker it becomes unrealistically expensive to create liquidity using an on chain order book. Not only is it really expensive, but you also fill the blockchain with a lot of unnecessary transactions that aren’t necessarily moving any value.

The second class of decentralized exchanges are automated market makers. Automated market makers don’t have two parties on either side of the trading directly, both parties trade with a smart contract. The exchange rate that is offered by that smart contract is modified deterministically, depending on how strong the market forces are on either side of the market.

The third approach are state channels. They are amazing for reducing latency and increasing permeability because transactions occur off the blockchain. Also you can collect series of intermediate state changes in a queue. Those series of states you can aggregate and settle on the blockchain in a single transaction. The issue with state channels is that they are great if you want to trade daily, but if you want to do just one trade to get tokens and immediately use them it’s not a great idea. You have to move your funds into the channel and you have to place down a security deposit. A security deposit is required to ensure that everyone within the channel is behaving honestly.

0x protocol aims to resolve those problems

So, to resolve those problems 0x protocol was created. 0x protocol is comprised of a standard order scheme that represents different parameters associated with a given order. The parameters include two assets that are being exchanged, the exchange rate, the expiration time and a cryptographic signature of parameters. This is coupled with a smart contract system that is responsible for settling these trades directly on the blockchain. What really defines 0x protocol is a lack of any rules about how you choose to pass these cryptographically signed chunks of data around the blockchain. Transport layer is arbitrary, so you can generate one of these cryptographically signed orders and send it to the counterparty in an email or over Facebook, or you can write it down on a piece of paper and send it to them using a carrier pigeon. It does not matter, the cryptographic signature just needs to be valid.

Another difference is that message passing semantics are arbitrary and you can use a variety of strategies. If I want to trade directly with the counterparty in a peer-to-peer fashion, I can just create an order and specify the parameters under which I would like to trade. I can cryptographically sign it and send it to my counterparty, so we can settle that trade directly on the blockchain completely free of charge. There are no fees involved other than the gas costs. Usually, people need to go to a location where a bunch of different parties are interested in trading and where these orders are aggregated in a single location called real layers, similar to decentralized exchanges.

What’s cool about 0x is that anyone can be a real layer. Anyone can create a decentralized exchange and charge trading fees on all the volume that they created. They would keep 100% of fees that they are charging. There is also a variety of relayer strategies that a relayer can use. You can use an open order book strategy like EtherDelta, which has a public post list where people can put their orders up and anyone can take them down. You can also do a centralized matching strategy. The third option is a shape shift type exchange where someone essentially acts as a reserve manager and just posts a bid and asks for single trading pairs.

How an open protocol could help?

If you have an open standard you can create really robust developer tools like 0x javascript library and things like your standard API. With those tools the 0x team massively lowers the barrier of entry for new users and developers who want to create decentralized exchanges. Since the protocol is here, we could end up with a variety of decentralized exchanges that are highly competitive on fees as well as user experience. They could target different market niches and result in diversity of decentralized exchanges.

If every single decentralized exchange is speaking the same language, that creates network effects around liquidity where each relayer isn’t necessarily competing with others. They could actually benefit from a new relay and enter the ecosystem as arbitrage. Decentralized applications could also be the source of customers for those decentralized exchanges and relayers.

Great feedback from the crypto community

Since they deployed 0x protocol on the Ethereum on August 15th, 2017 we have seen a crazy explosion of development activity. There are up to ten different, completely independent, developer teams creating relayers on top of 0x protocol. The team behind 0x protocol said they are really excited to see all this development activity.

Independent developers out there are creating trade explorers that allow you to view and explore various trading activities working on top of 0x protocol. They can sort trades by different relayers, by different trading pairs, etc… It’s really nice to see that people are building something on top of it completely independently.

What is really exciting about 0x and what makes it so different from other protocols is the fact that 0x protocol allows smart contracts to natively execute trades in a single line of smart contract code. This is really powerful because it allows 0x protocol to act as an exchange module that natively exists within the EVM (ethereum virtual machine). Such approach allows 0x to be treated as a sort of a fundamental building block that can be combined and built upon by other developers creating their own protocols.

Today we have a few protocols built on top of 0x protocol. One of them is Dharma, a generic, permissionless protocol for issuing, underwriting, and administering debt instruments as cryptographic tokens.

Decentralized exchanges are created on top of 0x protocol, decentralized applications and now decentralized protocols. There are many different decentralized applications that decided to integrate 0x protocol right now or at some point in the future because it will allow them to get into the functionality they need without having to write any code from scratch.  

Governance of 0x protocol

0x is an open system and there is a variety of stakeholders, each of them with their own motives and desires for the protocol. However, all of them benefit from network effects of building on top of the same shared asset.

At the same time 0x protocol is a system of the ethereum smart contract that is immutable, but must remain future proof over time. How could you decide on protocol upgrades? You can either allow a small group of developers to make all decisions about the future direction of the protocol or you can allow all the stakeholders in the system to have a fair say. They decided to create a decentralized governance mechanism that uses token voting for future upgrades to the protocol.

Token abstraction

Everyone here is probably a little bit sick of all the tokens out there and you might not want to deal with another token. To address this problem the team behind 0x came up with an idea based on token abstraction enabled by 0x. 0x team is really excited about what future might bring us, but we should think about the next five or ten years from now. When we think about decentralized application, we are used to think of them as some sort of vertically integrated monoliths built on some blockchain. What we are starting to see is an unbundling where there are many layers and decentralized applications which all of them have specialized networks with distinct incentives and tokens. Just imagine decentralized application requiring a consensus layer. Also, it might require some file storage and computation, or an external mechanism to inject external data into that dApp. If we have all those different layers in a decentralized application stack, and you are the end user of this dApp, you will have to have all those different tokens for each layer.

That’s something that we don’t think many people are excited about. In order to power some sort of sophisticated decentralized application you might be required to have a handful of different tokens. that’s not a very good user experience. 0x could play an important role in the future of something called token abstraction, where the end user of a decentralized application won’t have to hold a variety of tokens that he may not know or care about. User can simply hold some tokenized fiat and pass it along, using a stack of 0x orders, to a decentralized application that you want to use with the smart contract. It will forward those fiat tokens and 0x orders onto the 0x smart contracts and the smart contract will synchronously and immediately receive a variety of tokens which it needs to power that decentralized application. The smart contract will continue to do its thing, using them as it needs to.

This could have a great significance for our future, instead of having a bunch of different tokens as an end user, in the future you might just go to a decentralized application and see that it’s going to cost you a few dollars in fiat tokens to access some of its functionality.  

Published by

Alen Huskanovic

Alen is the CEO of a digital agency Async Labs based in Croatia, EU. Strong focus on blockchain development and product management. You can reach him on Twitter @ahuskano for any business inquiries.

Leave a Reply

Your email address will not be published. Required fields are marked *