0x 101: Intro to Gasless API

Discover how you can simplify crypto and scale user adoption by building frictionless crypto experiences with end-to-end gasless infrastructure.

Published on
June 13, 2023
Learn & Build
0x 101: Intro to Gasless API

Simplify DeFi with end-to-end gasless infrastructure. Expecting users to pay gas fees sets up unnecessary roadblocks in your product experience, Gasless API simplifies crypto for users by abstracting away the complexities of gas fees.

In this guide, we will take a deeper look at what Gasless API is and how you can leverage it to scale user adoption by building frictionless crypto experiences.

What is Gasless 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 Gasless, 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.

Gasless 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 Gasless, you can tap into deep liquidity and power gas-free crypto trading in your application with a single integration.

How does Gasless 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 Gasless 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, Gasless 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. Gasless API also offers developers the ability to collect fees on-chain.

Why use Gasless API?

Expecting users to pay gas fees sets up unnecessary roadblocks in your product experience. Gasless 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: Gasless 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 Gasless API, you can get real-time quotes and execute gasless swaps with just a few lines of code.

Powered by Gasless API

Matcha is a decentralized platform for searching and trading tokens, built on 0x’s infrastructure. Developed using Gasless 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 Gasless API to power gasless swaps - enabling Robinhood to build the first self-custody wallet with no network fees.

Ready to get started?

Gasless API is available now on Ethereum, Base, Optimism, Arbitrum,and Polygon.

Check out our quick guide to get started today. New to 0x? Sign-up for a free account on the 0x Dashboard.