0x is a protocol for the decentralized trading of assets on Ethereum. 0x's most appealing property is its use of off-chain order relay and on-chain settlement. Off-chain order relay allows orders to be created cheaply - users don't have to post a transaction on the blockchain, they just need to sign an order with their private key. Only when the order is executed is the blockchain involved. Because order books contain low value and high volume information, the offloading of the order book from the blockchain makes sense and will make any decentralized exchange built on 0x not only cheap to use, but highly efficient.
0x is live on Ethereum's main net and many decentralized exchanges and dApps currently use it including RadarRelay, Paradex, dYdX, and DDEX (one of the most popular decentralized exchanges in Asia).
How does 0x work?
A key problem with decentralized exchanges is the representation of the order book on the blockchain. As previously mentioned, order books contain low value and high volume information, yet blockchains typically have low throughput. As such, placing the order book on the blockchain is inefficient and costly. Prior to 0x, you could either place the order book on the blockchain (OasisDex), or use an automated market maker (AMM) which replaces the order book with an automated price-adjustment model. The former is inefficient and costly and the latter is difficult to implement correctly.
0x solves these problems by moving the order book off the blockchain while still guaranteeing and facilitating trustless order execution (note that 0x also allows order book-less point-to-point trading). 0x is not an application per se, it's a protocol that enables decentralized trading. The protocol is implemented as a system of Ethereum smart contracts that are publicly accessible, free to use, and that any dApp can hook into. DApps built on 0x can choose to access a public liquidity pool or create their own liquidity pool. The protocol is unopinionated: it does not impose costs on its users or arbitrarily extract value from one group of users to benefit another. This is a choice left to the dApp developers.
The protocol also comes with the ZRX token. Any dApp that uses the protocol and wants to charge its users trade fees needs to denote the fees in ZRX. ZRX will also be used for decentralized governance meaning holders of ZRX get a say in how the protocol changes.
This is a quick example of how order execution over ZRX works:
- User 1 approves 0x's decentralized exchange smart contract to access their balance of Token A.
- User 1 creates a broadcast order to exchange Token A for Token B. The user specifies an exchange rate and expiration time. The user signs the order with their private key.
- User 2 finds the order and decides to fulfill it.
- User 2 approves 0x's decentralized exchange smart contract to access their balance of Token B.
- User 2 submits User 1's order to 0x's decentralized exchange smart contract
- The smart contract performs authentication and verification before making the exchange between both users' wallets.
Users can create orders but without a medium to discover them, the system would lose a lot of value from illiquidity. This is where Relayers come in. They are decentralized exchanges built on 0x that facilitates the discovery of 0x orders. Relayers are typically websites that host a centralized order book containing 0x orders and a user interface for trading. Examples of Relayers include DDEX, RadarRelay, and Paradex.
Relayers are able to charge a percentage of each trade as a fee for their service. This is made possible since 0x allows orders to also specify a fee schedule and a fee recipient. To fulfill such an order, the fee schedule and recipient must be respected. Since Relayers control what orders are displayed, they can force all orders to have a specific fee schedule and recipient.
0x fundamentally supports two types of orders: point-to-point orders and broadcast orders. Point-to-point orders allow two parties, and only the two parties, to exchange between each other. When a user creates a point-to-point order, they need to specify the receiver's address and only this address can fulfill this order. Broadcast orders allow anyone to fill the order.
0x also supports partial filling of orders. A user filling an order can specify an amount to fill. Multiple partial fills can happen for an order as long as the sum of their fill amounts doesn't exceed the order's total value.
An order can also be cancelled by the creator. To do so, the creator needs to issue an on-chain transaction.
Finally, 0x v2 introduces many more complex order mechanics including Taker Abstraction, Atomic Order Matching, and Batch Settlement. You can read more about 0x v2 here.
0x has a unique way to support protocol changes. Because an Ethereum smart contract is immutable, changes to the 0x protocol require creating completely new smart contracts. If done incorrectly, this can be disruptive. Poor ways to do so include forking the smart contract system or replacing a key data storage smart contract which would invalidate all open orders.
To support smooth protocol upgrades, 0x uses smart contract abstraction, a Proxy smart contract, and a Decentralized Autonomous Organization (DAO) to manage smart contracts. Smart contract abstraction is used to enable smart contract replacement without disrupting underlying data stores. Users provide the Proxy smart contract with access to tokens they plan on trading. The intent of the Proxy smart contract is to stay relatively static such that users only need to trust this smart contract, regardless of changes to the protocol. The DAO controls protocol changes by authorizing new smart contract(s) to access user tokens via modifications to the Proxy contract's whitelist. The DAO can also deprecate old smart contracts by removing them from the whitelist. The governance of the DAO is decentralized. Holders of ZRX get a say, proportional to the amount of ZRX tokens they hold, on what smart contracts the DAO whitelists.
The team behind 0x
Amir presenting 0x at ETHWaterloo.
Led by co-founders Will Warren and Amir Bandeali, 0x is a strong team that consistently ships. Before dropping out of the UCSD PhD program and starting 0x, Will was a graduate student researcher at Los Alamos National Laboratory working on laser technology, optics, and signal processing. 0x co-founder Amir was a Finance major who previously worked as a fixed-income trader at DRW. As evidenced by 0x's success to date, the two have gone on to build a strong team of operational staff and engineers.
ZRX token may be unnecessary
The 0x protocol is one of the best projects on Ethereum. However, if I had to identify one weakness, it's that it's questionable as to whether the ZRX token has added significant value to the protocol so far. The argument for using the ZRX token include fee payments and decentralized governance. However, the fee for an order can easily be denoted in the assets being traded. This is much simpler than having it be denoted in a different asset, which introduces many complications such as the need to account for an extra exchange rate. In the case of decentralized governance, the use of ZRX makes more sense, but there are still inherent weaknesses. Since decentralized governance is implemented through the ownership of an asset, and asset ownership generally follows the power law (that is, a small amount of users end up owning the majority of an asset), we risk a governance model that isn't truly decentralized but, rather, governed by the wealthy.
Here's an excerpt from Louis Aboud-Hogben's article, "Protocol Incentives and the ZRX Token", where he expands on the dubious nature of decentralized governance through asset ownership:
"People often consider governance mechanisms as a defensive measure against hard forks, and there is also a view that governance rights can accrue value to a token (such as ZRX). I struggle with these concepts, as any governance decision that is valuable enough to an individual stakeholder (or genus of stakeholders) to justify significant value accrual to the governance token will likely be significant enough to justify a hard fork. Picture a scenario where 40% of 0x relayers support proposal x, and 60% support proposal y. The governance value model suggests that each side will acquire tokens in order to influence the result (up to the point that it is economically rational). However, should the supporters of proposal y acquire sufficient voting rights and succeed in having their proposal adopted, then the marginalized relayers could simply sell their tokens, fork and take all their liquidity to a new protocol, leaving the ‘victorious’ group holding a token that probably just lost 40% of its value."
As dubious as I am of governance through asset ownership, Fred Ehrsam makes a great point in his article, “Blockchain Governance: Programming Our Future”, that a well structured governance system is valuable. The uncertainty that remains is what that governance system looks like. Here’s an excerpt:
“As with organisms, the most successful blockchains will be those that can best adapt to their environments. Assuming these systems need to evolve to survive, initial design is important, but over a long enough timeline, the mechanisms for change are most important. As a result, I believe governance is the most vital problem in the space. Other fundamental problems like scalability are arguably best approached by using governance to set the right incentives for people to solve them.”
0x is a protocol for the decentralized trading of assets on Ethereum. Its defining feature is its support for off-chain order creation while still guaranteeing and facilitating trustless order execution. This allows decentralized exchanges to move order books off the blockchain which increases efficiency and decreases cost. My only concern with the 0x protocol is the questionable value added by the ZRX token (with respect to fee payments and a truly decentralized governance system). That said, there's no doubt that this is one of the strongest and most promising projects in the ecosystem.