Skip to main content

Introduction to 0x

tip

Prefer to watch a video instead? Jump to 0x Videos.

What is 0x?

0x is a developer's one-stop shop to build financial products on crypto rails. 0x provides a suite of APIs that enable developers to build faster, find the best prices, and create superior UX for their customers. Our suite of APIs has processed over 66 million transactions and $141B+ in volume from more than 6 million users and is used by many of the top trading apps including Coinbase Wallet, Robinhood Wallet, Matcha, Metamask, Zerion, Zapper, and more.

Why use 0x?

At 0x, we believe all forms of value will eventually be tokenized and on chain. Because more and more forms of value are tokenized, liquidity is increasingly more fragmented across different blockchains and different DEX protocols on the chains. This makes it increasingly challenging to access tokens - not every liquidity source has every token, not every token is available on every chain.

0x offers a suite of APIs to easily access and navigate this fragmented liquidity.

  • Swap API - power crypto trading for thoughts of tokens with the deepest liquidity
  • Gasless API - enable developers to build frictionless apps with end-to-end gasless infrastructure
  • Price API - get real-time market prices for tokens pairs

The 0x Ecosystem

0x Tech Stack

0x's professional-grade APIs are built on the 0x Protocol, a set of secure, audited smart contracts. Applications building on these tools are part of the 0x Ecosystem.

0x tech stack

The diagram below shows an overview of the 0x Ecosystem, which includes applications who supply liquidity (Makers), applications who demand liquidity (Takers).

0x Protocol is an open-source, decentralized exchange infrastructure that enables the exchange of tokenized assets on multiple blockchains.

Makers and Takers

Within the 0x Ecosystem, there are two sides - Makers and Takers:

Supply (aka Makers)

This is the entity who creates 0x orders and provides liquidity into the system for the Demand side (Takers) to consume. 0x aggregates liquidity from multiple sources including:

  • On-chain liquidity - DEXs, AMMs (e.g. Uniswap, Curve, Bancor)
  • Off-chain liquidity - Professional Market Makers, 0x's Open Orderbook network
  • Relevant Docs:

Demand (aka Takers)

This is the entity who wants the Maker's asset. The Takers agree to trade their asset for the Maker's asset; in other words, they consume the 0x liquidity. Examples include projects such as MetaMask, Coinbase, and dydx.

  • Relevant Docs:
    • Swap API - The most efficient liquidity aggregator for ERC20 tokens through a single API.

How does 0x work?

Let’s look into how a 0x order is executed.

how does 0x work

  1. A Maker creates a 0x order which is a json object that adheres to a standard order message format (see list of all 0x order types here). It indicates what kind of asset the Maker is committed to trade. Assets could include fungible tokens (ERC20), non-fungible tokens (ERC721), or bundles of assets (ERC1155).
  2. The order is hashed, and the Maker signs the order to cryptographically commit to the order they authored.
  3. The order is shared with counter-parties.
    • If the Maker of the 0x order already knows their desired counter-party, they can send the order directly (via email, chat, or over-the-counter platform)
    • If the Maker doesn’t know a counter-party willing to take the trade, they can submit the order to orderbook.
  4. 0x API aggregates liquidity across all the supply sources to surface the best price for the order to the Taker. 0x helps traders create, find, and fill the 0x orders through the paradigm of off-chain relay and on-chain settlement. This means that 0x does not store orders on the blockchain; instead, orders are stored off-chain, and trade settlement only occurs on-chain. This unique feature makes 0x a flexible and gas-efficient DEX protocol for developers to build on.
  5. The Taker fills the 0x order by submitting the order and the amount they will fill it for to the blockchain.
  6. The 0x Protocol's settlement logic verifies the Maker’s digital signature and that all the conditions of the trade are satisfied. If so, the assets involved are atomically swapped between Maker and Taker. If not, the trade is reverted.

What can I build on 0x?

Below is a non-exhaustive list of projects that have been built on 0x. Note that 0x can also be integrated into any existing application where exchange is not the core purpose of the application. For more examples this blog post.

Demand (Takers)

  • Exchanges
    • A decentralized exchange for X asset on Y market
    • An Ebay-style marketplace for digital goods
    • An over-the-counter (OTC) trading desk
  • Wallets
    • Digital wallets whose users want to exchange tokens
  • Options and derivatives platform
    • A DeFi protocol that needs liquidity and exchange to function (e.g. a derivatives, lending, or options protocol)
  • Portfolio managers
  • Prediction markets
  • Non-fungible tokens (NFT) Exchange
    • NFT marketplace
    • Games with in-game currencies or items
  • Investment strategies (e.g. DeFi index funds, DCA apps)
  • Data
    • 0x multi-chain analytics portal
    • Real-time trades panel w/ GraphQL wrappers

Supply (Makers)

  • Orderbook models
  • Automatic Market Makers (AMM) models
  • Market Makers
    • A market making or arbitrage trading bot