Open frameworks played an important role on the internet we see today. If you want to build a web app from scratch you have to do a lot of things yourself (listening to requests from port 80, writing a wrapper to interact with your database, etc).
But, people hardly code from scratch. Instead, they use MVP frameworks like Laravel, CodeIgniter, Django, Flask, etc. You can reuse their code which was refined over time by the community. This process can save you time and help you take your ideas to market faster.
Building autonomous systems that can facilitate transactions on Ethereum from scratch is hard and time-consuming. Your code needs to be optimised because you have to pay for the computational power utilised.
0x is an open protocol that provides you the architecture to enable decentralised trading. In other words you can build a decentralised exchange using 0x APIs.
What is a Decentralised Exchange?
In a decentralized exchange, trading happens directly between people’s wallets. The decenteralised exchange doesn’t hold their user’s assets.
Traders create an order at the price in which they want to buy or sell and pre-authorises a transaction. The order is broadcasted through out the network, traders who are willing to counter the order fills it.
If Sara wants to exchange BAT for ETH, she specifies the price at which wants to sell it and create an order in a decentralized exchange. The decentralised exchange pings her wallet to take her approval in order to pre-authorise the transaction.
After her approval, the order is visible to other traders who can choose to fill the trade. Mark chooses to fill the trade, he authorizes the transaction through his wallet.
The trade happens, Sara’s BAT token get transferred to Mark’s wallet and his ETH is sent to her wallet. The trade didn’t require a middleman to hold tokens.
With the help of 0x, you can focus on the core business logic and worry less about the architecture. 0x smart contracts are rent free and open source. It is backed by a strong community who continuously refine and optimise its code.
You can use their APIs to easily program money or even build a decentralised exchange/relayer. We already have a lot of projects built on top of 0x. Radar Relay, ERC Dex, DDEX, Paradex (Acquired by Coinbase) are the popular relayers built on 0x.
They are called relayers because they use 0x’s infrastructure to enable trading. These relayers can charge its users a fee for its services. This is a win-win situation for both 0x and relayers because they will individually market and compete to build quality services on top of 0x.
When relayers attract more users, 0x will start growing as an open platform. This would also enhance 0x architecture since its open source and contributed by the community. Relayers thus don’t have to worry about maintenance and system upgrades, they can focus on the core business model.
How Does Trading Happen on 0x?
In order for the trading to happen, we need a system to create, match and fill orders. As discussed in the earlier example, Sara creates the order and Mark sees the order and chooses to fill it.
These created orders need not be filled. Frequently writing data on Ethereum is inefficient and costly. 0x uses a brilliant approach and take the order creating, matching and filling process off-chain.
0x matches orders by broadcasting signed messages across the network, only when an order is filled, trade is executed on the blockchain. This approach reduces the load on the blockchain and enables efficient trading.
The Four Key Components of 0x Protocol
0x protocol is made up of four key components. Makers, takers, relayers and smart contracts. Let’s see how these components worth together to enable decentralized trading.
Relayers offers interfaces(web or mobile apps) to users. There is a fee for using the 0x platform which needs to be paid using ZRX. Relayers offer competitive pricing to its users.
The makers are users who want to sell or buy tokens. In one of the earlier examples we discussed, Sara is a maker who wants to trader her BAT tokens. Makers use the relayer’s interface(eg. Radar Relay) to create orders by authorizing the transaction using their private keys.
The order will contain parameters like the tokens they like to trade, the price at which they want to buy or sell, the relayer fee and time in which the order will expire if it’s not filled.
Relayers validates the maker’s order and appends it to their order book. These orders are also visible to other traders using the relayer. When a trader chooses to fill the order created by the maker he becomes a taker. Some relayers automatically matchmakers who make opposite orders.
Once the order is matched, the Ethereum smart contract executes the order on-chain. Tokens get exchanged directly between the wallets of maker and taker. The relayer receives the agreed amount of fee.
Relayers are only one of the use cases of 0x, the potential applications of 0x are infinite, let’s have a look at some of the application.
Applications of 0x
The process of creating a decenteralised organization on Ethereum, issuing tokens, developing code to manage the governance by voting, etc requires technical resources. It’s also time-consuming and costly.
Aragon is a decentralised application that uses 0x protocol to help users easily built decentralised organisations on Ethereum.
Fintech products that help people invest their money efficiently aren’t something new. However, these products lack transparency.
Auctus is retirement planning platform that makes use of the 0x protocol. You get human and robotic advisory to help you manage your assets efficiently. Advisors are incentivised based on their advice.
A lot of experts who make predictions, most of these predictions fail. What if we can make them accountable for their predictions?
Augur is a prediction market platform that uses 0x protocol. An expert can make predictions on the platform by holding their money. If their prediction comes true they are incentivised else they lose their money.
The kind of applications that can be built on 0x is vast. We are yet to see its true potential. You can have a look at the story “18 Ideas for 0x Relayers in 2018” written by Tom Schmidt from the 0x team.
This story is part of our “Deep Dive Into ERC20 Ecosystem” Series. In the second story, we have reviewed relayers built on 0x.
In our previous story, we introduced 0x. In this story, we have reviewed popular relayers built on 0x, here is our…medium.com
Claps Please 👏 , Thank You 😊. Follow us Hackernoon and me (Febin John James) for more stories.
We are also taking an initiative to bring people working in the crypto space closer. If you are a developer, designer, marketer, writer, trader, entrepreneur, etc in the crypto-space please fill this form. We will curate the list and share it with you, that can help you build your network.