Book a free call

How Do Blockchain Relayers Manage Gas Fees?

A relayer submits a transaction and pays the gas fee for the user, who signs a message off-chain instead of sending a transaction.

Hertiv engineering teamReviewed by a senior engineer
7 min read
How Do Blockchain Relayers Manage Gas Fees?
On this page

Short answer

A blockchain relayer manages gas fees by submitting a transaction on a user's behalf and paying the gas itself. The user signs a message off-chain describing what they want to do, the relayer wraps that signed message into a real transaction, pays the gas in the chain's native token, and is then reimbursed by the app, the user, or a sponsor, depending on the setup.

What is a blockchain relayer?

A blockchain relayer is a service that submits a transaction to a chain and pays the gas fee for it, so the user who authorised the action does not need to hold the chain's native token. The relayer separates two jobs that are normally done by one person: signing, which proves the user agrees, and submitting, which costs gas.

The pattern exists because new users usually arrive with no gas token. Asking someone to buy a native token before they can try an app is a common reason people give up at the first screen. A relayer removes that step, so a user can claim, vote, mint or transfer from the moment they arrive.

Relayers are infrastructure, not wallets. They do not hold user funds and they cannot change what the user signed. Their job is delivery: take a signed instruction, check it, submit it, and report the result. For the wider context, see what gas fees are.

How does a relayer pay gas for someone else?

A relayer pays gas for someone else through a meta-transaction. The user signs a structured message off-chain, using the same wallet they already have, and sends that message to the relayer instead of sending a transaction to the chain. Signing a message costs nothing.

The relayer checks the signature and the message, then wraps it into a real transaction and submits it to the chain, paying the gas from its own funded wallet. The target contract receives the call through a trusted forwarder, which verifies the signature and tells the contract who the real sender was.

StepWho actsWhat it costs
1. Sign the messageUser, off-chainNothing
2. Send it to the relayerUser, over the internetNothing
3. Submit the transactionRelayer, on-chainGas, paid by the relayer
4. Verify and run the callTrusted forwarder contractPart of the same gas

The contract must be built to accept this pattern. It reads the original sender from the data the forwarder appends, rather than trusting the relayer's address. That detail is what stops a relayer from impersonating a user.

What is a trusted forwarder, and why does it matter?

A trusted forwarder is a smart contract that receives relayed transactions, checks the signature and the nonce, and then calls the target contract with the original user's address attached. It is defined by EIP-2771, the standard for meta-transactions, and it is the trust boundary of the whole system.

The forwarder matters because it is the only part that decides whether a relayed call is genuine. It checks that the signature matches the user, that the nonce has not been used before, and that the request has not expired. If any check fails, the call is rejected before the target contract runs.

Each target contract decides which forwarder it trusts. A contract should trust only a forwarder that has been audited and that it names explicitly. If a contract accepted calls from any forwarder, an attacker could attach a fake sender address and act as someone else.

Relayers, paymasters and bundlers compared

Relayers, paymasters and bundlers all help users avoid paying gas directly, but they work at different points in the flow. A relayer submits a signed message as a normal transaction, while a paymaster sponsors gas inside the account abstraction flow defined by ERC-4337.

PartWhat it doesStandard
RelayerSubmits a signed message and pays gasEIP-2771 meta-transactions
Trusted forwarderVerifies the signature and forwards the callEIP-2771
PaymasterSponsors gas for a smart contract walletERC-4337
BundlerGroups wallet operations and submits themERC-4337

A relayer fits apps that use ordinary wallets and want gasless actions without changing the wallet. A paymaster fits apps built on smart contract wallets, where gas rules can be programmed per user. The two approaches can be combined, and many apps use a relayer for simple actions and a paymaster for wallet-level sponsorship. The account abstraction explainer covers the wallet side in detail.

How do relayers get paid?

Relayers get paid in one of four ways, and the choice decides who bears the cost of free transactions. The most common model is sponsorship: the app pays the relayer's gas bill from its own budget, treating it as an onboarding cost.

A second model is reimbursement in tokens. The user pays the app in a stablecoin or in the app's own token, and the app converts that payment into gas for the relayer. A third model is a subscription, where the app pays a monthly fee for a set number of relayed transactions.

The fourth model is a fee taken from the action itself. For a marketplace, a small share of each sale can cover the gas, so the cost scales with real use instead of sitting as a fixed bill. Whichever model is used, the relayer's wallet must stay funded, because a relayer with no gas cannot submit anything.

How to add a relayer to a dApp in 6 steps

You add a relayer to a dApp by making the contracts accept forwarded calls, choosing a relayer service, and wiring the frontend to sign messages instead of sending transactions.

  1. Make contracts forwarder-aware. Use the standard recipient pattern so the contract reads the original sender from the forwarded call.
  2. Deploy a trusted forwarder. Use an audited forwarder contract, or a known shared one, and record its address in the recipient contracts.
  3. Choose a relayer service. Options include Gelato Relay, Biconomy, OpenZeppelin Defender and thirdweb Engine, or a relayer you run yourself.
  4. Set the funding and limits. Fund the relayer wallet, set a spending cap per user and per day, and restrict which contracts it may call.
  5. Change the frontend. Replace direct transaction sends with signed messages, and show the user the status while the relayer submits.
  6. Test on a testnet first. Rehearse expired requests, bad signatures and a funded-out relayer wallet before going live.

Keep the relayer's permissions narrow. It should only be allowed to call the contracts it needs, and only through the forwarder. A relayer with open permissions is a single point of failure for the whole app.

If your app already uses smart contract wallets, compare the relayer route with the paymaster route in the account abstraction implementation guide before you commit.

Example (hypothetical): a game mints items without charging players gas

Example (hypothetical): a small game lets players mint a starter item when they join. Without a relayer, each player would need the chain's native token first, and most new players would leave before minting anything.

The team adds a relayer. A player signs a mint message off-chain, the relayer submits it and pays the gas. Each mint costs 0.0003 of the native token in gas, so 1,000 mints cost 1,000 times 0.0003, which is 0.3 of the token in total.

The team funds the relayer wallet with 0.5 of the token. After 1,000 mints, 0.2 of the token remains, which covers about 666 more mints, because 0.2 divided by 0.0003 is about 666. The team sets a daily cap of 200 mints per player and an alert when the wallet balance falls below 0.1 of the token.

Players never see a gas prompt, and the team can predict the cost of onboarding exactly: 0.0003 of the token per player, plus the relayer service fee. If the game grows, the team raises the budget rather than changing the flow.

What are the common mistakes?

The most common relayer mistakes are trusting the wrong forwarder, leaving the relayer wallet open, and forgetting that the relayer can be censored or go offline.

  • Trusting any forwarder. A recipient contract must name its forwarder explicitly, or an attacker can forge the sender address.
  • No replay protection. Every signed message needs a nonce and a deadline, or the same message can be submitted twice.
  • Unlimited relayer permissions. A relayer that can call any contract is a bigger risk than the gas it saves, so restrict it to the contracts it needs.
  • No funding alerts. A relayer wallet that runs dry stops every gasless action at once, so alert on low balance.
  • One relayer, no fallback. If the single relayer goes down, users cannot transact, so keep a second path or a direct-send option.
  • Ignoring the relayer's power. A relayer chooses when, or whether, to submit a message, so it can delay or censor actions even though it cannot change them.

Key takeaways

  • A relayer submits a transaction and pays the gas so the user does not need the chain's native token
  • Meta-transactions (EIP-2771) let users sign a free off-chain message that a relayer turns into a transaction
  • The trusted forwarder verifies the signature and nonce, and is the trust boundary of the system
  • Relayers suit ordinary wallets; paymasters suit smart contract wallets under ERC-4337
  • Cap the relayer's spending and permissions, fund its wallet, and keep a fallback path

Frequently asked questions

What is a blockchain relayer?

A blockchain relayer is a service that takes a user's signed message, wraps it into a real transaction and submits it to the chain, paying the gas fee itself. The user signs off-chain for free, so they can use an app without holding the chain's native token.

Is a relayer the same as a paymaster?

No. A relayer works with meta-transactions under EIP-2771 and submits signed messages as normal transactions. A paymaster works inside ERC-4337 account abstraction and sponsors gas for smart contract wallet operations. Both remove the gas burden from the user.

Can a relayer steal my funds?

A relayer cannot change what you signed, because the trusted forwarder checks the signature before the call runs. It can delay or refuse to submit your message, which is why apps should limit what a relayer can call and keep a fallback.

What is EIP-2771?

EIP-2771 is the standard for meta-transactions. It defines how a trusted forwarder contract verifies a signed request and forwards it to the target contract, attaching the original sender's address so the contract knows who really authorised the action.

How much does a relayer cost an app?

The cost is the gas for each relayed transaction plus any service fee. Apps usually sponsor it from their own budget, recover it from the user in tokens, or take a small share of each action. A relayer wallet must stay funded or relaying stops.

Do I still need gas if an app uses a relayer?

No, not for the actions the relayer covers. You sign messages off-chain for free and the relayer pays the gas. You still need gas for actions outside the app, such as sending tokens from your own wallet directly.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a dApp users can try without gas? Talk to Hertiv.

A senior engineer replies within one business day. Or see our dApp Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call