---
eip: 7845
label: ERC-7845
title: Universal Orchestrator RPC
status: Draft
type: Standards Track
category: ERC
created: 2024-11-07
official: https://eips.ethereum.org/EIPS/eip-7845
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7845.md
canonical: https://eips.huatuo.xyz/zh/eip-7845/
lang: zh
tldr: "一种 JSON-RPC 数据模型，钱包可以用它向任意 Orchestrator 请求链抽象的解决方案（\"向 Bob 发送 5 USDC\"），并得到可直接签名的交易，无论资产位于哪些链上。"
tags: [json-rpc, wallets, chain-abstraction, intents]
---

# ERC-7845: Universal Orchestrator RPC

> A universal data model that an Orchestrator can understand to help fulfil a request for a solution from a wallet or any other system.

**TL;DR:** 一种 JSON-RPC 数据模型，钱包可以用它向任意 Orchestrator 请求链抽象的解决方案（"向 Bob 发送 5 USDC"），并得到可直接签名的交易，无论资产位于哪些链上。

## 它解决什么问题？

该提案设想用户对钱包、应用、语音助手或 AI 代理说"把我的代币兑换成 USDC"或"给 Alice 发 10 OP"这样的话，然后由一个 **Orchestrator** 服务算出需要在哪些链上执行哪些交易才能实现。随着这类 orchestrator 增多，每个都会各自发明请求格式，钱包就得为每一个做定制集成。

ERC-7845 标准化了钱包发送的请求和收到的响应的最小结构。它并不标准化 Orchestrator 如何计算答案。

## 它如何运作

请求和响应使用以太坊 JSON-RPC 信封（`id`、`jsonrpc`、`method`）。建议的方法名是 `orchestrator_findSolutions`。

**请求**：`params` 包含一个或多个 **Problem**。一个 Problem 有可选的 `chainId`（默认为 1）和一个 **Action** 列表：

| Action 字段 | 含义 |
| --- | --- |
| `from`（必填） | 该操作所属的钱包地址 |
| `towards`（必填） | 目标：一个 **Asset**（`symbol` / `address` / `chainId`，均可选）或一个 **Destination**（`address` + `chainId`，原样使用） |
| `with` | 钱包将花费的 **Offerings**（`symbol`、`address`、`amount`、`chainId`）；如果为空，Orchestrator 可以考虑所有资产 |
| `type` | 例如 `transfer`、`swap`、`call`；默认为 `transfer` |
| `functionCallName` / `functionCallData` | 可选的合约调用 |
| `deadline` | 希望得到方案的 Unix 时间戳 |

一切默认都是**链抽象**的：如果没有为某个资产指定 `chainId`，Orchestrator 可以使用任意链上的该资产。

**响应**：`result` 是一个 **Solution** 列表，顺序与 Problem 相同。每个 Solution 都有一个用户友好的 `name`、可选的 `description` 和 `deadline`，以及一个交易列表（`to`、`chainId`、`amount`、可选的 `calldata`），供钱包签名并发送。gas 估算留给钱包处理。

## 示例代码

参照规范中"发送 5 USDC"的例子编写的请求和响应（地址为占位符）：

```json
{
  "id": 1234,
  "jsonrpc": "2.0",
  "method": "orchestrator_findSolutions",
  "params": [
    {
      "actions": [
        {
          "from": "0x1111111111111111111111111111111111111111",
          "towards": [{ "address": "0x2222222222222222222222222222222222222222", "chainId": 10 }],
          "with": [{ "symbol": "USDC", "amount": 5 }]
        }
      ]
    }
  ]
}
```

```json
{
  "id": "1234",
  "jsonrpc": "2.0",
  "result": [
    {
      "name": "Send 5 USDC",
      "description": "Send 5 USDC to 0x2222...2222 on OP Mainnet",
      "transactions": [
        { "to": { "address": "0x3333333333333333333333333333333333333333", "chainId": 10 }, "chainId": 10, "amount": 0, "calldata": "0xa9059cbb..." }
      ]
    }
  ]
}
```

## 需要注意

- **状态：Draft。** 文本内部尚未保持一致：接口把 `params` 定义为 Problem 数组、`towards` 定义为数组，而规范自己的示例却把它们包在 `{ "problems": [...] }` 里，`towards` 用单个对象，交易中则使用 `value` 和字符串类型的 `to`，而接口中写的是 `amount` 和 `Destination`。请预期会有变化，并与你的 Orchestrator 就确切的结构达成一致。
- 请把解决方案视为不可信的。Orchestrator 可能返回错误或恶意的交易；钱包应在签名前对其进行模拟，并检查目的地和金额。
- Orchestrator 可能偏向自身的商业利益，有些也可能无人维护；规范把声誉方面的决定留给钱包。
- 关于跨链订单在链上、solver 侧的标准化，请参见 [ERC-7683](/eip-7683/)。


---

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