---
eip: 3709
label: EIP-3709
title: Remove Support for Type 1 Transactions
status: Stagnant
type: Standards Track
category: Interface
created: 2021-08-07
requires: 1559
official: https://eips.ethereum.org/EIPS/eip-3709
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3709.md
canonical: https://eips.huatuo.xyz/zh/eip-3709/
lang: zh
tldr: 提议钱包和 provider 不再生成 type-1（访问列表）交易，而是悄悄把它们升级为 EIP-1559 的 type-2 交易，后者携带相同的访问列表，并拥有更好的费用字段。
tags: [transactions, wallets, access-list, gas, interface]
---

# EIP-3709: Remove Support for Type 1 Transactions

> Deprecates usage of EIP-2718 TransactionType 1 in wallets and providers, upgrading all type 1 transactions to a type 2 transaction.

**TL;DR:** 提议钱包和 provider 不再生成 type-1（访问列表）交易，而是悄悄把它们升级为 EIP-1559 的 type-2 交易，后者携带相同的访问列表，并拥有更好的费用字段。

## 它解决什么问题？

[EIP-2718](/eip-2718/) 引入了类型化交易。第一种类型，即 [EIP-2930](/eip-2930/) 的 `0x01`，本质上是附带了 `access_list` 的传统交易：它仍然使用单一的 `gasPrice`。不久之后，[EIP-1559](/eip-1559/) 增加了类型 `0x02`，它*同样*携带 `access_list`，但用 `maxFeePerGas` 和 `maxPriorityFeePerGas` 取代了 `gasPrice`。

既然有了 type 2，type 1 就没有任何 type 2 所没有的东西：发送 type-1 交易的人得到了访问列表，却错过了 base fee/小费模型以及由此带来的更平滑的费用估算。同时保留两者，只会让钱包和库里多出更多代码路径，却没有任何好处。

## 它如何运作

这是一项 *Interface* 提案：它不改变任何共识内容。节点仍然会接受 type-1 交易。它转而要求钱包和 provider 在用户或 dapp 提交 type-1 交易请求签名时，先把它改写为 type 2 再签名：

| 字段 | 变化 |
| --- | --- |
| `type` | `0x1` 变为 `0x2` |
| `access_list` | 原样保留 |
| `gas_price` | 移除，由 `max_fee_per_gas` 和 `max_priority_fee_per_gas` 取代（按 EIP-1559 的描述设置） |

得到的负载是正常的 type-2 形态：`rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, y_parity, r, s])`。

## 示例代码

这样的升级在钱包层可能的样子（ethers v6）。费用数值如何选取由钱包决定；这里取自 provider 的费用数据：

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

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

async function upgradeType1(tx: TransactionRequest): Promise<TransactionRequest> {
  if (tx.type !== 1) return tx;
  const fees = await provider.getFeeData();
  const { gasPrice, ...rest } = tx;          // drop the legacy field
  return {
    ...rest,
    type: 2,
    accessList: tx.accessList,               // access list is preserved
    maxFeePerGas: fees.maxFeePerGas,
    maxPriorityFeePerGas: fees.maxPriorityFeePerGas,
  };
}
```

## 需要注意

- 状态：**Stagnant**。它从未定稿，type-1 交易在以太坊上仍然有效。
- 这是给钱包和 RPC provider 的建议，而不是协议规则；不涉及硬分叉。
- 实际上大多数钱包已经默认使用 type-2 交易，所以这项提案的目标在很大程度上已通过惯例实现。
- 改写用户要求签名的交易，会改变他们支付的内容和方式。这样做的钱包应当在签名之前展示新的费用字段。


---

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