---
eip: 2228
label: EIP-2228
title: Canonicalize the name of network ID 1 and chain ID 1
status: Final
type: Informational
created: 2019-08-04
official: https://eips.ethereum.org/EIPS/eip-2228
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2228.md
canonical: https://eips.huatuo.xyz/zh/eip-2228/
lang: zh
tldr: 规定网络 ID 为 1、链 ID 为 1 的以太坊网络的正式名称为「Ethereum Mainnet」，或简称「Mainnet」，并始终作为专有名词书写。
tags: [naming, mainnet, chain-id, informational, style]
---

# EIP-2228: Canonicalize the name of network ID 1 and chain ID 1

> The Ethereum network with network ID 1 and chain ID 1 is named Ethereum Mainnet.

**TL;DR:** 规定网络 ID 为 1、链 ID 为 1 的以太坊网络的正式名称为「Ethereum Mainnet」，或简称「Mainnet」，并始终作为专有名词书写。

## 它解决什么问题？

以太坊的生产网络有很多种写法：「main net」「mainnet」「Main net」「Mainnet」「Main Ethereum Network」。不同的 EIP、客户端和钱包使用不同拼写，有时甚至同一位作者的文档里也不统一。这显得不专业，而且「主网络」可能有歧义：在介绍另一条链的页面上，它可能指的是*那条链*的主网络。

EIP-2228 选定了一个规范名称。

## 它如何运作

- **网络 ID 为 1 且链 ID 为 1**（链 ID 来自 [EIP-155](/eip-155/)）的网络命名为 **Ethereum Mainnet**，当上下文明显指以太坊时可写作 **Mainnet**。
- 它是**专有名词**：首字母 "M" 大写，一个单词。
- 不得（SHALL NOT）使用其他拼写和大小写形式。
- 在全大写或全小写的 UI 中，源码里写 "Mainnet"，再通过样式应用大小写，这样语义上的名称依然正确。

规范中的示例：

| 文本 | 是否可以 | 原因 |
| --- | --- | --- |
| "The contract was deployed to Ethereum Mainnet." | 可以 | 指明了网络 |
| "This Dapp was deployed to Mainnet." | 可以 | 上下文明显是以太坊 |
| "The main network on Ethereum is Mainnet." | 可以 | "main" 是描述性词语，"Mainnet" 才是名称 |
| "Deploy your contract to the Ethereum main network." | 不可以 | 依赖上下文，不够精确 |
| "Connect to mainnet." | 不可以 | 小写的 "mainnet" 不是一个词 |

规范记录了此前使用「Main Ethereum Network」的 MetaMask 已更新以遵循该规定，并列出了措辞不一致的旧 EIP。

## 示例代码

在 UI 中标注网络，数据中保留规范名称，大小写通过 CSS 应用（仅作演示）：

```ts
const NETWORK_NAMES: Record<number, string> = {
  1: "Ethereum Mainnet",
};

function networkLabel(chainId: bigint | number): string {
  return NETWORK_NAMES[Number(chainId)] ?? `Chain ${chainId}`;
}

// const { chainId } = await provider.getNetwork();
// header.textContent = networkLabel(chainId);
```

```html
<!-- Shows "SWITCH TO MAINNET" but the text is still the proper noun -->
<button style="text-transform: uppercase">Switch to Mainnet</button>
```

## 需要注意

- 状态为 **Final**，属于 Informational：它规范的是用词，而非协议行为。
- 库在内部仍可使用小写标识符（例如网络键 `"mainnet"`）；该 EIP 针对的是面向人的名称。
- 「Ethereum」是 Ethereum Foundation 的商标。规范指向基金会的条款以了解使用义务。
- 它没有在 "Dapp"、"dapp" 和 "dApp" 之间做出选择。


---

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