---
eip: 3005
label: ERC-3005
title: Batched meta transactions
status: Stagnant
type: Standards Track
category: ERC
created: 2020-09-25
official: https://eips.ethereum.org/EIPS/eip-3005
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3005.md
canonical: https://eips.huatuo.xyz/eip-3005/
lang: en
tldr: An ERC-20 extension, processMetaBatch(), that lets one relayer submit signed gasless transfers from many different senders in a single transaction, paid for with a token fee.
tags: [erc20, meta-transactions, gasless, relayer, batching]
---

# ERC-3005: Batched meta transactions

> Defines an extension function for ERC-20 (and other fungible token standards), which allows receiving and processing a batch of meta transactions.

**TL;DR:** An ERC-20 extension, processMetaBatch(), that lets one relayer submit signed gasless transfers from many different senders in a single transaction, paid for with a token fee.

## What problem does it solve?

Many users hold [ERC-20](/eip-20/) tokens but no ETH, so they cannot pay gas to move them. Meta transactions fix this: the user signs a message and a **relayer** submits it on-chain, getting reimbursed in tokens.

Existing relayers sent one meta transaction per on-chain transaction (or batched only for a single sender). Each one pays the 21,000 base cost and contract overhead, which makes small transfers uneconomical. ERC-3005 lets a relayer bundle meta transactions from **many senders** into one call, sharing that overhead.

## How it works

The token contract adds `processMetaBatch()` and `nonceOf()`. For each entry the relayer passes parallel arrays of sender, recipient, amount, relayer fee, expiry block and signature `(v, r, s)`. Entry *i* in every array belongs to the same meta transaction.

Each sender signs a hash over:

```
sender, recipient, amount, relayerFee, nonce, expiry, tokenContract, relayer
```

The nonce, token address and relayer address are not passed in; the contract derives them (`nonceOf(sender) + 1`, `address(this)`, `msg.sender`). Including them in the signature blocks:

- **replay** on the same token (nonce must be exactly previous + 1),
- **replay** on another token (`address(this)`),
- **front-running** by another relayer (`msg.sender`).

Validation per entry: no zero addresses, current block ≤ expiry, balance ≥ amount + fee, valid signature. An entry that fails is **skipped, not reverted**, so one bad entry does not sink the batch. Successful entries bump the sender's nonce, move `amount` to the recipient and accumulate the fee; the relayer is credited the total fee once at the end to save storage writes.

## Sample code

Signing a meta transaction off-chain, matching the reference implementation (`abi.encode` + `eth_sign` prefix), with ethers v6:

```ts
import { AbiCoder, keccak256, getBytes, Signature, Wallet } from "ethers";

const coder = AbiCoder.defaultAbiCoder();
const nonce = (await token.nonceOf(user.address)) + 1n;

const msgHash = keccak256(coder.encode(
  ["address", "address", "uint256", "uint256", "uint256", "uint256", "address", "address"],
  [user.address, recipient, amount, relayerFee, nonce, expiryBlock, tokenAddress, relayerAddress],
));
const sig = Signature.from(await user.signMessage(getBytes(msgHash))); // adds "\x19Ethereum Signed Message:\n32"

// relayer side: collect many such entries, then
await token.connect(relayer).processMetaBatch(
  senders, recipients, amounts, fees, expiryBlocks,
  sigs.map(s => s.v), sigs.map(s => s.r), sigs.map(s => s.s),
);
```

Interface added to the token:

```solidity
function processMetaBatch(
    address[] memory senders, address[] memory recipients,
    uint256[] memory amounts, uint256[] memory relayerFees,
    uint256[] memory blocks,
    uint8[] memory sigV, bytes32[] memory sigR, bytes32[] memory sigS
) public returns (bool);

function nonceOf(address account) public view returns (uint256);
```

## Things to know

- **Status: Stagnant.** It never reached Final; treat it as a design reference.
- The function must be built into the token itself, so it cannot be added to tokens that are already deployed.
- Strict sequential nonces mean a user sending the same nonce to several relayers wastes all but one relayer's effort; the spec suggests relayers share pending entries.
- A relayer could trick users into a far-future expiry; the spec discusses capping it (on-chain or at the relayer) but leaves it out of the reference code.
- Related gasless patterns: [ERC-2612](/eip-2612/) `permit` (signed approvals), [ERC-3009](/eip-3009/) (signed transfers) and [ERC-2771](/eip-2771/) (trusted forwarders).


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-3005
