Book a free call

ERC-865 Token Development: Gasless Transactions Explained

ERC-865 lets users pay token transfer fees in the token itself instead of ether. Here is how the standard works and how to build a token on it.

Hertiv engineering teamReviewed by a senior engineer
7 min read
ERC-865 Token Development: Gasless Transactions Explained
On this page

Short answer

ERC-865 is a token standard that extends ERC-20 with pre-signed transfer functions, so a user can sign a transfer off-chain and a relayer can submit it, taking the fee in tokens. The user never needs ether to move the token. Building one means adding signature recovery, a per-user nonce and fee logic to a standard ERC-20 contract.

What is ERC-865?

ERC-865 is a token standard that lets users pay transaction fees in the token itself instead of in ether. It extends the familiar ERC-20 interface with functions that accept a signed transfer, so someone else can submit the transaction to the blockchain and take the fee in tokens.

The standard was proposed as Ethereum Improvement Proposal 865 in 2018. It was written for tokens whose users do not hold ether, such as the users of a game or a payment app, who should not need to buy ether before they can move their tokens.

An ERC-865 token is still an ERC-20 token underneath: it has a total supply, balances, allowances and the same transfer and approve functions. The new part is a set of pre-signed functions that move tokens on behalf of a user who signed the instruction off-chain. For the basics of the older standard, see what ERC-20 tokens are.

How does an ERC-865 transfer work?

An ERC-865 transfer works through a signed message and a relayer. The user signs a transfer instruction with their private key, without sending anything to the blockchain. A relayer, any willing third party, takes that signed message, submits it to the token contract, and pays the gas in ether.

The contract checks the signature, confirms the user has enough tokens, and then moves two amounts: the transfer amount to the recipient, and a fee in tokens to the relayer. The relayer is paid in the token, so the user never needs ether at all.

This pattern is called a meta transaction, because the real transaction is submitted by someone other than the person who authorised it. The same idea later appeared in account abstraction, which generalises it beyond a single token standard. The contract must check a nonce for each signed message, so the same signature cannot be replayed twice.

ERC-865 vs ERC-20: what changes?

ERC-865 changes only the fee and submission side of a token. Balances, allowances and the core transfer logic stay the same, which is why an ERC-865 token works with wallets and exchanges that already support ERC-20.

FeatureERC-20ERC-865
Who pays gasSender, in etherRelayer, in ether
Who submits the transactionThe senderThe relayer
Signature neededNoYes, ECDSA signature
New functionsNonetransferPreSigned and friends
User needs etherYesNo

The practical difference is onboarding. An ERC-20 token forces every new user to buy ether first, which is a barrier for people who only want the token. An ERC-865 token removes that step: the user signs, a relayer submits, and the fee comes out of the tokens being moved.

How do you build an ERC-865 token?

You build an ERC-865 token by extending a standard ERC-20 contract with signed-transfer functions and replay protection. The work is mostly in the signature and fee logic, not in the token itself.

  1. Start from a tested ERC-20 base. Use a reviewed ERC-20 implementation as the starting point; do not write the balance and allowance logic from scratch.
  2. Add the pre-signed functions. Add transferPreSigned, approvePreSigned, increaseApprovalPreSigned, decreaseApprovalPreSigned and transferFromPreSigned, each taking the signed parameters plus the fee.
  3. Add signature recovery. Recover the signer from the signature inside the contract and compare it with the claimed sender.
  4. Add a nonce per user. Store a nonce for each address and require it in every signed message, so a signature cannot be replayed.
  5. Set the fee logic. Decide whether the fee is fixed or a share of the transfer, and make it visible to users before they sign.
  6. Test the full flow. Sign a transfer off-chain, submit it through a relayer account, and confirm both the recipient and the relayer are paid.

Deploy first to a test network and run the whole flow end to end before the main network. A token whose signed transfers fail is worse than a plain ERC-20 token, because users cannot fall back to paying gas in ether. For a step-by-step ERC-20 build to start from, see how to create an ERC-20 token.

What does the gas payment flow look like?

The gas payment flow has four parties: the user, the recipient, the relayer and the token contract. The user signs a message that says how many tokens to send, to whom, and what fee the relayer earns. The relayer submits the message and pays the network gas in ether.

The contract verifies the signature and the nonce, then moves the transfer amount to the recipient and the fee to the relayer. If any check fails, the whole call reverts and nothing moves. The relayer only earns the fee when the transfer succeeds, which is what keeps relayers honest.

Fees need care. If the fee is too low, no relayer will pick up the message and the transfer stalls. If it is too high, users overpay on every transfer. Some projects run their own relayer and set the fee to cover gas with a small margin, while others let an open market of relayers compete. Gas costs themselves are covered in what gas fees are.

Example (hypothetical): a game token with no ether needed

Example (hypothetical): a game issues a token that players earn and spend inside the game. A player holds 500 tokens and no ether, and wants to send 100 tokens to a friend. The game builds the signed message for the transfer, with a fee of 2 tokens for the relayer.

The game's relayer submits the message and pays 0.002 ether in gas. The contract moves 100 tokens to the friend and 2 tokens to the relayer, so the player ends with 398 tokens. The player never touched ether, and the relayer earned 2 tokens for a service that cost it a small amount of gas.

If 1,000 players make a similar transfer in a week, the relayer earns 2,000 tokens and pays roughly 2 ether in gas. Whether that trade works depends on the token's value against ether, which is why the fee must be set with the market in mind. The example shows the model works only when the fee covers the gas it replaces.

What are the risks and limits?

The risks of ERC-865 sit in the signature logic and the relayer market. A bug in signature recovery or nonce handling can let an attacker replay a signed message or forge one, which is why the standard never gained the adoption its authors hoped for.

Three limits matter most:

  • Small ecosystem. Few wallets, exchanges and tools recognise the pre-signed functions, so users need special software to sign and submit.
  • Relayer dependence. If no relayer will take the fee, transfers stall, and a project that promised gasless transfers must run its own relayer.
  • Audit cost. The extra functions add attack surface, and an audit of the signature and fee logic is needed before real value moves through the contract.

Newer approaches have largely taken over the same job. Account abstraction, described in what ERC-4337 is, lets any account pay gas in tokens without a token-specific standard. ERC-865 is still a sound design for a token that needs the feature on its own, but it is no longer the first choice for most teams.

What are the common mistakes?

The most common mistakes with ERC-865 are weak replay protection, unclear fees, and building on the standard without checking whether the ecosystem supports it.

  • No nonce. A signature without a nonce can be submitted twice, moving the tokens twice.
  • Fee in the wrong place. The fee must be taken from the sender's balance, not minted, or the supply grows with every transfer.
  • Hidden fees. Users who do not see the fee before signing will not trust the token.
  • No relayer plan. A token with no relayer is a token nobody can move.
  • Skipping the audit. Signature code is the most attacked part of a contract, and it needs review before launch.

Test the signed flow on a test network with real signatures before launch. The plain transfer path may work perfectly while the signed path fails, and users will find the failure first.

Key takeaways

  • ERC-865 adds pre-signed transfer functions to a standard ERC-20 token
  • Users sign off-chain and a relayer submits, taking the fee in tokens
  • The user needs no ether, which removes the first onboarding barrier
  • A per-user nonce stops a signature from being replayed
  • Few tools support the standard, so most teams now use account abstraction instead

Frequently asked questions

What is the difference between ERC-865 and ERC-20?

ERC-865 is an ERC-20 token with extra pre-signed functions. The core token logic is the same, but ERC-865 lets a relayer submit a transfer the user signed off-chain, and the relayer is paid in tokens instead of the user paying gas in ether.

Do users need ether to use an ERC-865 token?

No. The user signs a transfer message off-chain and a relayer submits it, paying the network gas in ether. The relayer is paid a fee in the token itself, so the user only needs the token.

What is a relayer in ERC-865?

A relayer is any party that takes a user's signed transfer message, submits it to the token contract, and pays the gas. The contract pays the relayer a fee in tokens when the transfer succeeds. A project can run its own relayer or let others compete for the fee.

Is ERC-865 widely used?

No, adoption stayed small. Few wallets and exchanges support the pre-signed functions, and account abstraction now solves the same problem more generally. ERC-865 still works for a token that needs gasless transfers without depending on account abstraction.

How do you stop a signed transfer from being replayed?

The contract stores a nonce for each user and requires it in every signed message. After a message is used, the nonce changes, so the same signature cannot be submitted a second time. A deadline in the message adds a second layer of protection.

Does ERC-865 change how the token works with exchanges?

No, for the core functions. An ERC-865 token keeps the standard ERC-20 interface, so exchanges and wallets that support ERC-20 can hold and move it. Only the pre-signed functions need special support, which is why most tools ignore them.

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

Planning a token with gasless transfers? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Smart Contract 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