0x (ZRX) Analysis : Decentralised Exchange Protocol On Ethereum
(I) Why a Decentralised Exchange?
1. Centralised Exchanges :
a) Risk of getting hacked because of single point of failure thereby resulting in loss of millions of dollars.
b) Risk of getting shutdown due to legal accountability.
These exchanges have to follow the law of the land, their long-term operation depends on the countries they are based on. Example: Currently in my home country India, traders live at a risk that the exchanges would become non-operational anyday after the RBI’s order to banks to stop supporting cryptocurrency exchanges.
Basically, these suffer from the issues that all centralised services suffer from.
2. Decentralised Exchanges :
a) Custody of your crypto/digital asset remains in control of the individual thereby eliminating risk of lose of funds.
b) Trustless : You only need to trust the smart contract code which is open source thereby ensuring that no one gets preferential treatment.
In theory, a decentralised exchange can be better than a centralised one, so what features do decentralised exchanges lack when compared to their centralised counterparts?
- User-friendly : Most of the current decentralised exchanges are plagued by basic features like having a bad UI, although they are getting better overtime.
- Liquidity : Currently, there are not a lot of buyers & sellers so there is lack of liquidity which can result in huge price fluctuations whenever there is a large buy or sell order.
Although, liquidity problem is going to get solved as more & more people start trading on decentralised exchanges.
- Trading fee : Most of the decentralised exchanges are build on top of ethereum.
Trading fee corresponds to ethereum gas fee, which is substantial.
- Support for only ERC20 tokens : Decentralised exchanges built on top of Ethereum support trading in only ETH & ERC20 tokens. Support for other crypto would be fixed after adoption of cross-chain atomic swap goes mainstream.
Some Prominent Decentralised Exchange Projects:
(II) 0x Team
1. Will Warren (CEO) : B.S. Mechanical Engineering from UCSD
2. Amir Bandeali (CTO) : BSc. Finance (Minor in Computer Science) UIUC -Despite working as a trader, built up his CS skill-set on the side
3 Coinbase alums — Fred Ehrsam (Co-founder Coinbase), Olaf Carlson-Wee (1st Coinbase employee; Founder Polychain Capital), Linda Xie (ex-PM Coinbase; Co-Founder Scalar Capital).
Joey Krug (Founder Augur, Co-CIO Pantera)
Complete Team : Here
(III) 0x Architecture :
Visual Explanation Of Architecture : here
0x is a protocol i.e. it’s public infrastructure, anyone can create a for-profit business (relayer) on top of it. The team made a decision to avoid building a walled garden as done by most models in the space.
The team raised just enough money privately to pay for the legal fees and to survive without thinking of a business model.
In a sense, it is solving a public goods problem (providing liquidity to various dapps) and the ICO model has facilitated the team to do that by providing them money to survive, build a team & financially benefit them if their project succeeds and price of their token rises!
At it’s core, 0x protocol is a message format:
Each order is a data packet containing order parameters and an associated signature. Order parameters are concatenated and hashed to 32 bytes via the Keccak SHA3 function. The order originator signs the order hash with their private key to produce an ECDSA signature.
You specify your intent to enter into a trade by specifying parameters like these in your message:
- Tokens you are exchanging
- Exchange rate
- Time you are willing to enter a trade (Expiration time)
- makerFee, takerFee- Total units of ZRX paid to feeRecipient(Relayer) by maker & taker respectively.
The above image represents the 0x architecture, explained below:
We have three parties in the trade: relayer, maker, taker:
- Relayer (list below) builds a UI in the form of an app or website and maintains an off-chain order-book. Let’s assume the relayer has a website similar to Radar Relay.
- An order maker quotes his trading price and other parameters of the message format. He signs the message thereby pushing the order on the website (order book).
- An order taker sees the maker’s order on the website (order book) and submits a buy order. By doing so, he is submitting a transaction to the Blockchain via the trade settlement contract.
He needs to pay a gas fee (in ETH) and taker fees which goes to relayer(in ZRX token).
- The trade settlement contract processes the data sent to it by the taker and accordingly settles the trade on the Blockchain.
- The governance contract is used to upgrade the trade settlement contract as new token standards emerge.
Note: The 0x team only maintains the trade settlement and governance smart contracts. The goal of 0x is to make upgrading of the contract through token voting. The team is thoroughly researching about governance (rumours about collaborating with Aragon team) including things like liquid democracy in which token holders can delegate their voting power to someone they deem capable to vote on their behalf.
(IV) Role & Business Model Of Relayers :
Relayers host an off-chain order book (drastic reduction in trading fees) and broadcast to the public in anyway they see fit, eg: mobile app, website.
B- Model : Relayers can earn money in many ways, eg: charging trade fees, advertising on their website etc.
To understand how a relayer looks like, definitely have a look at Radar Relay.
List of relayers that will be (or are) using the 0x protocol :
- ERC dEX
- IDT Exchange
- The 0cean
- Token Jar
(V) Why Would 0x Work?:
In the next couple of years, there would be infinite number of tokens.
One single relayer can’t list all tokens on it’s platform.
There would be a handful of relayers that would dominate the market but they wouldn’t be able to research and list all tokens due to sheer volume of tokens.
As a result there would be hundreds of relayers catering to a particular niche of tokens, eg: relayers for listing real estate tokens would be very different to say prediction market tokens.
0x would allow for all these relayers to build on top of it’s protocol thereby providing liquidity to thousands or even millions of tokens.
(VI) Evolution of 0x Token:
0x is a governance token, it allows to upgrade the 0x smart contract overtime without bringing all of the markets on top of it to a halt.
It is also used for paying transaction fees to relayers, this feature ensures that all the stakeholders in the ecosystem have some amount of 0x tokens and are driven to participate in the governance process.
Show me some love by giving the claps! Also, I run a Blockchain youtube channel in which I make educational content and interview founders in the space.
Channel Link : https://www.youtube.com/arnavvohra7