0x Protocol: An Overview

A Protocol for Decentralized Exchange

“Anything that can be assigned a value in the world is going to eventually be tokenized and moved into an open financial network like the Ethereum blockchain”.

We are already seeing fiat currencies and securities getting tokenized. As more of the world’s value gets tokenized, the need to trade these tokens securely and efficiently grows exponentially.

What is 0x?

0x is an open protocol for decentralized exchange on the Ethereum blockchain. A protocol is simply a set of rules used by two or more parties to make it easy to communicate with each other. In this case, it is a message format for two parties to exchange tokens. So instead of having a third-party like a centralized exchange to handle transactions between two parties, they would now be able to exchange directly with one another.

Exchange goes digital

Why decentralized exchange?

Decentralized exchange makes sense because of security.

Centralized exchanged have been fraught with security breaches. Most recently, Bitgrail and Coincheck loosing a combined $670M. Moreover, a study done by Carnegie Mellon University and The University of Tulsa found that out of the 80 exchanges tracked between 2010–2015, 25 of the them had suffered security breaches while nearly half (38) have since closed.

The reason these hacks happen is because centralized exchanges serve as wallets for their users. When trading, users have to deposit their valuable digital assets to the exchange. Knowing this, it makes it all the more attractive for hackers to attempt to breach it.

Decentralized exchanges removes these risks by allowing users to trade without a middleman, directly from their wallets.

So why build an open protocol for decentralized exchange?

Why not just build a proprietary peer-to-peer exchange? There’s a few reasons why an open protocol makes sense:

Networked liquidity:

Most exchanges run on their own proprietary infrastructure which fragments liquidity across the board.

Allowing anyone to build a decentralized exchanges (or relayers as 0x calls them) on the 0x protocol gives way to networked liquidity. Relayers can share liquidity across the network since they use shared infrastructure (0x protocol) instead of proprietary infrastructure. They will also be incentivized to share liquidity by fee-sharing.

Building block for the ecosystem:

An open protocol serves as a building block for the entire ecosystem. That is, others can build on top of it to build more sophisticated dApps. Examples of these are:

Dharma: tokenized debt.

{Set}: collateralized basket of tokens.

dYdX: decentralized financial derivatives.

The projects above don’t have to worry about building the infrastructure to be able to securely exchange because they use the 0x protocol.

dApps:

Decentralized applications, or dApps, are applications that run on decentralized peer-to-peer networks like Ethereum. Many dApps need other tokens to function. For example, to run a Facebook like dApp, one may need some file storage token, computation token and identity token to run it. It is unlikely that the end-user will be bothered to find and hold all these tokens in order to use the dApp.

Instead, 0x will enable token abstraction. A simple overview of how this would work is as follow:

User pays the dApp in with one token such as Ether. The dApp uses a few lines of code to exchange Ether for the needed tokens in the background. The dApp runs seamlessly without the end-user knowing.

How does 0x work?

At it’s core, 0x is a message format and suite of smart contracts.

Message format:

The message format can be thought of as a package of data that signals what you want to trade, for what token, at what price, expiration time and with whom you want to trade (if anyone specific).

Suite of smart contracts:

The smart contracts can be broken up into two components:

The business logic that accepts the signed data packets to process and settle the trade. The upgrade process to make sure the business logic is updated over time.

It all comes together by having market makers input their trade parameters into the message format and signing it. Then, anyone can take that order by sending it to the 0x smart contract that processes the trade to atomically swap the tokens.

Naturally, people will go to a designated place to trade. This is where relayers come in.

Relayers are essentially order book aggregators where they host signed orders from market makers. This drastically reduces costs when broadcasting orders because orders themselves don’t have to go on the blockchain until they are ready to be executed. The approach described above is what 0x calls “off-chain order relay, on-chain settlement”. That is, orders don’t touch the blockchain until they need to be settled. Relayers can then charge fees denominated in ZRX (0x’s native token) on the resulting volume.

There are other approaches to decentralized exchange that are more clearly explained by Fabio Berger in his talk seen here.

0x works on top of the Ethereum blockchain thus only ERC-20 compliant tokens can be traded on the protocol. As interoperability solutions come forth, we will surely see tokens from other chains traded on 0x.

What does the native token do ($ZRX)?

ZRX is the native token of 0x. It is primarily a governance token but is also used for relayers to charge fees.

Governance is often overlooked in its importance. ZRX is used as a governance token in order to make the protocol future-proof. Over time, upgrades are necessary because of changes made to the protocol or the underlying blockchain — Ethereum. Although the exact mechanism for governance is yet to be published — we can expect it by Q2 2018 (has since been published here).

Relayers are incentivized to operate their business on 0x in order to charge fees on the resulting volume. These fees are denominated in ZRX. Relayers get to keep 100% of the fees they charge as 0x is non rent-seeking.

The current state of the ecosystem:

Developer activity on top of 0x has been growing rapidly. As Jacob Horne described it, it is one of the few platforms that has found platform-builder fit. The 0x team is readily available to provide technical guidance and support in the 0x chat and has been constantly shipping tools to make it easier for developers to build on 0x.

There are now more than 25 independent projects building on 0x. These projects fall into two broad categories — relayers and dApps. The complete list can be found here.

Many of these projects are already live on the Ethereum mainnet and have raised funding from notable investors such as Andreessen Horowitz, Digital Currency Group, Polychain Capital and Y Combinator. Projects range from tokenized debt, decentralized derivatives, prediction markets, margin trading, decentralized organizations and more. I intend to go in-depth with some of these projects in another post.

It is important to note that the diversity of these projects building on the 0x protocol happens because 0x is purposefully built as an un-opinionated building block for the ecosystem. As the white paper states, “it does not impose costs on its users or arbitrarily extract value from one group of users to benefit another”. The 0x team also stated that they “will not take a financial stake in, formally advise, or partner with other players in the 0x ecosystem” to remain as un-biased as possible.

Looking forward:

As outlined by Will Warren in his September post (2017), a few things we can expect to see in 2018 are the following:

Fees generated by exchanges will continue to grow hence growing the TAM for relayers.

Regions where cryptocurrencies are banned will move to decentralized exchanges that are able to route around censorship.

Competition for relayers heightened as 0x dramatically lowers the barriers to entry for building decentralized exchanges.

Another trend to keep an eye is tokenization of real-world assets. TrueUSD, a USD-backed stablecoin (ERC-20 compliant) is set to launch on exchanges this month. The Security Token Ecosystem players are working hard to enable trillions of dollars worth of securities to migrate to the blockchain. Although these technologies are in their infancy, because of efficiency gains all around, it only makes sense for securities to be able to be traded on the blockchain. As Anthony Pompliano of Tilt Capital outlines: