0x 101: Intro to Tx Relay API
Discover how you can simplify crypto and scale user adoption by building frictionless crypto experiences with end-to-end gasless infrastructure.
Simplify DeFi with end-to-end gasless infrastructure. Expecting users to pay gas fees sets up unnecessary roadblocks in your product experience, Tx Relay API simplifies crypto for users by abstracting away the complexities of gas fees.
In this guide, we will take a deeper look at what Tx Relay API is and how you can leverage it to scale user adoption by building frictionless crypto experiences.
What is Tx Relay API?
A major source of friction in Web3 is the need for a user to hold and maintain balances for each chain’s native token in order to pay for transactions. Before Tx Relay, users had to overcome this hurdle by preloading wallets, moving balances across apps, and sending tokens between addresses to initiate transactions. This poses a significant barrier to user adoption.
Tx Relay API leverages the 0x relay network to offer developers and their end-users the ability to perform on-chain transactions without holding a chain’s native token. By abstracting away the complexities related to approvals, allowances, and swaps, you can build more intuitive user interfaces for your applications.
With Tx Relay, you can tap into deep liquidity and power gas-free crypto trading in your application with a single integration.
How does Tx Relay API work?
The first time a user sells a new token from their wallet, they must perform a separate one-time transaction to set an approval for it. This transaction costs gas, so the user needs to hold a small amount of the chain’s native token to pay for it. Users also need to maintain token balances to pay network fees on every subsequent transaction.
With Tx Relay API, users no longer need to hold the network’s native token to trade and won’t ever have to worry about gas fees when transacting on your application. Both approvals and swaps are gasless.
Using the same engine that powers Swap API, Tx Relay API aggregates liquidity from 50+ decentralized exchanges, including Uniswap, Curve, and Sushiwap, and professional market makers across Ethereum and Polygon to find the best available price for a trade. Gas fees are then abstracted away to the backend.
For example, if a user wants to swap USDC for another token on Ethereum, they don’t need to hold both USDC and ETH. Similarly, If a user wants to trade USDC on Polygon, they only need USDC.
How are gas fees abstracted away? Gasless transactions work by “wrapping” the gas costs into the all-in price that the user pays. Via highly-optimized metatransactions, 0x pays the actual native token costs of the transaction and recoups the gas costs by collecting a portion of the tokens involved in the actual swap on-chain. Tx Relay API also offers developers the ability to collect fees on-chain.
Why use Tx Relay API?
Expecting users to pay gas fees sets up unnecessary roadblocks in your product experience. Tx Relay API simplifies crypto for users by abstracting away the complexities of gas fees - enabling you to scale user adoption by building frictionless crypto experiences.
Improve onboarding and conversion: Simplify user flows for your app and allow your users to start trading with any token that’s in their wallet. Users won’t be confronted with upfront requests for approvals and network fees.
Protection for users: Protect users from MEV with our proprietary Slippage Protection feature. When Slippage Protection is enabled, users save an average of 50-80% on slippage. Request for Quote (RFQ) orders from private market makers come with zero slippage and guaranteed MEV protection.
Deep liquidity for the best execution: Unlock aggregated liquidity from 0x private market makers and 100+ exchanges for the most popular pairs on Ethereum and Polygon.
Build for crypto-native users: Tx Relay is composable with Swap API if you want to offer execution optionality. You can design a UX where advanced users can opt in and opt out of gasless swaps.
Best of all, it’s easy-to-use! With Tx Relay API, you can get real-time quotes and execute gasless swaps with just a few lines of code.
Powered by Tx Relay API
Matcha is a decentralized platform for searching and trading tokens, built on 0x’s infrastructure. Developed using Tx Relay API, Matcha Auto is a transaction mode that offers faster trade confirmation, fewer failed trades, and gasless trading, all while keeping the same great prices - providing users with a frictionless trading experience. Matcha has enabled over $56B in traded volume across 1.3M+ trades.
Robinhood Wallet, which is now available to iOS customers globally, leverages Tx Relay API to power gasless swaps - enabling Robinhood to build the first self-custody wallet with no network fees.
Ready to get started?
Tx Relay is currently in a Sandbox phase with select partners. The goal of the Sandbox is for prospective integrators of Tx Relay to experiment with the product and consider how they might use it in their application, and to give feedback to 0x.
If you are interested to try the Tx Relay Sandbox, please contact us.