0x Protocol Review

0x Protocol

0x Protocol

User rating:

0/5 (0 votes)

Open Dapp

Basic info

  • Token ZRX
  • Audited yes
  • DAO yes
  • Yield farming yes
  • Team public
  • Hacks no

Audits

Auditors:

Trail of Bits Consensys Diligence ABDK Consulting

Trail of Bits Consensys Diligence ABDK Consulting

Token profile

Price Market cap.

Last updated: Jan 10, 2024

What is 0x Protocol?

0x Protocol is a decentralized exchange infrastructure provider, which is essentially an open-source, publicly owned project that anyone can use, build upon, and govern. It was founded by Will Warren and Amir Bandeali in 2017. Although 0x isn’t an exchange itself,  the set of smart contracts it provides is deployed by numerous projects including dYdX, Coinbase, Zapper, and many others. 

The 0x ecosystem includes dApps consuming liquidity and such providing it and since the project also provides tools and open access to pools of shared liquidity, developers can integrate with the protocol at smart contract or application layer and share the opportunities provided by the infrastructure. The protocol primarily serves as a foundational layer for the decentralized exchange of tokenized assets, including cryptocurrencies, NFTs, and DeFi tokens.

The two major consumer groups of the company’s product are referred to as Makers and Takers. While the first group creates 0x orders and provides liquidity into the system, the latter consumes it. The protocol aggregates liquidity from sources such as DEXes, AMMs, Professional Market Makers, and 0x’s Open Orderbook Network.

Crucial to 0x Protocol's offerings are its various APIs and tools tailored for developing financial applications on blockchain platforms. These include:

  1. Swap API: For crypto trading across a wide array of tokens, ensuring deep liquidity.
  2. Price API: Providing real-time DEX prices for various tokens, it keeps users abreast of market opportunities.
  3. Tx Relay API: Focuses on creating frictionless applications with gasless infrastructure.
  4. Orderbook API: Allows integration of limit orders in apps or direct liquidity access from the 0x Orderbook.
  5. Token Registry API: Offers detailed and curated token metadata to trading apps.
  6. 0x Dashboard: A tool for managing API integrations and accessing developer resources.

How does 0x Protocol work?

The 0x Protocol operates as a multi-chain decentralized exchange infrastructure, facilitating the exchange of tokenized assets across various blockchain platforms. The ecosystem comprises Makers, who create orders to trade assets, and Takers, who fill these orders. Makers supply liquidity, and Takers consume it. At its core, the 0x Protocol employs a system of smart contracts and a unique trading process.

0x Protocol is built on a system of smart contracts, which are composable and modular, centered around its ZeroEx (Exchange Proxy) smart contract. This system leverages a unique architectural pattern known as the delegate-call proxy pattern, which is central to its operation and efficiency.

The ZeroEx contract uses this pattern to create a system of composable smart contracts. This means that the main contract (ZeroEx) can delegate calls to other contracts (known as "features"), each responsible for specific functionalities. 

In the ZeroEx architecture, different functionalities are encapsulated within various "features". These features are essentially individual smart contracts that implement core functionalities of the 0x Protocol. They are trusted with user allowances and are governed by the protocol's governance mechanisms.

The ZeroEx contract includes mechanisms for managing ownership and control over the contract. Functions like “transferOwnership()” are part of its governance structure, allowing for administrative control over the protocol's features and operations. More than that, the protocol allows for migrations, which are essentially upgrades to the system. Migrations enable the introduction of new features or modifications to existing ones. During a migration, the ownership of the contract can temporarily change to facilitate the upgrade process.

The ZeroEx contract and its features use a storage bucket pattern. This means that each feature has its own compartmentalized storage within the Ethereum blockchain, preventing overlap and ensuring data integrity. Additionally, each feature or function within the system has its own version, allowing for independent updates and tracking.

Furthermore, 0x provides APIs for developers to build financial crypto products. These APIs are crucial for integrating 0x functionalities into various applications.

What is the 0x Protocol trading process?

Makers generate 0x orders in a standard message format, specifying the asset type and trade terms. After creating an order, Makers sign it cryptographically. The order can then be directly sent to a known counter-party or shared via an order book to unknown Takers.

The 0x API aggregates liquidity from multiple sources to provide Takers with the best available trading options. Takers fill the order by submitting it and the fill amount to the blockchain, where 0x Protocol’s smart contracts execute the trade.

The protocol ensures atomic swapping of assets between Makers and Takers, meaning the entire transaction is either successfully completed or reverted. 0x stores orders off-chain to reduce gas fees and congestion, but the actual trade settlements occur on-chain.

How does the 0x Protocol Swap API work?

The 0x Swap API is a tool designed to facilitate cryptocurrency trading within applications. It operates as a REST API running on HTTP, and its primary function is to aggregate liquidity and find the best available prices for various crypto trades. 

The Swap API collects information from multiple decentralized exchanges (DEXes) and professional market makers across popular blockchains like Ethereum, Polygon, and Arbitrum. It brings together liquidity from over 100 sources, including Automated Market Makers (AMMs).

The API employs a proprietary algorithm to analyze various aspects like gas costs, available liquidity, execution quality, and price impact. It then splits a user's transaction across different sources to maximize returns and minimize costs.

Developers can use the Swap API to query for prices of ERC20 assets, receive a detailed quote for a trade, and execute the trade. The API's response includes details like the selling and buying amounts, gas costs, and the contract address to which the call data should be sent.

The Swap API is designed to be compatible with popular web3 libraries such as web3.js and ethers.js, and has been integrated into a variety of applications, including centralized exchanges, fintech platforms, self-custody wallets, decentralized exchanges, and portfolio management apps.

How does the 0x Price API work?

The 0x Price API is another tool developed by 0x Protocol, it is designed to provide real-time market prices for a vast array of token pairs across numerous blockchain networks. 

The Price API is designed to support high-frequency data requests, offering access to current market prices for any token pair among over 4 million tokens, covering 11 different blockchain networks. 

The API aggregates liquidity from numerous on-chain and off-chain decentralized exchange networks. This includes sampling thousands of liquidity sources, both off-chain and on-chain, to provide accurate real-time pricing data.

How does the 0x Protocol Tx Relay API work?

The 0x Tx Relay API offers a "gasless" experience for ERC-20 token swaps. Traditionally, users need to possess a blockchain's native token to pay for gas fees. The Tx Relay API changes this by allowing users to perform transactions without directly paying these fees. Instead, the API enables transactions where the gas costs are abstracted away and paid by a third party, like 0x, using the trade's input token (sell token).

The API provides end-users with liquidity in the form of prices and quotes. If a user agrees to a provided quote, they can authorize the transaction through an EIP-712 message, which the 0x Tx Relay API then submits to the blockchain on their behalf.

The EIP-712 and EIP-2612 Ethereum Improvement Proposals are crucial to the 0x Tx Relay API's functionality, as EIP-712 standardizes human-readable messages for transaction authorization, while EIP-2612 introduces gasless token approvals, allowing users to permit others to spend their tokens in a single transaction. Essentially, these are meta-transactions that allow smart contracts to perform actions on a user's behalf. By signing an EIP-712 message, users grant the 0x Tx Relay API permission to submit transactions for them.

How does the 0x Protocol Orderbook API work?

The 0x Orderbook API is a key component of the 0x ecosystem, designed to facilitate limit orders across various blockchain networks. It allows applications to enable limit orders or directly take liquidity from the 0x Orderbook. 

The 0x Protocol supports different types of orders, including Limit and RFQ (Request For Quote) orders. Limit orders are standard 0x orders facilitating ERC20 to ERC20 trades, while RFQ orders are a simplified version, primarily used for swap quote construction on 0x API, and are settled more efficiently.

Orders within the 0x ecosystem consist of various parameters like maker token, taker token, amounts, and expiry time. They require a unique signature from the maker or a registered order signer. The protocol supports EIP712 and EthSign signature types for order authentication.

The Orderbook API provides various endpoints for managing orders. These include fetching orders, posting new orders, and obtaining configuration details for orders. The API also supports WebSocket connections for real-time order updates.

How do 0x Protocol Limit Orders work?

0x Protocol's Limit Orders allow users to specify a price at which they wish to buy or sell a certain amount of cryptocurrency. Unlike market orders that execute immediately at the current market price, limit orders only execute when the market price reaches the user's specified price. This gives traders control over the price at which they trade, reducing the risk of slippage (the difference between the expected price of a trade and the actual price). Limit orders in 0x are settled through its smart contract infrastructure. 

How to use 0x Protocol?

In the 0x ecosystem, there are two main roles: Makers and Takers. Makers are those who provide liquidity. They create 0x orders that are available for others to fill, thereby injecting liquidity into the system. These orders can include various types of assets like fungible tokens (ERC20), non-fungible tokens (ERC721), or bundles of assets (ERC1155). Takers, on the other hand, are the ones who fill these orders placed by Makers, consuming the liquidity provided.

Using 0x Protocol involves the creation of orders by Makers, which are then signed and shared. These orders can be for a range of assets including fungible tokens (ERC20), non-fungible tokens (ERC721), and asset bundles (ERC1155). Takers can then fill these orders, with the trade settlements occurring on the blockchain. The protocol's hybrid nature allows orders to be stored off-chain.

0x also features APIs for various functionalities like limit orders, order history, and token registry. These APIs are instrumental in integrating the 0x Protocol into various applications beyond core exchanges, such as digital wallets, games with in-game currencies, and portfolio management platforms.

How to provide liquidity on 0x Protocol?

One of the key features of 0x for liquidity providers is the Pluggable Liquidity Protocol (PLP), which allows for the integration of any on-chain liquidity provider, such as Automated Market Makers (AMMs). This system is flexible; it allows the liquidity provider's code to be closed-source and operates through the LiquidityProviderFeature of 0x. To be a part of this, a liquidity provider must implement certain interface functions, including sellTokenForToken, sellEthForToken, and sellTokenForEth.

0x also offers APIs that facilitate liquidity provision and trading. For example, the Swap API can be used in smart contracts to perform token swaps. This involves setting an allowance for the allowanceTarget to spend the token on the contract's behalf, executing the swap, and handling any protocol fee refunds. Additionally, there's a deposit function where the contract can hold a balance of a particular token to be swapped.

The 0x protocol aggregates liquidity from various sources, including both on-chain sources like other DEXs and AMMs, and off-chain sources like professional market makers. The 0x API helps in aggregating this liquidity to offer the best prices for orders.

Market makers in the 0x protocol can earn fees proportional to the liquidity they provide. This is facilitated by the ZRX token, which is used for governance and staking within the 0x ecosystem. Market makers can operate staking pools, and ZRX holders can participate in these pools. The system is designed to reward those who contribute to the liquidity and efficiency of the market.

The 0x Protocol facilitates liquidity provision through two primary mechanisms: Automated Market Makers (AMM) and Request for Quote (RFQ) systems. Each of these systems operates distinctly within the 0x ecosystem, catering to different needs and functionalities.

What is 0x Protocol’s ZRX token?

The ZRX token is the native cryptocurrency of the 0x Protocol primarily serving as a governance token within its ecosystem. This means that holders of ZRX have voting rights on the 0x Improvement Proposals (ZEIPs).

ZRX token holders can stake their tokens to participate in the network and earn liquidity rewards. These rewards are funded through a protocol fee applied to every trade on the 0x platform. This fee is denominated in ETH and is deposited into a staking contract.

Unlike some Proof-of-Stake systems that offer fixed return percentages, 0x's staking returns are dynamic. As the trading volume on the 0x network increases, so do the protocol fees and staking rewards. Furthermore, since in the 0x ecosystem, nodes or relayers help facilitate trades by hosting off-chain order books, these relayers are compensated in ZRX tokens for their services.

The token has a maximum supply of 1 billion, half of which was sold to investors in the 2017 ICO. 10% of the entire supply of the token was reserved for the founding team, 10% for early backers and advisors, and 15% went to the 0x core development organization, as well as towards an external project development fund. The initial distribution of ZRX tokens occurred through a public sale providing supporters with ZRX tokens in exchange for ETH.

What is 0x Protocol’s governance model?

The governance system of the 0x Protocol is designed to facilitate a decentralized and secure management of its exchange infrastructure.

At the core of this system is the ZeroExGovernor time-locked multi-signature wallet; it holds the authority to perform various administrative roles within the protocol. Its primary responsibilities include managing ownership and authorizations of contracts, as well as administering the system as a whole.

One of the key features of the ZeroExGovernor is its ability to manage ownership. This is achieved through a function that allows the transfer of ownership of any contract for which it is the designated owner. In essence, this function facilitates the transition of control to a new address, ensuring a smooth and secure transfer of authority.

The ZeroExGovernor also plays a crucial role in managing authorizations for all permissioned contracts within the Exchange and Staking systems. Initially, the ZeroExGovernor itself is the only authorized address, but the system is designed to accommodate future changes. 

Moreover, the ZeroExGovernor has the responsibility of administering systems. It holds ownership of all permissioned, trusted contracts under the 0x Protocol. Any function designated as onlyOwner can be executed by the governor, but it is subject to a requirement of 2/3 signatures and a time lock for enhanced security.

ZRX token holders play a pivotal role in the governance of the 0x Protocol. Holding ZRX grants users the right to participate in the governance system. This includes voting on proposals that influence the direction and development of the protocol. 

The governance process in the 0x Protocol involves a decentralized voting mechanism. ZRX holders can vote on various proposals, which may include changes to the protocol, new feature implementations, or other significant decisions. 

More than that, ZRX token holders are not just passive participants but can actively engage in the governance process by proposing changes themselves. 

Is 0x Protocol safe?

0x Protocol has gone through numerous audits by various reputable security firms. There have been no critical finding left unresponded by the 0x Protocol team and there have been no major flaws within its workflow requiring major alterations of the code. 

Moreover, the company hosts a bounty program offering rewards up to $1,000,000 for vulnerabilities reported by community members, depending on their severity. 

In July 2019, 0x Protocol announced the finding of a critical vulnerability within its v2 exchange smart contract that would had allowed a hacker to fill orders with invalid signatures. In less than a day the problematic smart contract was taken down, the issue was patched, and the updated contract was redeployed on the blockchain, allowing 0x to continue its normal operations.

What is the 0x Protocol team?

The 0x Protocol team, also known as 0x Labs, is a diverse and multi-national group responsible for developing and updating the 0x Protocol, 0x API, and Matcha.xyz, a commission-free DEX aggregator trading platform. 

Founded in 2017 by Will Warren, a former engineer, and Amir Bandeali, a former derivatives trader, the 0x Project has focused on building efficient, non-custodial exchange functionality as public infrastructure.

The 0x Labs team is known for its expertise and diverse backgrounds, with members hailing from various top-tier companies like Coinbase, Google, Meta, and Microsoft. The team is fully distributed and remote-first, with members located across continents including Africa, Asia, Australia, Europe, North America, and South America. They have contributed significantly to the Ethereum standards, including the establishment of the NFT token standard (ERC721).

Key figures in the team include CEO Will Warren and CTO Amir Bandeali. Warren, who pursued a Ph.D. in Structural Engineering before founding 0x, has been instrumental in shaping the project's direction. Bandeali, with a background in Finance, worked as a trader before co-founding 0x.

The team has grown to include over 35 core members based in San Francisco and is supported by a global network of contributors. The team's advisors include notable figures like Fred Ehrsam, co-founder of Coinbase, Joey Krug, co-CIO of Pantera Capital, and Linda Xie, co-founder of Scalar Capital.

The 0x Labs team has raised significant funding to fuel its growth and product offerings. This includes a $70M Series B round led by Greylock, with participation from other investors like Pantera, Sound Ventures, A.Capital, Jump Crypto, OpenSea, Coinbase, Brevan Howard, Reid Hoffman, and Jared Leto. 

What is the current 0x Protocol roadmap?

Although there is no updated 2024 0x Protocol roadmap at the time of writing this review, the latest roadmap for 0x Protocol focuses on the final phase of its decentralization. This includes transitioning to a fully on-chain governance mechanism, putting the future of the Protocol in the community's hands. 0x Labs, the primary developer of 0x Protocol, will become one among many stakeholders in the governance process. 

For more details and up-to-date governance proposals along with insights on the discussions behind them, DeFi Teller urges its readers to visit the platform’s forum and dive in the latest updates.

https://0x.org/docs 

https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf 

https://0x.org/content-hub 

https://forum.0xprotocol.org/ 

https://snapshot.org/#/0xgov.eth  

Author:

Frank Stewskid

Frank Stewskid

Last updated: Jan 10, 2024

Latest News

Video Tutorials