February 12, 2019

Advancing Open Finance with 0x and 8base

Andrei Anisimov
@AndreiAnisimov_

0x is one of the most prominent and promising projects in the Open Finance space. We’re excited to announce that our Solution Engineering team began building a product on 8base that utilizes 0x protocol!

Although we can’t share too many details at the moment, we are certain that when released, the solution will significantly democratize access to 0x protocol for businesses. We can share some exciting news though — we received a grant from 0x that has enabled us to begin this project.

Intro to 0x

According to the 0x whitepaper, it is an open protocol for decentralized exchange on the Ethereum blockchain. It is a set of smart contracts deployed to the Ethereum blockchain that allows exchanging tokenized assets in a fully decentralized manner. 0x currently supports ERC20 and ERC721 tokens; however, its flexible architecture allows adding support for other types of assets through implementing new AssetProxy contracts.

Unlike centralized exchanges that are prone to various custody-related risks, with 0x, assets never leave a customer’s wallet. The exchange happens on-chain with assets moving directly from wallet-to-wallet. This significantly improves security, as well as user experience.

Relayers

In the traditional centralized world, the core entity is Exchange. Exchange holds custody of customers’ assets and executes trades on their behalf. Due to their custodial nature, centralized exchanges carry serious financial risks. They need to invest significant capital into security and financial infrastructure to gain the trust of their customers.

0x’s version of the exchange is Relayer. Unlike exchanges, relayers never hold customers’ assets. They simply broadcast cryptographically signed orders created by traders (makers) that other traders (takers) can fill. This makes creating and operating a relayer a significantly less risky and capital intensive task. Relayers can earn revenue through fees, market making, and other methods.

A high-level overview of the protocol interactions:

  • A trader (maker) creates an order specifying an asset they want to give up and the asset they want to get in return, their amounts, and other related fields.
  • Maker cryptographically signs the order and submits it to a relayer.
  • Relayer stores the order off-chain (typically in a regular database) and broadcasts it via a user interface and/or an API. 0x specifies the Standard Relayer API which makes programmatically sharing liquidity in a standardized manner much simpler for relayers.
  • Another trader (taker) sees the order and decides to fill it. They submit the order directly to the 0x Exchange smart contract. At this point, the trade is settled and both maker and taker receive the corresponding assets into their wallets.

Order Fields

A 0x order has the following schema. It is designed to accommodate various scenarios. One significant addition in the second version of the protocol is the senderAddress field, which allows relayers to insert custom on-chain logic in the execution flow (e.g. custom order validation, KYC requirements and more).

  • makerAddress — Address that created the order.
  • takerAddress — Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order.
  • feeRecipientAddress — Address that will receive fees when order is filled.
  • senderAddress — Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
  • makerAssetAmount — Amount of makerAsset being offered by the maker. Must be greater than 0.
  • takerAssetAmount — Amount of takerAsset being bid on by maker. Must be greater than 0.
  • makerFee — Amount of ZRX paid to feeRecipient by maker when the order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.
  • takerFee — Amount of ZRX paid to feeRecipient by taker when the order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.
  • expirationTimeSeconds — Timestamp in seconds at which order expires.
  • salt — Arbitrary number to facilitate uniqueness of the order’s hash.
  • makerAssetData — ABIv2 encoded data that can be decoded by a specified proxy contract when transferring makerAsset.
  • takerAssetData — ABIv2 encoded data that can be decoded by a specified proxy contract when transferring takerAsset.

Before submitting an order to a relayer, the maker cryptographically signs it. This allows the taker to fill the order without further interaction with the maker.

0x Resources

So far, the 0x team has been great to work with. They provide comprehensive documentation as well as their Discord channel for developer support. Some of the resources that we found particularly useful and recommend to anyone wanting to learn more about the protocol:

Conclusion

It is our firm belief that Open Finance will be one of the defining trends of the 21st century that will impact individuals on a global level and enable borderless value exchange at an unprecedented scale and efficiency. At 8base, we’re excited to be a part of the movement and are grateful to the 0x team for their support.

Stay tuned as we unveil more information about this product and how the 8base platform helps make it a reality.

Ready to try 8base?

Sign up for free or simply stay in touch.