---
eip: 8410
label: ERC-8410
title: Portable Execution Plan Artifact
status: Draft
type: Standards Track
category: ERC
created: 2026-09-04
requires: 155, 712
official: https://eips.ethereum.org/EIPS/eip-8410
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8410.md
canonical: https://eips.huatuo.xyz/zh/eip-8410/
lang: zh
tldr: 一种交易计划的 JSON 格式，加上一个带哈希校验的小型引用，使 AI 智能体可以把准备好的兑换或批量交易从工具交给钱包，而无需让 calldata 经过模型的复制。
tags: [erc, wallet, ai-agents, json, batching]
---

# ERC-8410: Portable Execution Plan Artifact

> Verifiable references for passing execution plans from agent tools to wallets without relaying calldata

**TL;DR:** 一种交易计划的 JSON 格式，加上一个带哈希校验的小型引用，使 AI 智能体可以把准备好的兑换或批量交易从工具交给钱包，而无需让 calldata 经过模型的复制。

## 它解决什么问题？

当 AI 智能体用一个工具准备兑换，再用钱包工具执行时，calldata 通常要经过模型：被当作输入 token 读入，再作为输出 token 写出。对于大型或多步骤交易，这既慢又昂贵，而且每一次复制都有可能让字节被截断或篡改。

ERC-8410 让准备方工具（**生产者**）存储一份**执行计划**，只给智能体一个简短的**工件引用**：一个 URL、精确的字节长度和一个 keccak256 摘要。智能体把该引用传递下去；钱包（**消费者**）自己去获取计划，检查长度和哈希，然后验证、模拟，并请用户授权。智能体对计划的描述绝不算作授权。

## 它如何运作

- **执行计划。** 一份严格的 JSON 文档（拒绝未知成员）：`schema_version: "1"`、`chain_id`（十进制字符串）、与之匹配的 `caip2_chain_id`、一个 `sender`，以及 1–4096 个 `ordered_steps`。每个步骤有从 1 开始的 `step`、仅用于展示的 `kind`（`execution`、`approval`、`allowance_cleanup`、`signature_dependent_execution`、`other`）和一个 `transaction`（`chain_id`、`from`、`to`、`data`、`value`，以及可选的仅供参考的 `gas`）。不支持合约创建。
- **能力。** `required_capabilities` 可以包含 `atomic_batch`：所有步骤放在一笔交易中，整体回滚（例如通过 [EIP-7702](/eip-7702/) 批量执行器）。无法满足所列能力的钱包必须拒绝该计划。没有它时，步骤逐个执行，每一步都等待前一步成功。
- **计划摘要。** 对一个固定的、非字母序的 JSON 投影（schema 版本、链 id、发送者、带有 kind 和交易字段的步骤，不含 gas）计算 keccak256。钱包应在授权时一并显示并记录它。
- **工件引用。** `{ kind: "artifact_reference", artifact_type, url, bytes, integrity: { algorithm: "keccak256", value } }`。允许 `https`、`data:` 以及可选的本地 `file` URL，并有严格的获取规则：默认端口、仅限公网 IP、不允许重定向、无 cookie、有大小上限和超时。
- **也适用于签名。** 同一种引用还可以指向一个签署单个 [EIP-712](/eip-712/) 消息的请求，这是一种独立的、可选的文档类型。
- 计划可通过一张有文档记录的转换表映射到 [EIP-5792](/eip-5792/) 的 `wallet_sendCalls`。

## 示例代码

智能体转交的工件引用（值为占位符）：

```json
{
  "kind": "artifact_reference",
  "artifact_type": "execution_plan",
  "url": "https://producer.example/plans/abc123.json",
  "bytes": 1834,
  "integrity": { "algorithm": "keccak256", "value": "0x<64 hex digits>" }
}
```

钱包端的验证和计划摘要（TypeScript，ethers v6）：

```ts
import { keccak256, toUtf8Bytes } from "ethers";

async function fetchPlan(ref: any) {
  const res = await fetch(ref.url, { redirect: "error", credentials: "omit" });
  const body = new Uint8Array(await res.arrayBuffer());
  if (body.length !== ref.bytes) throw new Error("length mismatch");
  if (keccak256(body) !== ref.integrity.value.toLowerCase()) throw new Error("digest mismatch");
  return JSON.parse(new TextDecoder().decode(body));
}

function planDigest(p: any): string {
  // member order is normative; JSON.stringify keeps insertion order, no whitespace
  const canon = {
    schema_version: p.schema_version,
    chain_id: p.chain_id,
    sender: p.sender.toLowerCase(),
    ordered_steps: p.ordered_steps.map((s: any) => ({
      step: s.step,
      kind: s.kind,
      transaction: {
        chain_id: s.transaction.chain_id,
        from: s.transaction.from.toLowerCase(),
        to: s.transaction.to.toLowerCase(),
        data: s.transaction.data.toLowerCase(),
        value: s.transaction.value,
      },
    })),
  };
  return keccak256(toUtf8Bytes(JSON.stringify(canon)));
}
```

（生产环境的获取器还必须强制执行规范中的公网 IP 检查、大小限制和超时。）

## 需要注意

- 状态：**Draft**。
- 两种摘要都不能验证生产者的身份，也不意味着用户已同意；计划是不受信任的输入，钱包必须自行验证和模拟，最好在签名前再次模拟。
- 计划摘要有意排除了 `gas`、`required_capabilities` 和 `extensions`；摘要相同并不意味着执行要求完全相同。
- 获取调用方提供的 URL 存在服务端请求伪造的风险；规范要求检查解析后的 IP，并禁止重定向。
- 使用 EIP-7702 委托来做批量处理，会让该委托在交易之后继续保留，因此必须考虑其持续存在的权限。


---

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