0x Protocol Analysis
I've been looking into the 0x project for a couple days now, and although it isn't the most exciting thing at first, it really has the power to reshape the Ethereum ecosystem into something much more secure. The first time I wrote this, it ended up just being a huge wall of text that wasn't very appetizing. Hopefully this format is quicker to digest at a glance but detailed enough to really understand things if you're interested.
What is 0x?
- Open standard protocol for dApps to use for handling trustless exchange of ERC20 tokens.
- Built using Ethereum smart contracts for trustless, secure operation and interoperability.
- Unopinionated and does not impose costs on users or arbitrarily extract value from one group to another.
Why do we want 0x?
Centralized exchanges sort of suck
Mt. Gox, Shapeshift, and Bitfinex have all experienced security failures, some of which lost billions of users funds. Coinbase, Poloniex, GDAX, etc. - all suffering downtime from DDOS attacks and high traffic spikes. Don't even get me started on the fees..
0x protocol enables transactions of ERC20 tokens between users in a secure, trustless, feeless, and quick manner through the use of Ethereum smart contracts. The only cost is the standard gas fees for processing on the network.
*Relayer fees are supported by 0x, but more about this later.
Decentralized exchanges sort of suck
Have you ever used EtherDelta or Maker Market? If you're one of the few, you may have noticed how slow and clunky these decentralized exchanges (DEXs) are. This is largely because the order book is stored on the blockchain. That means every order you place, remove, or fill is subject to gas fees, and the entire process is limited by the block times on the network.
Best of both worlds?
What if all the security benefits of DEXs were implemented in a way so that the problems with slow order books and gas fees for every modified or canceled order were eliminated? Faster, cheaper transactions without any centralized point of critical failure? That's 0x.
How does 0x work?
0x is implemented with Ethereum smart contracts, which I won't be digging into too much. The message format and other technical information is available in the whitepaper.
The main idea for 0x is to be used by other projects as a back-end transaction protocol. Thus, the 0x protocol itself is application-agnostic, and helps decouple the transaction protocol layer from the application layer.
To understand why 0x works the way it does, it's important to first know about a couple existing models.
Current decentralized exchanges (DEX)
Existing DEXs like EtherDelta and Maker Market are not very popular because they end up being expensive and slow. This is because the order book is stored on the blockchain, so every time you post, modify, or cancel an order you have to pay the gas fees associated with changing the blockchain state. Additionally, since everything is limited to the generation time of blocks, the exchange performs extremely slowly compared to other centralized exchanges.
Automated market maker (AMM)
AMM smart contracts get away from on-chain order books by having an automatic price-adjustment based on the asset's market force on either side of the trade. This has the benefit of always being available since there's only ever one price, but AMMs generally have a worse price than traditional exchanges. AMMs also impose an artificial constraint to the supply curve, and if the price-adjustment model is too sensitive, small trades will effect the price more than they should. If it's not sensitive enough, arbitrage will take over and the AMM bankroll will run out.
State channels move transactions off the main blockchain by having participants send cryptographically signed messages between each other. Once the "micro transaction" is complete, the result is published the the main blockchain and gas fees are applied. This method is one way of scaling the Ethereum blockchain and reducing costs. There are drawbacks such as the need for participants to be online for the entire state channel transaction, security deposits, and numerous on-chain transactions required to set up the state channel. This makes it inefficient for one-time transactions.
0x hybrid implementation
0x refers to their model as a "off-chain order relay with on-chain settlement". It combines the efficiency of state channels with the fast settlement of on-chain order books. The steps of a transaction using 0x are as follows:
- Makers cryptographically sign orders
- Makers off-chain broadcast orders themselves or through a relay
- Counterparty accepts the order and injects it into a smart contract to execute trustlessly
- The DEX processes the exchange on the blockchain
Relayers & the ZRX token
For the 0x protocol to be easy enough for liquid markets to emerge, there needs to be public locations where buyers and sellers can post their orders, i.e. an exchange. Since the actual transaction protocol is handled by 0x, building an exchange becomes much easier, but there are still costs associated with running it and hosting a live order book. This is where the ZRK tokens come in.
While the 0x protocol does not require transaction fees, they are supported. This allows large relay services to collect fees on the liquidity they are enabling by charging ZRX for broadcasting a maker's order to many potential takers.
The ZRX tokens serve a two-fold purpose. In addition to being used for the transaction fees, ZRX tokens are used for decentralized governance over the 0x protocol. This allows for a smooth update mechanism to the underlying smart contracts.
0x intends to integrate with the ENS system so that makers, takers, and relayers are easily identifiable with their human-readable .eth names.
A Token Registry containing information about the ERC20 tokens will also be accessible so that participants have an easy way to verify token addresses and exchange rates. 0x stakeholders will provide oversight to what goes in to this official registry.
The development roadmap mentions possible integration with Aragon or Boardroom in the future for stakeholders to generate, inspect, and vote on proposed updates to the protocol.
Current development & team
0x has an over-the-counter (OTC) dApp running on the Kovan test network that facilitates transactions using 0x protocol with no transaction fees. Right now, makers have to manually broadcast their order (email, social media) since there are no big relay services.
As you can see, many common ERC20 tokens are listed and custom tokens can be added (similarly to how MEW does it). You simply have to choose which tokens you want to buy & sell, the exchange rate, and the expiration date. Once you've got the signed transaction, you use a relay service to broadcast it - in this case, yourself.
0x protocol is also partnered with several large crypto companies like Augur and Aragon.
Joey Krug, the founder of Augur, is one of their lead advisors. Also, Fred Ehrsam and Linda Xie, co-founder and product manager at Coinbase, have their names on the project. Needless to say, 0x has the support required to integrate into the Ethereum the ecosystem.
ICO and ZRX tokens
The crowd sale for ZRX tokens is currently scheduled for late Q3 / early Q4. It will fund the development of the 0x open source software and infrastructure required.
The approximate distribution of tokens is:
- 70% to crowd sale investors
- 18% to the foundation (since it's a nonprofit)
- 10% to the founding team
- 2% to advisors
The ZRX tokens have a fixed amount of 100,000,000 and there is no continuous issuance model (no mining). The lockup period for founders, advisors, and staff is over 3 years with a schedule to release 25% after the crowd sale, 25% after each subsequent year in monthly installments. New staff has a 4 year vesting schedule with a one year cliff.
The ZRX tokens sold in the crowd sale to investors are not locked up and are immediately liquid. It is unknown if US citizens will be allowed to participate as they are still investigating legal and regulatory implications. The only cryptocurrency accepted during the crowd sale with be ETH.
Version 1.0 of 0x will be deployed to the canonical Ethereum blockchain after security audits, but prior to the public crowd sale.