---
eip: 6735
label: ERC-6735
title: L2 Aliasing of EVM-based Addresses
status: Review
type: Standards Track
category: ERC
created: 2022-03-20
requires: 55
official: https://eips.ethereum.org/EIPS/eip-6735
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6735.md
canonical: https://eips.huatuo.xyz/zh/eip-6735/
lang: zh
tldr: 提出一种确定性的方式，通过为每条链加上偏移量包裹，把资产或账户地址连同其经过的链路径一并写出，使 L1、L2 和侧链能够相互识别对方的地址。
tags: [l2, interoperability, addresses, bridging, cross-chain]
---

# ERC-6735: L2 Aliasing of EVM-based Addresses

> Identify and translate EVM-based addresses from different Layer 1, Layer 2, or Sidechains

**TL;DR:** 提出一种确定性的方式，通过为每条链加上偏移量包裹，把资产或账户地址连同其经过的链路径一并写出，使 L1、L2 和侧链能够相互识别对方的地址。

## 它解决什么问题？

同一个地址在不同的 EVM 链上可能含义不同，L2 上的跨链桥接代币通常也与 L1 上的原始代币位于不同地址。当消息从一条链传到另一条链时，接收方需要明确知道它指的是*哪条*源链上的*哪个*资产或账户，最好还能知道它经过了哪些链。

Rollup 已经在做类似的事情。来自 L1 合约的消息到达某些 L2 时，发送者地址会加上偏移量 `0x1111000000000000000000000000000000001111`，因此 L1 合约无法冒充 L2 账户。ERC-6735 由 EEA/OASIS L2 工作组撰写，把这一思路推广为适用于任何基于 EVM 的 L1、L2、L3 或侧链的统一"从根到叶"命名规则。

## 它如何运作

思路是为地址所处的每条链，各用一个**偏移别名**把地址包起来：

```text
addressAlias = offsetAlias(chain) relativeAddress offsetAlias(chain)
```

- 链的 `offsetAlias` 由其非零的 `chainId` 构成，并用零填充到固定宽度。
- **以太坊主网**有一个特殊的偏移量 `0x1111…1111`，与现有 L2 已在使用的惯例一致。
- `relativeAddress` 要么是源链上的原始地址，要么是来自另一条链的已加别名的地址，因此别名可以**嵌套**。
- 偏移量必须从根链向外排列。一个资产从链 A 到 B 再到 C，写作：

```text
chainId(C) chainId(B) chainId(A) relativeAddress chainId(A) chainId(B) chainId(C)
```

从内向外读取别名，就能得到资产的源地址以及它经过的链路径。

该规范还为声称遵循它的实现定义了合规等级（Level 1 到 3）。

## 示例代码

一个遵循"包裹并嵌套"结构的 TypeScript 示意辅助函数。规范中确切的填充和编码规则含糊不清（见下文），因此这里的编码只是一种假设，并非规范格式：

```ts
const MAINNET_OFFSET = "1111" + "0".repeat(32) + "1111"; // per the spec, Ethereum L1

// Assumed encoding: chain id written as a 16-digit, zero-padded string
function offsetFor(chainId: bigint): string {
  if (chainId === 0n) throw new Error("chainId must not be zero");
  return chainId.toString().padStart(16, "0");
}

// path = chains the asset passed through after L1, in order
function addressAlias(l1Address: string, path: bigint[]): string {
  let inner = MAINNET_OFFSET + l1Address.slice(2) + MAINNET_OFFSET;
  for (const id of path) {
    const o = offsetFor(id);
    inner = o + inner + o;
  }
  return "0x" + inner;
}

// Token from Ethereum L1, bridged to chain 137
console.log(addressAlias("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", [137n]));
```

## 需要注意

- **状态：Review。** 尚未最终确定。生产环境中的 Rollup 使用各自的别名方案；例如 Arbitrum 和 Optimism 是把 `0x1111…1111` 偏移量算术地加到地址上，这与拼接是两回事。
- 规范自身的示例很难自洽。它说链 ID 是 8 字节，却把它们填充为 16 位十进制数字，而且主网偏移量也不符合通用模式。实现之前请对照当前文本核实。
- 请验证别名内的任何地址。规范建议检查 [ERC-55](/eip-55/) 校验和，检查所谓的 EOA 没有代码，以及检查所谓的代币合约具有预期的代码哈希。
- 关于人类可读的带链标识的地址，请参阅 [ERC-3770](/eip-3770/) 和 [ERC-7930](/eip-7930/)（两者均尚未最终确定）。


---

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