Paj Digital Labs
All articles
Web3 & Crypto Tech

Gas Fees for Product Teams: Estimating, Sponsoring and Designing Around Cost

Transaction fees shape user experience as much as any screen. How fees are calculated, how to estimate them reliably, and when sponsoring gas or batching actions makes your product easier to use.

Paj Digital Labs 2 min read
Hardware security key beside a connected circuit board
Editorial illustration · Web3 & Crypto Tech

For a user, a blockchain transaction has a price tag that changes minute to minute, is quoted in a currency they may not hold, and is charged even if the action fails. Product teams that ignore fees ship confusing products. Teams that design around them ship ones people actually finish using.

How fees work on EVM chains

The fee is gas used multiplied by the price per unit of gas. The price has two parts:

  • Base fee: set by the network based on demand, and burned
  • Priority fee: a tip to the block producer to include the transaction sooner

Users set a maximum fee they are willing to pay; they are charged the actual base fee plus their tip, up to that maximum.

On rollups there is often an extra component for posting data to the base layer, which can make up a large share of the total.

Estimate properly

ts
const gas = await client.estimateGas({ account, to, data });
const fees = await client.estimateFeesPerGas();
const maxCost = (gas * 120n / 100n) * fees.maxFeePerGas; // 20% gas buffer

Add a buffer to the gas estimate, because state can change between estimation and execution. Show users the expected cost in their local currency, not just in gwei.

Make failure less likely

Failed transactions still cost gas, so preventing failures is a fee feature:

  • Simulate before sending and show a clear error if it would revert
  • Check allowances and balances in the UI before the user clicks
  • Set reasonable slippage and deadlines on swaps
  • Explain the cause if a transaction fails, in plain language

New users often do not hold the native token needed for fees. Requiring them to buy some first is one of the biggest drop-off points in onboarding. Options:

| Approach | How it works | |---|---| | Paymaster (smart accounts) | A sponsor pays gas on the user's behalf | | Relayer | Your backend submits signed user intents | | Pay fees in stablecoins | User pays in a token they hold |

Sponsoring costs money, so limit it: first few transactions per user, specific actions only, daily caps, and abuse checks.

Batch actions

Approve-then-swap is two transactions and two fees. Smart accounts and permit-style signatures can combine steps into one. Every transaction you remove is one fewer chance for the user to give up.

Choose the right network

If your product involves frequent small actions, fees on a congested base layer can make it unusable. Rollups and low-fee chains change what is practical. Choose the network based on the size and frequency of your users' actions, not on habit.

Show fees honestly

Display the estimated fee before confirmation, show the actual fee afterwards, and never hide fees inside a price. Surprises around money damage trust faster than high fees do.

Fees are part of the product. Estimate them well, prevent costly failures, remove unnecessary transactions, and pay for the first ones yourself if it means users actually get started.

Paj Digital Labs

The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.

Related reading