Diving deep into 0x Protocol

Usman Fazil
Coinmonks
Published in
2 min readApr 26, 2018

--

Background:

0x is an open source protocol built on top of Ethereum blockchain for the exchange of ERC20 based tokens. Exchange of tokens are done by a system of Smart contracts, any decentralised application(DApp) built on top of Ethereum blockchain can use this protocol, and can access public liquidity pools or can create their own liquidity pool. The key feature that distinguish 0x protocol from decentralised exchanges is it’s off chain order relay and on chain value transfer.

General sequence of off chain order and on chain settlement :

Now let’s talk about the offchain order relay and on chain value transfer in detail. Follow the Fig 1.1 Step by step. Description of every step is given below the Figure.

(Figure 1.1)

Step 1: The Maker allows the Decentralised exchange (smart contract) to access his/her Token A.

Step 2.a: Maker creates an order for the exchange of his/her Token A with Token B, and gives a desired exchange rate with an expiration date. After that Maker signs the order with his/her private key.

Step 2.b: Now Maker can send the order over any communication medium including email, facebook, Skype etc.

Step 3 : The Taker come across the maker’s order and wants to exchange his/her tokens with the Maker’s tokens. The Taker fills the order(using fill() function in smart contract).

Step 4: Now the Taker will allow the Decentralized exchange (smart contract) to access his/her Token B.

Step 5: Taker submits the Maker’s order to the decentralized exchange.

Now the Decentralised exchange (smart contract) will validate the order, checks whether the order is expired or been already filled with someone else, if not then it will exchange Tokens between Maker and Taker.

To know about how Point to Point order and Broadcast Order works on 0x protocol, I would recommend u to read our article on this topic as well.

Point to Point Orders and Broadcast Orders on 0x Protocol.

Thanks to Sidra Tariq for helping us on this article.

--

--

Usman Fazil
Coinmonks

Blockchain and crypto enthusiast, exploring the vast field of peer to peer communication. Check git here https://github.com/usmanfazil