Review of 0x, as a permissionless protocol to allow dApps to integrate & exchange ERC20 tokens in Etherum Blockchain

in #stateofthedapps2 years ago (edited)





The crypto ecosystem by large is in a dilemma to choose a type of exchange to exchange their crypto assets. The type exchange in a broad sense is categorised as either a decentralized exchange or a centralized exchange.

A centralized cryptocurrency exchange is controlled by a central authority who takes the responsibility for matching buy and sell orders, which it can do in real time. But before that, the user has to send his fund to a central account whose private key is not held by the user, rather the central authority. So the security of the fund is dependent on the trust of that central authority which also represents a single point of failure.

A decentralized cryptocurrency exchange is not controlled by a central authority and users retain the control of their own funds. The users don't send money directly to an account that is controlled by a central authority. Instead, trading orders, the release of user funds, etc are authorized directly by users via digital signatures. Simply put, user funds cannot be stolen or hacked as it is not subjected to a single point failure. But it has the other side effect like a trader, may not facilitate with real-time exchange experience because on-chain trading does take some time as the scalability is still an issue. It does not derive liquidity either and that is probably the big concern.

So the choice of a type of exchange for a user at a particular time may be governed by the priority at that point of time. By default, the crypto players are security conscious. Probably that is the reason to why they have opted into crypto assets. But when it comes to priority at a particular moment, that may not be security, at that particular time. Their priority could be a fast exchange where the trader can match an order by an ease and for that, he may be willing to trade with a centralized exchange. For another trader, priority may be the security of the fund and he may opt for a decentralized exchange.

So what if a solution can be offered in which both security of fund & real-time trading experience can happen, so that it can align with the priority of crypto traders all the time. Such a solution which can solve the generic flaws of a decentralized exchange and can combine the basic things of a centralized exchange to give a better solution for the end users.

0x protocol with the philosophy of community empowerment and with a perception that Etherum blockchain can give rise so many tokens and as the dapps ecosystem has gathered pace in crypto ecosystem, aims to offer a solution of decentralized exchange where the dapps can integrate with this protocol and can become a part of shared liquidity. So 0x protocol is the building blocks upon which the decnetralized exchanges can be built.


On-chain Orderbook

This is the first ever version of a decentralized exchange and in the beginning, when the decentralized exchange through Etherum smart contract started, the trader or the market maker had to place the order and each time the trader posts an order, modify an order or cancel an order, it costs some amount of gas. So it created a lot of friction, as the gas cost may be a small amount for a single order, but at the end of the day, this gas cost is a significant amount if the trader is a day trader as he does a lot of transaction on daily basis. Similarly, for the small trader who deals with a very small amount of money, this gas cost may be significant in percentage. Hence it is neither efficient nor cost-effective.

Automated Market Makers

Then comes the second version of a decentralized exchange solution, Automated Market Makers(AMM), as an alternative to on-chain order book. In this type, both the party agree to trade with a smart contract, instead of trading the market directly. Here the order book is replaced with a price-adjustment model which deterministically responds to market participant and market price on either side of the market.

So the advantage of AMM is that the price is always available(as the smart contract is always available as a counterparty) and it is easy to integrate.

But the disadvantage is that it can be subjected to front-running because the deterministic model of price adjustment is insensitive to actual market liquidity. So whether it is a high volume market or a low volume market, the deterministic approach will cause the price to move by same amount. So this brings artificial constraint to supply curve.

State Channels

Then comes the third version of the decentralized exchange solution. Here the transaction happens off the blockchain. The participants in a state channel can pass signed messages, can accumulate intermediate state changes without publishing them, until the channel is closed. So the benefit is that numerous intermediate changes can be accumulated and can be settled by a single on-chain transaction.

State channels definitely improve transaction through-put and also reduce latency.

The set back with the state channel is that for one-time use, it is an inefficient solution, as on-chain transaction and security deposit are required to open and close state channel, which may not be efficient for one-time transaction.


Off-chain order relay & on-chain settlement

This is the fourth version and it is a hybrid version which combines the advantages of state channel and on-chain order book. The trader broadcast an order off-chain by cryptogrpahically signing it and value tranfer is executed on-chain. 0x protocol leverages on this approach to offer a solution of decentralized exchange for ERC-20 tokens where the various dapps on the top of Etherum blockchain can ingrate this protocol and can contribute to the liquidity. 0x protocol with this approach also encourage anyone to become a relayer.

In Etherum ecosystem, so many smart contracts and application-specific dapps are evolving and the number is growing and will further grow in future. So this can lead to a situation where the end user has to deal with so many different types of smart contract and it may not even become possible to make value transfer between these dapps because of the varied parameter of different dapps which have an interoperability issue. So if the dapps can be integrated with a common protocol which can enable decentralized exchange between the dapps, then it can create a ubiquitous decentralized exchange solution for the Etherum network with an open market & shared liquidity.



0x protocol is the building block for a decentralized exchange in Etherum blockchain. 0x protocol uses a publicly accessible smart contract that can act as shared infrastructure for a variety of dApps on the top of Etherum blockchain. So the dApps after integrating with 0x protocol support an open economy and can also have enhanced liquidity(liquidity issue is the generic flaw of decentralized exchange).

The dApps ecosystem can further benefit from decoupling the protocol layer from the application. That gives rise to shared protocol layer. The shared protocol layer further makes the various apps interoperable. If all the dApps with Etherum blockchain can be interoperable, then it can also bring the network effect. The network effect will further boost liquidity. The liquidity can enhance better order matching, competitive pricing in the trade order book and it can also create an open market of the sharing economy. This is really beneficial for the end users as well as several dApps.

0x Protocol as a DAPP in





The general architecture in 0x protocol involves a maker to create an order and send it to the Relayer who updates it in the off-chain order book and that is responded by a taker. The taker fills the maker's order by submitting it to the exchange contract on the Etehrum blockchain. The contract authenticates the signatures, verifies the order and then transfer the tokens between the two parties. As the order book is managed off-chain, the posting and updating of the order happen in real time.



Relayers perform the role of exchange but they are not exchange, because they don't execute the order on behalf of the user. Relayers are just like nodes of 0x network that facilitate the matching of buy and sell order. Relayers broadcast all of the placed orders through the 0x protocol to the entire 0x network of relayers to match buyers and sellers. So Relayers only updates the order book & dont execute the trades of the user, thereby making the things trustless. They just store and update the off-chain order book. The relayers facilitate the signalling between the buyer and the sellers by hosting and propagating the off-chain order book only. They are paid with an incentive for this job.

The key in 0x protocol is that anyone can become a Relayer as it is permissionless. They also keep 100% of the fees that are generated through the trading volume they create.

Now a maker can create a point to point order with another taker and can also create broadcast order through the relayer . The broadcast order is open to all the participants.

Point-to-point order

In point to point order, the maker and the taker can directly exchange their token without taking the service of a relayer. Instead, they can directly relay their message through any communication medium. Th relay message is a packet of data of few hundred bytes and that can be sent through email or any other communication medium. But this type of order can only be filled by the specified taker address and it can not be available for other participants.

Broadcast order

In the Broadcast order, the role of relayers comes into play. The maker has to create an order and that will be relayed by a relayer in the order book which can be responded by any participant. So the difference here is that unlike point-to-point order any one can fill the maker's order.

As the broadcast order also constitute a part of the open market, the relayer has a fee schedule as well. The maker while creating an order has to specify the fees in such a way that it should satisfy the Relayer's schedule and if it is in line with that, then the Relayer will post that to the order book, if not it may get rejected and will not be posted in the order book. The Relayer can have a dynamic fee schedule. But if an order is already posted to the order book, the Relayer cannot change the order's fee.

Smart Contract

It performs the following function in 0x protocol for decentralized exchanges:-

  • It authenticates the order's signature.
  • It stores a reference of previously filled orders. It also prevents the single order from being filled multiple times.
  • It also allows partial fills to be executed multiple times so long as its value does not exceed the total value of the order.
  • It also records the expiration time set by the maker.
  • It also has a cancel option using which the maker can cancel the unfilled and unexpired order.

The protocol token for 0x is ZRX and it has two very specific use case:-

  • The trading fees are in the form of ZRX token and that is paid as an incentive to the Relayers. So the market participant has to buy and use ZRX token to be able to make an exchange through 0x protocol.

  • The protocol token is also used for decentralized governance. The ZRX tokens holder can use their voting power(which is proportional to the amount of token they hold) to play their part in the governance model, updates and future implementation in 0x protocol.


It has a decentralized governance and development mechanism. It is accomplished through proof-of-stake consensus algorithm. So the stake-holder can utilize their voting power to implement the improvement proposal of 0x protocol. The voting power is proportional to the amount of token they hold. 0x protocol does not impose any cost on the users such as seeking rent or extracting value etc from Relayers. Instead, the relayers keep 100% of the trading fees. Further, 0x protocol's smart contract is publicly accessible and free to use. There is no such framework within it to benefit a particular group within the network and it functions in a decentralized way. Decentralized update mechanism integrates the continuous improvement to the protocols without disrupting the dApps and end users.

It makes the dApps interoperable-As various dApps in Etherum blockchain can integrate with 0x protocol and exchange their tokens with other ERC-20 tokens, it otherwise makes them interoperable. So 0x protocol improves interoperability within Etehrum ecosystem.

Shared Liquidity-Lack of liquidity is a generic flaw in decentralized exchanges. As 0x is protocol act as the building blocks for the decentralized exchanges, it can be integrated with other dApps and as other dApps can become a part of the 0x network, all of these dApps will also share their liquidity and therefore the overall liquidity definitely improves. Further, an order can be submitted to many relayers, as a part of the open order book model. This allows the exchanges to share liquidity with each other.

Any one can become a Relayer and create his own fee schedule & liquidity pool-In 0x protocol, anyone can stand up as a Relayer and that further strengthen the spirit of decentralization. A relayer can publish his own fee schedule and create his own liquidity pool & charge transaction fees on volume.

Publicly available Smartcontract-Any dapps can hook into the smart contract of 0x protocol which is publicly available and it is written in solidity programming language.

It lowers the friction & improves the speed of exchange-As the approach in 0x protocol is off-chain order relay and on-chain settlement, it lowers the gas cost(as only value transfers are executed on-chain) and it improves the speed of the transaction.

Eliminates redundancy & lowers the barrier to entry-It improves the user experience by offering off-chain relay and it is secured by the smart contract. So the traders can have the dual advantage of real-time order processing & security of the fund. It further reduces the cost of the market participants, therefore more user will be willing to join the 0x network.


Point-to-point order facility can be used by the participant to exploit the Relayer service- The participant can make an order on the relayer service first(with an intention to cancel it) and then they can also make use of the point to point order to evade the relayer's fees by cancelling the previously created order on the Relayer service. So the good relayers may be at a disadvantageous position most of the time with the exploitation by point to point orders. As the participant can cancel an order without any fee, this exploitation will happen more likely. It could lead to more side deals and side deals are not really good for the overall 0x market. This may also make Relayers more uneconomical to run Relayer's service.

Maker Griefing- It is a kind of attack in which the maker moves the token which is supposed to be in the order, but as the maker moves the token, the final on-chain processing fails. In such a condition, the taker pays the gas fees in an attempt to execute the order, but in the end, the taker gets nothing, rather bears the gas cost for a failed order. If it happens repeatedly then it may cost a significant amount.

Order Competition-In the design of exchange solution by 0x protocol, an order can be submitted to many relayers so as to boost the shared liquidity. But in the process, it encounters a race condition. Multiple traders compete for the same order at a time and only one will be successful. This is a complex case, as being able to assign an order to a single relayer could solve the case but what about shared liquidity then.

Backlogs issue- As in 0x protocol, traders must wait for the previous transaction to mine before proceeding to another order, in the event of the issue of the backlog of Etherum network, the traders will have no choice than to wait indefinitely, until the things get normal in the network.

If the evolution of decentralized exchange solution will be assessed especially for Etherum blockchain and its ecosystem, then 0x stand at a better level, as it has addressed the generic flaws of decentralized exchanges.


The existing decentralized exchange like etherdelta suffered from many flaws and drawbacks such as liquidity, slow order processing, gas cost in cancellation etc. 0x protocol's big advantage is shared liquidity and that also makes the dApps interoperable. The order processing is really fast as it is done through off-chain order relay.

The shared protocol layer is the key feature of 0x protocol. However, it has some downsides such as order collision and griefing. It is natural to have both pros and cons of a solution to decentralized exchange. But the buying point is how much the solution is addressing the long-standing issue of the problem interface and in that regard, 0x protocol is really a viable solution in terms of shared liquidity, as liquidity has been a long-standing issue in decentralized exchange solution. So I would like to give a rating of 4.3 star out of 5 stars to 0x protocol.

While the crypto market is still dominated by the centralized exchanges, owing to several ssiues like liquidity, slow order processing, etc, 0x protocol has taken the evolution of decentralized exchange forward and has offered a solution to overcome the aforesaid issues while keeping the decentralization intact. The fact that anyone can become a relayer further reiterates the spirit of decentralization.


As more and more dApps evolve on the top of Etherum blockchain they can get an opportunity to integrate with 0x protocol and make the entire ecosystem of Etehrum blockchain interoperable. The long-standing issue of interoperability can also be solved to some extent, at least within Etherum ecosystem. The exchange between dApps and their tokens can be possible with 0x network. The 0x protocol can be a valuable catalyst of decentralized exchange solution in taking the ecosystem of Etherum blockchain forward.

More Information & Resources

Reference to the Review of this task-


Hi, @milaan. This is a great deal of information you have here. Well done! Your project review looks almost excellent and I applaud you for that. This is my first time learning about this project and I am even more curious to explore it more. Looks like the ETH blockchain has more unique capabilities that are yet to be discovered. That's said. On the content side, you have used an inline quotation for some texts or paragraph. It would be cool if you had used the other type which clearly separates the texts from the other ones for example:

Another way to quote some texts or a paragraph. Looks more professional.

Overall, I like the effort you've put into this review. I am looking forward to seeing your next review of an Open Source Project.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Chat with us on Discord.


I am overwhelmed by this compliment. This is my first contribution to utopian-io and its a happy moment for me. It gives pleasure when someone reads the effort put in an article. Thank you so much sir.

Thank you for your review, @knowledges! Keep up the good work!

Hi @milaan!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @milaan!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support!
Simply set as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord

Vote for Utopian Witness!