---
eip: 7821
label: ERC-7821
title: Minimal Batch Executor Interface
status: Draft
type: Standards Track
category: ERC
created: 2024-11-21
requires: 7579
official: https://eips.ethereum.org/EIPS/eip-7821
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7821.md
canonical: https://eips.huatuo.xyz/eip-7821/
lang: en
tldr: A minimal execute(mode, data) interface for atomic batched calls, so dapps can send approve + swap in one transaction to any EIP-7702-delegated EOA or smart account.
tags: [account-abstraction, batching, eip-7702, smart-account, wallet]
---

# ERC-7821: Minimal Batch Executor Interface

> A minimal batch executor interface for delegations

**TL;DR:** A minimal execute(mode, data) interface for atomic batched calls, so dapps can send approve + swap in one transaction to any EIP-7702-delegated EOA or smart account.

## What problem does it solve?

With [EIP-7702](/eip-7702/), an ordinary EOA can delegate to smart-contract code and gain features like atomic batching: "approve, then swap" in one transaction instead of two. But each wallet vendor ships its own delegation contract. If every one exposes a different batch function, a dapp has to special-case each wallet, and users might be pushed to switch delegations, which costs gas and carries risk.

ERC-7821 defines the smallest possible common interface for batch execution, borrowing `execute` and `supportsExecutionMode` from [ERC-7579](/eip-7579/) so existing modular smart accounts are compatible too. It complements the wallet-side `wallet_sendCalls` API from [EIP-5792](/eip-5792/).

## How it works

Two functions:

- `execute(bytes32 mode, bytes executionData)` runs a list of `Call { to, value, data }` in order. If any call fails, the whole batch reverts. A `to` of `address(0)` means "this account", which saves calldata.
- `supportsExecutionMode(bytes32 mode)` tells callers which modes are supported.

Modes (first 10 bytes shown):

| Mode | Meaning |
| --- | --- |
| `0x01000000000000000000…` | Single batch, `executionData = abi.encode(calls)` |
| `0x01000000000078210001…` | Single batch, optionally `abi.encode(calls, opData)` |
| `0x01000000000078210002…` | Batch of batches (`abi.encode(bytes[])`), optional |

Authorization: with no `opData`, the implementation should require `msg.sender == address(this)`, which is exactly the case when an EIP-7702 EOA sends a transaction to itself. With `opData`, the implementation should verify a signature carried inside it, which allows relayers or entry points to submit on the user's behalf. The batch-of-batches mode lets one transaction carry batches signed by different signers.

## Sample code

Check support, then send approve + swap from a delegated EOA to itself (ethers v6):

```ts
import { AbiCoder, Contract, Interface } from "ethers";

const MODE_BATCH = "0x0100000000000000000000000000000000000000000000000000000000000000";

const account = new Contract(userAddress, [
  "function supportsExecutionMode(bytes32) view returns (bool)",
  "function execute(bytes32 mode, bytes executionData) payable",
], signer); // signer is the EOA itself

if (!(await account.supportsExecutionMode(MODE_BATCH))) throw new Error("no batch support");

const erc20 = new Interface(["function approve(address,uint256)"]);
const router = new Interface(["function swap(uint256 amountIn, uint256 minOut)"]);

const calls = [
  { to: tokenAddr,  value: 0n, data: erc20.encodeFunctionData("approve", [routerAddr, amountIn]) },
  { to: routerAddr, value: 0n, data: router.encodeFunctionData("swap", [amountIn, minOut]) },
];
const executionData = AbiCoder.defaultAbiCoder().encode(
  ["tuple(address to,uint256 value,bytes data)[]"], [calls],
);
await (await account.execute(MODE_BATCH, executionData)).wait();
```

## Things to know

- **Status: Draft**, and it requires ERC-7579, which is also a Draft.
- The `swap` signature above is a placeholder; use your DEX router's real ABI.
- Access control is the implementer's job. An `execute` that skips the `msg.sender == address(this)` check, or validates `opData` signatures poorly, lets anyone drain the account.
- Batches are atomic only in the "revert on any failure" sense; there is no partial-success mode in this standard.


---

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