---
eip: 8131
label: EIP-8131
title: Unified Transaction Content Floor
status: Draft
type: Standards Track
category: Core
created: 2025-01-21
requires: 2028, 4844, 7623, 7702, 7976, 7981
official: https://eips.ethereum.org/EIPS/eip-8131
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8131.md
canonical: https://eips.huatuo.xyz/zh/eip-8131/
lang: zh
tldr: 把交易中每一个用户可控的字节（calldata、访问列表、EIP-7702 授权、blob 哈希）都按下限处统一的 64 gas 定价，用一条简单的规则为最坏情况下的区块大小设定硬上限。
tags: [core, gas, calldata, block-size, pricing]
---

# EIP-8131: Unified Transaction Content Floor

> Flat 64 gas per content byte at the floor, covering all user-controlled transaction fields and capping worst-case block size.

**TL;DR:** 把交易中每一个用户可控的字节（calldata、访问列表、EIP-7702 授权、blob 哈希）都按下限处统一的 64 gas 定价，用一条简单的规则为最坏情况下的区块大小设定硬上限。

## 它解决什么问题？

节点必须能处理攻击者能构造出的最大区块，而不是平均区块。[EIP-7623](/eip-7623/) 引入了 calldata 的**下限**价格，使数据密集型交易无法廉价地填满区块。后续提案把下限提高到每个 calldata 字节统一 64 gas（[EIP-7976](/eip-7976/)），并扩展到访问列表条目（[EIP-7981](/eip-7981/)）。

交易内容中仍有两类在下限处不需要付任何费用：[EIP-7702](/eip-7702/) 授权元组和 [EIP-4844](/eip-4844/) blob 版本化哈希。而且每增加一个新字段，都需要单独的 EIP 和常量。EIP-8131 用一个涵盖所有用户可控内容字节的公式取代了这些零散的规则。

## 它如何运作

交易的下限为：

```
tx_floor = 21000 + 64 * (
      len(calldata)
    + 20  * access_list_addresses
    + 32  * access_list_storage_keys
    + 108 * eip7702_authorizations      # worst-case RLP size of one auth tuple
    + 32  * blob_versioned_hashes
)
```

计费保持 EIP-7623 引入的形式：

```
require tx.gas >= max(intrinsic_gas, tx_floor)
gas_used = max(execution_gas_used, tx_floor)
```

- **固有 gas 不变**（按 [EIP-2028](/eip-2028/)，calldata 的零字节 / 非零字节仍分别为 4/16 gas）。下限只对相对于所做计算而言携带大量数据的交易有影响。
- **只计内容，不计完整 RLP。** 信封和签名字节被视为已由 21,000 的基础成本覆盖，因此内容相同的两笔交易无论类型如何，都支付相同的下限。
- **区块大小上界。** 由于每个内容字节至少花费 64 gas，每个区块中攻击者可控的内容总量至多为 `block_gas_limit / 64`，在 6000 万 gas limit 下约为 0.94 MB，且无需对压缩做任何假设。

## 示例代码

在客户端计算下限，避免 gas 估算偏低（TypeScript）：

```ts
type TxContent = {
  data: Uint8Array;
  accessList?: { address: string; storageKeys: string[] }[];
  authorizationCount?: number;      // EIP-7702 auths
  blobVersionedHashCount?: number;  // EIP-4844 blob hashes
};

export function txFloor(tx: TxContent): bigint {
  const al = tx.accessList ?? [];
  const keys = al.reduce((n, e) => n + e.storageKeys.length, 0);
  const bytes =
    tx.data.length +
    20 * al.length +
    32 * keys +
    108 * (tx.authorizationCount ?? 0) +
    32 * (tx.blobVersionedHashCount ?? 0);
  return 21000n + 64n * BigInt(bytes);
}

// gasLimit must be at least max(intrinsic, txFloor(tx))
txFloor({ data: new Uint8Array(0), authorizationCount: 1 }); // 27912n
```

## 需要注意

- 状态：**Draft**。它需要一次硬分叉，并且是把 EIP-7976 和 EIP-7981 并入，而不是叠加在它们之上。
- 普通的 ETH 转账不受影响（下限 = 21,000）。典型的代币转账远低于下限；一笔 5 万 gas 的交易需要超过约 450 字节的 calldata，下限才会起作用。
- 影响最大的是 EIP-7702（type-4）交易，因为每个授权现在在下限处增加 6,912 gas；以及携带 blob 的交易，它们要为其 32 字节的版本化哈希付费。
- 钱包和 `eth_estimateGas` 必须计算新的下限，否则受下限约束的交易的估算会偏低而被拒绝。
- 规范中包含它自己的主网影响样本（2026 年 5 月）；请把这些数字视为作者的测量结果，而非保证。


---

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