Skip to main content
Version: 2.0

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 71 million transactions and $148B+ in volume from more than 8 million users and is used by many of the top trading apps including Coinbase Wallet, Robinhood Wallet, Matcha, Metamask, Zerion, Zapper, and more.

0x swap widget

Why use 0x?​

At 0x, we believe all forms of value will eventually be tokenized and settle 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 APIs to easily access and navigate this fragmented liquidity:

  • Swap API - The most efficient liquidity aggregator for ERC20 tokens through a single API.
  • Gasless API - Never lose a user trade because of gas. Easily build frictionless apps with end-to-end gasless infra.
  • Trade Analytics API - Programatically access historical trades initiated through your apps via 0x Swap and Gasless APIs.

0x routing

tip

ELI5 0x​

0x helps you aggregate liquidity and find the best price, similar to what Google Flights does for flights. Just as Google Flights aggregates options from multiple airlines to help you find the best flights, 0x aggregates liquidity from various decentralized exchanges to help you find the best prices for trading digital assets. Both simplify the process: Google Flights makes booking flights easier by providing a user-friendly platform to compare and book directly, while 0x streamlines trading by offering APIs that enable secure and efficient transactions. This saves you time and effort by eliminating the need to visit multiple sources to find the best route.

The 0x Ecosystem​

0x Tech Stack​

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

0x tech stack v2

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 as wallets, portfolio trackers, DAO tooling, NFT marketplaces.

Relevant Docs:

  • Swap API - The most efficient liquidity aggregator for ERC20 tokens through a single API.
  • Gasless API - enable developers to build frictionless apps with end-to-end gasless infrastructure

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 flexible and gas-efficient 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 Settler'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