HomeAnswerNotificationsCustomize Feeds
How does 0x protocol work in building decentralized exchange in etherum blockchain? Does it really bring 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.

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 hunred 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:-

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