0x Protocol
0x Protocol is a decentralized protocol that enables the peer-to-peer exchange of assets on the Ethereum blockchain. 0x was founded by Will Warren and Amir Bandeali in 2017. [2][26][28]
Overview
0x is a permissionless liquidity protocol built on Ethereum for creating decentralized exchanges, connecting liquidity providers, and incentivizing market makers to fuel DeFi asset trading. The protocol supports token exchanges for ERC-20, ERC-721, and other Ethereum token standards[1][3][4].
0x protocol essentially is a standard messaging format and suite of smart contracts based on which the transacting entities can exchange digital assets or tokens. The message format is a set of data fields that carries key information like the digital asset or token to be traded, the price value of the transaction, the expiration time, and the defined identities of the transacting parties. The smart contracts take care of the necessary business logic responsible for generating, sending, receiving, and processing the data linked to the trading activity. The system also uses relayers, which act as order aggregators and are responsible for broadcasting the orders from designated market participants to the marketplace or exchange[7][8][9].
The 0x team announced the launch of the v4 update of the protocol in January 2021. The 0x v4 voting process has been in progress from January 16 to January 23 and aims to reduce requests for quotation gas costs by 70%. According to the 0x Labs blog, this version enables customizable modules to execute atomic operations, including token wrapping and unwrapping.
Products
0x API
The 0x API is a collection of services and endpoints that can be run together or separately. In aggregate, the APIs provide interfaces to 0x liquidity, 0x staking data, and more. The 0x API is a way to source liquidity from 0x Mesh as well as on-chain sources such as Kyber Network (KNC), Uniswap, Oasis Network (ROSE), Curve Finance, and other decentralized exchange (DEX) networks. 0x API automatically creates an order that can be passed directly to the user's smart contracts to be settled on-chain and no API key is required.
0x Mesh
0x Mesh is a peer-to-peer network for sharing orders. 0x Mesh has several different use cases for different categories of users:
- Relayers can use Mesh to share orders with one another and to receive orders from market makers. This allows them to increase the depth of their order books and provide a better user experience.
- Market makers can use Mesh to reach a broader audience. Their orders can be sent throughout the network, picked up by many trading venues, and are therefore more likely to be filled.
- Mesh allows for a new type of relayer called a "serverless relayer". In the serverless relayer model, each user runs Mesh in their browser and there is no backend server or database. Instead, peers share orders directly with one another.
Matcha
Launched in June 2020, Matcha is a decentralized exchange (DEX), where users swap their tokens peer-to-peer through the Ethereum smart contract infrastructure. Unlike other exchanges that only use a single liquidity source, Matcha aggregates, liquidity from a growing number of sources, including 0x, Uniswap, Balancer, Curve, Kyber Network, Oasis Network, and others. By using smart order routing, Matcha automatically provides the end-user with the best possible price for their trade.
Matcha aims to be unique because of its focus on education. Most other exchanges simply list the available tokens and trading pairs without providing information on them. Matcha has invested in building asset pages that serve as a place for users to discover and learn about tokens. For example, before executing a trade Matcha will show the user a detailed order review, estimated slippage and value lost, and a transaction time estimator to avoid any surprises due to network congestion.
ZRX Token
The 0x protocol is powered by an ERC-20 utility token known as ZRX. Nodes (also known as relayers) that host an off-chain order book and offer user-facing applications that present this information and allow users to make, fill and cancel transactions are paid in ZRX tokens (as trading fees). ZRX can also be used to participate in platform governance, helping holders suggest and vote on changes to the protocol.
0x completed a token sale in August 2017, raising $24 million in Ether (ETH) in less than 24 hours at a base price of $0.048 per ZRX. A total of 1,000,000,000 ZRX tokens, were minted with the initial allocation as follows:
- 50% to token sale participants;
- 15% for operation expenses;
- 15% as a developer fund;
- 10% to the team vested over 4 years;
- 10% to initial advisors and private investors.
In 2019, 0x announced an overhaul of the ZRX token, adding extra functionality, and allowing ZRX holders to delegate their stake to a market maker to earn passive rewards while retaining their voting capacity.
0x Protocol v4 Update
The 0x Protocol v4, released on February 16, 2021, introduces several updates aimed at improving decentralized trading. These updates are designed to streamline interactions among makers, takers, and relayers within the 0x ecosystem, focusing on enhancing efficiency and security.
Relayers and Fee Negotiation
Relayers in the 0x Protocol maintain off-chain order books and receive transaction fees upon the completion of trades. The process involves makers creating orders that include fees set according to the relayers' schedules. These orders are verified and published on the order books, where takers can fill them via smart contracts on the Ethereum blockchain. This setup enables decentralized and flexible negotiation of transaction fees.
Smart Contract Functions
The protocol operates through an Ethereum smart contract that provides basic functions for order filling and cancellation. The contract uses the `ecrecover` function to verify makers' signatures, ensuring transaction integrity. Orders can be partially filled, with references stored in the contract to prevent duplication.
Decentralized Governance and Continuous Updates
The 0x Protocol v4 also includes a decentralized governance mechanism, which allows updates to be integrated without disrupting existing dApps or end users. Protocol tokens will be issued to enable market participants to pay transaction fees to relayers and participate in governance, supporting the safe updating of the protocol.
Token Registry and ERC20 Standards
An on-chain token registry will be used to store metadata for ERC-20 tokens, making it easier to verify contract addresses and exchange rates. The protocol remains compatible with any token that uses the ERC-20 interface, simplifying integration with external contracts. [29][30]
New Matcha DEX Aggregator
0x launched the latest version of its DEX aggregator, Matcha, on May 17, 2023. This update introduces key features to improve user experience within the decentralized finance ecosystem.
The new “Matcha Auto” transaction mode, designed to increase the likelihood of transactions being included in the next block, reduces the risk of failed trades. Additionally, Matcha increased its token coverage from 11,000 to 4.7 million and the number of liquidity providers by 47%, from 70 to 100+ DEXs.
The platform’s smart routing consolidates prices from multiple decentralized exchanges, securing competitive prices for users. In the past 30 days, Matcha recorded approximately 16,900 users and 60,310 trades, with a total trading volume nearing $529 million.
The latest version also introduces cross-chain swap functionality, enabling asset exchanges across seven blockchains: Ethereum, Optimism, Polygon, Arbitrum, Avalanche, Base, and BNB Chain. [31][32][33]
Gasless API
The Gasless API is a feature introduced by the 0x Protocol in January 2024 to facilitate decentralized trading by removing the need for users to directly manage gas fees. This initiative extends the functionality of the existing 0x Swap API, which has been in operation since 2020. The Swap API has been utilized by over 500 teams to access more than 100 exchanges across nine blockchains, facilitating over $139 billion in trade volume and 65 million transactions for 7 million users.
Reducing Complexity in Decentralized Finance
In the decentralized finance (DeFi) sector, gas fees and related complexities, such as fluctuating gas prices, transaction delays, and inadequate token balances, are often seen as significant obstacles to user adoption and participation. According to a report by Coinbase Wallet, a substantial number of Ethereum swaps (69%) encounter "insufficient gas" errors, representing a common point of friction.
The Gasless API addresses these challenges by allowing gasless swaps, in which gas fees are covered by the API and included in the overall trade cost. This mechanism eliminates the requirement for users to maintain a balance of native tokens specifically for gas fees. The gas fees are incorporated into the transaction, with the cost being settled in the traded token.
Features of the Gasless API
-
Simplified Processes: The Gasless API removes the necessity for separate gas fee management and token approvals, aiming to streamline user interactions.
-
Optimized Transaction Speed: The API adjusts gas fees dynamically based on real-time conditions to enhance the likelihood of transactions being processed in the next block.
-
Enhanced Transaction Reliability: By simulating transactions prior to submission, the Gasless API can help identify and prevent potentially problematic trades.
-
Access to Liquidity: The API connects to liquidity from over 100 Automated Market Makers (AMMs) and other market makers, using meta-transactions to achieve optimal trade prices.
-
Developer Integration: The Gasless API can be integrated with minimal coding, and is supported by a variety of technical resources, including tutorials and documentation.
Compatibility and Usage
The Gasless API is available on multiple blockchain networks, including Ethereum, Optimism, Base, Arbitrum, and Polygon. It can be combined with the 0x Swap API to provide additional trading options, such as an automatic switch to a gasless mode when gas is insufficient.
Organizations such as Robinhood, Coinbase, and Matcha have integrated the Gasless API into their platforms. Reports from these entities indicate improvements in transaction success rates and user engagement following its implementation. [36]
0x Protocol's Pricing Engine: v2
0x Protocol has launched its latest advancement in July 2024, known as 0x v2, which is an updated pricing engine designed specifically for on-chain applications. This new engine focuses on optimized trade execution, access to a broad range of liquidity, enhanced security features, and improved monetization tools, catering to the evolving needs of businesses within the Web3 ecosystem.
This release is distinct from previous versions of the protocol itself. While 0x Protocol v4, launched four years ago (2021), laid the groundwork for decentralized finance (DeFi) applications by providing developers access to aggregated DEX liquidity, 0x v2 represents a new generation of pricing and trading technology. It is tailored to handle the growing complexity of on-chain liquidity, arising from the increasing number of tokens, decentralized exchanges (DEXs), and blockchain networks.
Features and Functionality
Advanced Routing Mechanism: The 0x v2 engine incorporates a routing algorithm, termed the Argon Router, that identifies efficient paths for executing trades. The algorithm employs two primary techniques:
-
Multiplexing: This method divides trades across various liquidity sources to minimize price impact and improve execution efficiency.
-
Multihop Routing: This approach allows trades to be executed through intermediate token steps, thereby accessing deeper liquidity and minimizing price effects, particularly for trades involving tokens with limited liquidity.
The routing mechanism also includes a Request for Quote (RFQ) system that facilitates access to liquidity from market makers, similar to centralized exchanges, enhancing the options for trade route optimization while minimizing slippage.
Gas Cost Management: The pricing engine integrates a gas cost estimation model that aligns quoted prices with actual gas fees. This feature is designed to reduce trade failures caused by inaccurate gas estimations and lower the transaction revert rate.
Security Protocols: 0x v2 employs several security protocols, including the Permit2 standard, to address risks associated with token allowances. The engine's smart contracts, referred to as 0x Settler, utilize single-use, amount-based signatures to limit allowance exposure, reducing potential vulnerabilities related to indefinite approvals.
Security assessments for the 0x v2 smart contracts have been conducted by independent firms, such as Ouroboros, Trail of Bits, and OpenZeppelin. The contracts undergo continuous analysis using security tools to maintain protection standards.
Monetization Tools: 0x v2 provides tools for businesses to manage monetization processes, such as controlling the types of tokens used for collecting fees. This functionality assists in maintaining predictable balance sheets and reducing complexity in financial management.
Additional Functionalities
-
Integration of Liquidity Sources: 0x v2 enables the integration of new liquidity sources to support evolving trading environments.
-
Fee-on-Transfer (FoT) Token Handling: The engine supports the trading of tokens with embedded transfer fees, accommodating various token types.
-
Error Handling Improvements: Enhanced error validation and clear error messages aim to improve the development process and reduce troubleshooting time. [35]
0x v2 Bug Bounty Program
0x Protocol started a bug bounty program in July 2024 in partnership with Immunefi for its updated version, 0x v2. The program is open to public participation, offering rewards of up to $1 million for the identification of critical bugs. The program seeks to identify and address potential vulnerabilities within the 0x v2 architecture, contributing to the overall security of its smart contracts and related systems.
The scope of the 0x v2 bug bounty program includes the 0x Settler (Smart Contracts), Swap API, Gasless API, and the Matcha website. Reward amounts are determined according to the Immunefi Vulnerability Severity Classification System V2.3, with all payments made in USDC on the Ethereum blockchain.
For critical vulnerabilities in smart contracts, the reward is set at 10% of the funds directly affected, up to a maximum of $1,000,000. The exact amount is calculated based on the time and date of the bug report submission, with a minimum reward of $100,000 to incentivize timely reporting of significant security issues. High-level vulnerabilities, such as those involving the theft or permanent freezing of unclaimed yields or royalties, may receive rewards ranging from $35,000 to $100,000, depending on the risk level. Critical vulnerabilities found in the website or applications are eligible for a reward of $50,000. [34]
Team
- Will Warren — Co-founder & Co-CEO
- Amir Bandeali — Co-founder & Co-CEO.
- Alex Xu — Chief of Staff.
- Ben Burns — Designer.
- Brandon Millman — Engineering Manager.
- Jacob Evans — Senior Engineer.
- Greg Hysen — Engineering Manager, Protocol.
- Blake Henderson — Product Manager
- Zack Skelly — Head of Talent.
- Remco Bloemen — Technical Fellow.
- Chris Kalani — GM, Matcha.
- Peter Zeitz — Research Fellow
- Clay Robbins — Ecosystem Development Lead.
- Eugene Aumson — Senior Engineer.
- Jason Somensatto — Senior Counsel.
- Steve Klebanoff — Senior Engineer.
- Xianny Ng — Engineer
- Brent Oshiro — Community Engagement Lead.
- Daniel Pyrathon — Senior Engineer.
- Lawrence Forman — Senior Protocol Engineer.
- Paul Vienhage — Research Engineer.
- Rui Zhang — Corporate Counsel.
- Mason Liang — Research Engineer.
- Patryk Adaś — Designer.
- Alex Kroeger — Data Scientist.
- Theo Gonella — Product Manager.
- Alex Towle — Protocol Engineer.
- Oskar Paolini — DevOps Engineer
- Michael Zhu — Protocol Engineer.
- Fulvia Morales — Product Manager.
- Kim Persson — Engineer.
- John Johnson — Senior Engineer.
- Nicole Setter — Workplace Experience Specialist.
- Max Torres — Finance Lead.
Advisors
- Fred Ehrsam, Paradigm
- Olaf Carlson-Wee, Polychain Capital.
- Joey Krug, Pantera Capital, Augur.
- Linda Xie, Scalar Capital.
- David O. Sacks, Craft Ventures.