Today we are going to review what 0x (ZRX) is and how does it work. 0x is an open protocol based on Ethereum, which acts as a liquidity provider for the creation of decentralized exchanges or DEX -one of the pillars of the DeFi ecosystem.
What is 0x (ZRX)?
Specifically, 0x is responsible for propagating orders from market makers and matching them with those from liquidity consumers -takers-, externally to the Ethereum blockchain. The main advantage of executing order matching off-chain is that network congestion is avoided. Once the orders have been matched, they are then settled on-chain – which basically means that the new state of the balances, after the exchange of assets between users, is recorded on the blockchain.
The main objective of 0x, therefore, is to facilitate the p2p exchange of cryptoassets -without intermediaries- through the DEXs that connect to its liquidity network. It is important to emphasize the concept of “cryptoassets”, because the protocol not only supports the most popular tokens of the Ethereum network -those compatible with the ERC20 standard-, but also other less known ones such as ERC721 -specific for NFT tokens, and widely used in the field of digital collectibles. It should also be noted that 0x itself is not a decentralized exchange, but the infrastructure -a protocol is a set of rules that allows the members of a system to communicate and interact- to create and connect them to liquidity providers of all kinds.
Along with other protocols such as MakerDAO, Compound, or Kyber Network, 0x constitutes one of the cornerstones of the DeFi ecosystem – a set of decentralized applications, deployed mainly on the Ethereum blockchain, that allow its users to access all kinds of financial services openly, without intermediaries or censorship, and from anywhere on the globe.
0x works as a modular system, allowing developers and projects in the DeFi ecosystem to create products with native functionality for the purchase and exchange of cryptoassets – including tokenized real-world assets. The basis of the protocol is a set of smart contracts, with an extensible architecture thanks to its aforementioned modular nature.
Unlike other protocols such as Kyber, which execute all their operations on-chain, 0x opts for a hybrid approach – order transmission occurs off-chain, while order settlement is executed on-chain. The result is a very efficient system, from a Gas consumption point of view, for the exchange of p2p tokens.
History of 0x
The 0x protocol would be founded in October 2016, in San Francisco, by Will Warren – a former research assistant at Los Alamos National Laboratory – and Amir Bandeali – a former DRW market trader. After coming into contact with Ethereum and becoming fascinated by its potential, the two would decide to create a mechanism to facilitate “trustless” exchanges – that is, without the need to rely on an intermediary – for the thousands of native tokens or tokenized real-world assets – fiat currencies, stocks, commodities – that they foresaw flooding the blockchains in the near future.
The original idea of the project was to launch a decentralized derivatives exchange, as the concept was understood at the time – that is, as a private, for-profit company that would own and manage the infrastructure. In other words, if the plan had succeeded, 0x would not have been so different from a traditional exchange that charges fees for each of the transactions it processes – it would only have differed from its centralized counterparts, in that it would not exercise any type of custody.
Being based in the San Francisco Bay Area would allow them to frequent the meetups organized by the Ethereum community. There they would come into contact with the teams of other projects oriented to what would later become known as the DeFi ecosystem -MakerDAO, Augur, Gnosis, Mellon Port, to name just a few. Interaction with the developers of these projects would lead them to become convinced that Ethereum needed a basic, shared infrastructure for running decentralized exchanges – since the main use case of most of these protocols, required integrating such functionality, forcing teams to develop their own native solutions.
So, finally, they decided to abandon the original idea of creating their own private, for-profit platform and move towards an open, non-permissionless model based on a modular smart contract architecture that would allow anyone to connect it to their own applications as a source of liquidity – i.e. a protocol understood as public infrastructure. This idea has persisted to this day, through the different iterations of 0x – version 3 is currently in production.
ZRX, 0x’s native token, would be placed on the market via an ICO in August 2017. In less than 24 hours, a total of $24 million in ETH would be raised – implying a unit price per ZRX of $0.048. In total, 1 billion units of ZRX tokens would be minted, of which: $500 million would go to ICO participants, $150 million to the protocol development fund, $150 million for operating expenses, $100 million to the team – with a vesting period of 4 years – and $100 million to advisors and private investors.
Although 0x’s headquarters would be based in the San Francisco Bay Area, team members-with specialties ranging from engineering, economic research, and systems design-would be spread around the world. In addition to the founders – Will Warren, who serves as CEO, and Amir Bandeali, CTO – 0x would be joined from the start by advisors such as Fred Ehrsam (Paradigm), Joe Krug (Pantera Capital), Linda Xie (Scalar Capital) and Olaf Carlson-Wee (Polychain Capital).
Looking back at the history of 0x, it is important to understand that the first big wave of decentralized exchanges – the future integrators of 0x – would benefit from the ICO boom of 2017 – and it was through that funding vehicle, concentrated mainly on the Ethereum blockchain, that there was a Cambrian explosion of ERC20 tokens. True, the most popular tokens of that batch – or those willing to pay large sums of money – managed to be listed on the major centralized exchanges. But not everyone was so lucky, and those who didn’t make it to the top tier of exchanges – yes, at that time DEXs were still seen as an extravagance or a consolation prize – had to make do with rudimentary non-custodial platforms like EtherDelta.
So users who wanted to acquire those less accessible tokens would be forced to learn how to use cumbersome systems from a UX standpoint that otherwise would have had no chance of thriving. This would help future 0x integrators – decentralized exchanges that, in the jargon of the protocol itself, are called “relayers” – to process high transaction volumes.
At no point, however, did the 0x team intend to take advantage of the ICO phenomenon to encourage adoption of the liquidity protocol – as they believed that such a rush would be merely a passing phenomenon. The same would not be the case with the emergence of the DeFi movement, where they would see a vein of opportunity, as it was a much more organic and sustainable phenomenon – where users could really get to extract value from their assets through specific applications and the most diverse financial strategies.
How 0x works?
0x is, in essence, a standard for the transmission of messages – transactions – built on a set of smart contracts. We have already mentioned the hybrid nature of the protocol: it allows market makers to send such messages – with order details such as token pair, price, and expiration date – off-chain, and only proceed to settlement on-chain.
Now, in order to settle on the Ethereum blockchain the orders transiting off-chain, it is necessary to keep the data in a token registry that serves as an official reference. The 0x smart contracts will be in charge of validating the messages signed by the “takers” – liquidity consumers, whether buyers or sellers – and then settling the trades on-chain.
The first decentralized exchanges in history would, like 0x, go for a model based on order books – we have examples of this in NXT and Bitshares as early as 2015. The problem with these exchanges is that they were trying to keep their order book on-chain, which prevented them from scaling by overloading the network and slowing it down completely.
The solution 0x would find to this problem would be to move the transmission of orders off-chain through the use of relayers. Relayers are third parties responsible for taking buy and sell orders from users and sending them along with a network. If those orders manage to be matched, the settlement of those orders proceeds to take place on-chain – in this case, on the Ethereum blockchain.
It is important to understand that buy and sell orders are cryptographically signed messages that can be sent via multiple media – even mail. The advantage of this hybrid approach – off-chain message transmission/on-chain settlement – is that the Ethereum blockchain is not forced to store data from unfilled buy or sell orders. The service is more efficient from the point of view of Gas consumption – lower costs for the user – and the network is less overloaded – and therefore does not slow down.
It is a system that brings modularity to the operation of the order books: each application in the DeFi ecosystem can simply assemble a relayer to serve its users, with the advantage, from the point of view of liquidity, of being able to communicate with the other relayers in the network to match orders.
Another fundamental piece of the 0x protocol is its native token, called ZRX – an asset with a capped monetary mass of 1 billion units, so its circulating amount is only increased as the vesting periods established during the 2017 ICO expire.
Originally, ZRX would be conceived as a governance token – what would give it value would be the fact of conferring to its “holders” the ability to influence the decision-making process that marks the development and updates of the protocol. If a market maker generates a large part of its business thanks to the 0x protocol, and this is subject – as is logical – to a process of constant evolution, as a stakeholder it will be encouraged to hold the token to try to preserve its interests and veto those updates that may affect it. However, for such a token to be valuable, it must first generate value at the level that will be subject to governance.
In the first versions of the protocol, in addition to this function of ZRX as a governance token, it would be added its role as a supported vehicle for the payment of transaction fees. That is, the relayers who were in charge of matching orders sent by makers and takers could only charge for their services on ZRX. It soon became clear that this model was not viable as it added unnecessary friction to the trading process and affected the user experience. Therefore, in the current version of the protocol – v3, which will be discussed below – this requirement would be removed.
Version 3 of 0x: staking, governance and a new fee payment system
Version 3 of the protocol implements a number of important changes, aimed at expanding liquidity, making it easier for developers who want to use 0x for their projects, and optimizing the system. These changes include a staking mechanism for the ZRX token, the possibility of aggregating liquidity from different DEXs – as Kyber Network does – and the abolition of the obligation to use ZRX for the payment of fees.
The staking mechanism for the ZRX token is proposed as a way to transfer ownership of the protocol to all its stakeholders. The system includes monetary rewards -in ETH- to encourage participation, as well as an extension of the voting power of the market makers involved in the governance processes -thanks to a proxy mechanism.
It is also a way to incentivize liquidity – a fundamental component of any protocol of this type. Thus, in v3, the commission – fee – that market makers receive for filling buyers’ orders is proportional to the amount of ZRX they have in staking – to which must be added the ZRX that users have delegated to them. Thus, there is an economic component – a premium – that induces market makers to deposit ZRX in staking, but also a political component – this same parameter determines their voting power.
Under this regime, a market maker who contributes less liquidity to the protocol can earn proportionally more than others, as long as he has a greater amount of ZRX in stake – counting his own tokens, and those delegated to him by other “holders”. In a way, we can understand the system as a market balancing mechanism, since the amount delegated to a market maker is indicative of how efficient it is considered to be in the eyes of other users – who are also made participants in the rewards and governance process.
- For each trade executed through the 0x protocol, the taker (liquidity consumer) pays a small commission (fee) in ETH – it is calculated as a multiple of the gas used to process the trade.
- The fees are accumulated in a “pool” – called the Liquidity Rewards Pool – over 10-day periods known as “epochs”.
- At the end of each epoch, rewards are automatically distributed to market makers based on the trades they have processed and the amount of ZRX -proprietary and delegated- they have in staking.
- The rewards that are not distributed -because the market maker has not reached the minimum staking threshold-, are accumulated for the next period.
This design encourages market makers to form staking pools and to offer good conditions to the other ZRX holders to delegate their tokens to them – the way to encourage them is to share part of the rewards generated by processing trades. The better the conditions offered -generally, a percentage of the rewards to be shared with the delegators is established-, the more ZRX the market maker will be able to attract to its pool -increasing the ratio of rewards per volume processed, as well as its voting power.
Any ZRX holder will be able to securely delegate their tokens through applications designed specifically for staking. When delegating their tokens, the holder will receive at the end of each epoch a pro-rata share of the profits generated by the staking pool in question. However, it is important to keep in mind that in exchange he will be giving up half of his voting power, in favor of the market maker he has chosen as a delegate. Obviously, ZRX holders will always try to maximize their profits and will therefore tend to constantly compare the returns offered by each of the staking pools in operation.
It is important to note that in version 3.0 of the 0x protocol transaction fees can be paid with any Ethereum-based token – that is, since it is not essential to use ZRX for this purpose. In fact, the commission does not even have to be paid with any of the tokens traded in the transaction – many traders choose to pay their fees with DAI or USDC by default.
As a liquidity protocol, 0x presents a wide range of use cases: trading of NFTs representing digital collectibles or blockchain-based video game items, order books for lending markets, liquidity for predictive markets. These functionalities offered by the protocol, are mainly accessed through two instances: the relayers – actors in charge of matching orders from takers and makers off-chain, and then settling them on-chain – and the 0x Api – a set of smart contracts that aggregates liquidity from different sources, in a similar way as Kyber does. While relayers have been part of the 0x ecosystem from the start, the 0x Api is a recent development launched with version 3.0 of the protocol.
Relayers are, quite simply, the applications that users interact with and that are responsible for transmitting and matching 0x commands. Relayers can take two approaches: one focused purely on matching, and the other incorporating an open order book.
Order matching type relayers only accept orders where the taker – the liquidity consumer paying the commission – is an address under their control. When this type of relayers receives 2 orders from opposite sides of the market -bid/ask- whose price is compatible, they automatically match them. In this model, the relayer will bear the cost of the gas, being the only one who has the ability to execute the trades – which translates into a better UX for traders. The order matching relayer will know when orders are matched before anyone else and will update the order book as soon as the trade is submitted – providing a real-time trading experience. In short, they feature deterministic trade execution, allow off-chain cancellations of orders, and the fee is taken from the spread of those orders that are matched. Examples of this type of relayers were Paradex and Ethfinex.
Unlike order matching relayers, open order book relayers accept and propagate orders that allow anyone to act as a taker or maker. In this way, traders can share orders across different relayers, which means that smart contracts can be filled through a networked liquidity system. The problem with this approach is that as the transfer rate (TPS) increases, it becomes more likely that different traders will try to fill the same order. To overcome this problem, the 0x protocol is implementing a new element in its architecture that it calls Coordinators. In short, this second relayer model is characterized by liquidity – orders generated by makers – which is consumed through smart contracts – but whose execution can be exercised by both users and contracts – and fees can be paid with any token. Examples of this type of relayers are Radar Relay or Emoon.
One of the new features of version 3.0 of the 0x protocol is an Api – a set of bridging contracts – that aggregate liquidity from different sources – other DeFi protocols, such as Uniswap, Kyber or Oasis. These liquidity sources are added to the native 0x liquidity pool – such as Mesh, which, as mentioned before, act as a network.
This greatly simplifies the task for developers by providing them with a versatile single liquidity connector – both off-chain and on-chain – that allows them to offer their Dapps users a lower spread when they need to exchange tokens. To give an example, with 0x Api a taker will be able to fill his order partially with native 0x liquidity, and the rest with liquidity provided by Uniswap LPs or Kyber Reserves. It will also allow the execution of more complex transactions, such as the balance resets that periodically take place in TokenSets, or the settlements of the dYdX margin trading protocol.