---
eip: 3014
label: EIP-3014
title: eth_symbol JSON-RPC method
status: Stagnant
type: Standards Track
category: Interface
created: 2020-09-30
official: https://eips.ethereum.org/EIPS/eip-3014
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3014.md
canonical: https://eips.huatuo.xyz/zh/eip-3014/
lang: zh
tldr: "提出了 eth_symbol JSON-RPC 方法，返回原生币的代码（例如 \"ETH\"），这样多链钱包就不需要用户手动输入。"
tags: [json-rpc, wallet, interface, multichain]
---

# EIP-3014: eth_symbol JSON-RPC method

> Add ethsymbol method to the JSON-RPC that returns the symbol of the native coin of the network.

**TL;DR:** 提出了 eth_symbol JSON-RPC 方法，返回原生币的代码（例如 "ETH"），这样多链钱包就不需要用户手动输入。

## 它解决什么问题？

连接多个 EVM 网络的钱包需要了解每个网络的一些基本信息。链 ID 已经可以通过 `eth_chainId`（[EIP-695](/eip-695/)）从节点读取，但原生币的符号却不能。用户只能在社区列表中查找并手动输入。

ERC-3014 提议让节点直接报告它，就像 [ERC-20](/eip-20/) 代币通过 `symbol()` 报告自己的符号一样。

## 它如何运作

一个新的只读方法：

- **方法：** `eth_symbol`
- **参数：** 无
- **返回：** 包含原生币符号的字符串，例如主网上为 `"ETH"`

这就是全部规范。作者曾考虑过 `eth_nativeCurrencySymbol` 这个名字，但最终选了更短的名字，因为 `eth_` 命名空间加上单一返回值已使含义足够清楚。

## 示例代码

规范中的原始 JSON-RPC 请求与响应：

```bash
curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_symbol","params":[],"id":1}' \
  "$RPC_URL"
```

```json
{ "id": 1, "jsonrpc": "2.0", "result": "ETH" }
```

在 ethers v6 中调用，并带有回退处理，因为大多数节点并未实现它：

```ts
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);

async function nativeSymbol(): Promise<string | undefined> {
  try {
    return await provider.send("eth_symbol", []);
  } catch {
    return undefined; // method not supported: use your own chain list
  }
}
```

## 需要注意

- 状态为 **Stagnant**。主流客户端没有实现 `eth_symbol`，因此不要依赖它。
- 该值的可信度取决于节点。恶意的 RPC 可能报告具有误导性的符号，让用户搞错自己正在处理的是哪种币。
- 实际中，钱包通过自己的链列表，或通过 `wallet_addEthereumChain`（[EIP-3085](/eip-3085/)）提供的 `nativeCurrency` 字段来获知原生货币。


---

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