How to Automatically Pay Your End-Users’ GAS Fees Without HODLing Crypto by@tatum

How to Automatically Pay Your End-Users’ GAS Fees Without HODLing Crypto

What if we told you that you could automatically pay for the ALL of the gas fees for transactions from every user wallet in your app with your paid Tatum plan? Because that’s exactly what our new Gas…
image
Tatum HackerNoon profile picture

Tatum

Build everything from crypto exchanges to NFT marketplaces on 40+ blockchains with no previous blockchain experience.

twitter social icongithub social iconfacebook social iconlinkedin social iconyoutube social icon

Generate wallets from which your app’s users can send any token and pay the gas fees automatically from your Tatum plan.


What if we told you that you could automatically pay for the ALL of the gas fees for transactions from every user wallet in your app with your paid Tatum plan? Because that’s exactly what our new Gas Pump Express feature does.


You simply create user wallets within your app as Gas Pump Express wallets, and when users send any kind of token from them, Tatum handles the gas fees and deducts them from your plan. This means you’ll never have to worry about the logistics of paying for your users’ gas fees again.


So let’s dive into this in a bit more detail.

What are gas fees?

Whenever anyone sends tokens (cryptocurrencies, NFTs, etc.) on the blockchain, they have to pay transaction fees called “gas fees.” If you are building a blockchain app, you’ll want to cover your users’ gas fees to provide the best possible UX. It would be hugely inconvenient for everyday users to have to calculate gas fees and make sure they have enough crypto to pay them for every transaction they want to make.


For example, if a user has 2 CELO in their wallet, and they want to send 2 CELO to purchase something, they’d have to pay a very minuscule gas fee (for example 0.0001 CELO) to send it. And that would mean they could only really send 1.9999 CELO, which would make your app seem annoying and inconvenient to many end-users.

Paying for end-users’ gas fees is difficult.

So you’ll definitely want to pay the 0.0001 CELO gas fee to allow your user to send their 2 CELO. This may seem simple enough: you can just send the 0.0001 CELO to their wallet address, then they can send their transaction.


But wait…it’s actually not so simple. In reality, you have to pay MORE gas fees to send that 0.0001 CELO to the end-user’s wallet. Not to mention, if your app has hundreds, thousands, or millions of end-users, sending gas fees to all of their wallets for every transaction is an absolute nightmare. Tiny amounts of crypto will inevitably get leftover in their accounts, and the extra gas fees you have to pay will add up to significant overhead expenses.

Now, you can automatically pay gas fees without using crypto.

In Tatum, we’ve created a feature called Gas Pump Express that allows you to create wallets for your users and automatically pay for their gas fees from your paid Tatum plan. Here’s how it works:


  1. Sign up for a paid Tatum plan in our dashboard.
  2. Create wallets for your app’s users with 1 simple API endpoint:


curl --location --request POST 'https://api-us-west1.tatum.io/v3/blockchain/sc/custodial/batch' \
--header 'Content-Type: application/json' \
--header 'x-api-key: f510b3f6-c6eb-4458-95cb-1c3d75ad3189_100' \
--data-raw '{
   "owner": "0x80d8bac9a6901698b3749fe336bbd1385c1f98f2"0x80d8bac9a6901698b3749fe336bbd1385c1f98f2"0x80d8bac9a6901698b3749fe336bbd1385c1f98f2"0x80d8bac9a6901698b3749fe336bbd1385c1f98f2",
   "batchCount": 1,
   "chain": "CELO",
   "feesCovered":true
}'


The required fields are:

  • owner — the Tatum blockchain address from which the gas fees will be paid. You can use the address above.

  • batchCount — the number of user wallets you’d like to create.

  • feesCovered — when set to “true”, the gas fees to cover your users’ transactions will automatically be paid for by Tatum, converted to credits, and deducted from your paid Tatum plan.


3. The response to this call will return a transaction ID (txId). You can now use this ID to get the addresses of all the user wallets you have just created.


4. Assign the user addresses to your app’s end-users. They can now send and receive any token (ERC-20, ERC-721, ERC-1155, or equivalent) to their wallets.


5. Whenever any user wants to send any token, or combinations of tokens, from their wallet, the gas fees to pay for the transaction will automatically be deducted as credits from your paid Tatum plan.

And that’s it!

Now, you’ll never have to worry about figuring out how to pay for all of your app’s users’ gas fees again, no matter how much you scale. Gas Pump Express is the simplest and most efficient way of creating custodial blockchain apps, and it’s only available in Tatum.


If you’d like to give it a try for yourself, sign up for a free Tatum API key in the dashboard, and head on over to our documentation to find out more about what you can do with Tatum.

If you need any help or have any questions, please hop onto our Discord and one of our developers will get back to you asap.


Happy coding!


Submit a story with the #blockchain tag on HackerNoon - win 100-500 USDT every month

We’re hiring 👨‍💻


react to story with heart
react to story with light
react to story with boat
react to story with money

Related Stories

L O A D I N G
. . . comments & more!