---
eip: 8179
label: ERC-8179
title: Blob Space Segments
status: Draft
type: Standards Track
category: ERC
created: 2026-02-08
requires: 4844
official: https://eips.ethereum.org/EIPS/eip-8179
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8179.md
canonical: https://eips.huatuo.xyz/zh/eip-8179/
lang: zh
tldr: 一个只有一个函数、仅通过事件工作的接口，用于声明 EIP-4844 blob 的哪段字段元素范围属于哪个协议，使多个 rollup 和应用可以共享同一个 blob。
tags: [blobs, data-availability, rollups, l2, events]
---

# ERC-8179: Blob Space Segments

> Minimal interface for declaring field element sub-ranges within EIP-4844 blobs

**TL;DR:** 一个只有一个函数、仅通过事件工作的接口，用于声明 EIP-4844 blob 的哪段字段元素范围属于哪个协议，使多个 rollup 和应用可以共享同一个 blob。

## 它解决什么问题？

一个 [EIP-4844](/eip-4844/) blob 包含 4,096 个字段元素（128 KiB），无论是否填满，都要为整个 blob 付费。大型 rollup 通常会填满自己的 blob，但许多小型 rollup 只用到其中很小的一部分，因此大量已付费的数据可用性被浪费了。

试图共享 blob 空间的项目各自发明自己的注册表或事件，所以索引器和工具无法互操作。ERC-8179 只标准化其中一个环节：一个链上声明，说明“这个 blob 的字段元素 `[start, end)` 是我的，内容类型为 X”。blob 的构造、费用分摊和协商都不在范围内。

## 它如何运作

- 合约公开 `declareBlobSegment(blobIndex, startFE, endFE, contentTag)`，在携带该 blob 的**同一笔交易中**调用。
- 它使用 `BLOBHASH` 操作码读取 blob 的版本化哈希。如果该索引处没有 blob，则以 `NoBlobAtIndex` revert；如果 `startFE >= endFE` 或 `endFE > 4096`，则以 `InvalidSegment` revert。
- 它触发 `BlobSegmentDeclared(versionedHash, declarer, startFE, endFE, contentTag)` 并返回该哈希。哈希、声明者和标签都是 indexed，索引器可以按 blob、发送方或协议过滤。
- 核心接口**没有存储写入**：日志是唯一的记录。规范估计每次声明大约 3,500 gas，比存储它便宜大约 7 倍。
- 范围是**半开区间**，所以各段可以严丝合缝地拼接：`[0, 2000) + [2000, 4096)`。使用整个 blob 的协议声明 `[0, 4096)`。
- `contentTag` 是 `bytes32`，惯例是 `keccak256("protocol.version")`，从而无需任何中心化注册表。
- 允许多个甚至相互重叠的声明；重叠检测和去重在链下进行。
- 可选扩展增加了基于存储、支持分页的 **Queryable** 接口，以及原子地声明多个分段的 **Batch** 调用。

## 示例代码

参考风格的实现：

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.24;

contract BlobSpaceSegments {
    event BlobSegmentDeclared(bytes32 indexed versionedHash, address indexed declarer,
        uint16 startFE, uint16 endFE, bytes32 indexed contentTag);
    error InvalidSegment(uint16 startFE, uint16 endFE);
    error NoBlobAtIndex(uint256 blobIndex);

    function declareBlobSegment(uint256 blobIndex, uint16 startFE, uint16 endFE, bytes32 contentTag)
        external returns (bytes32 versionedHash)
    {
        if (startFE >= endFE || endFE > 4096) revert InvalidSegment(startFE, endFE);
        assembly { versionedHash := blobhash(blobIndex) }
        if (versionedHash == bytes32(0)) revert NoBlobAtIndex(blobIndex);
        emit BlobSegmentDeclared(versionedHash, msg.sender, startFE, endFE, contentTag);
    }
}
```

两个协议在同一笔 blob 交易中拼接同一个 blob：

```text
bss.declareBlobSegment(0, 0,    2000, keccak256("optimism.bedrock"))
bss.declareBlobSegment(0, 2000, 4096, keccak256("social-blobs.v4"))
```

## 需要注意

- **状态：Draft。** 接口名称和细节仍可能改变。
- 任何人都可以使用任何 `contentTag`。使用方应按链和标签维护规范声明者合约的允许列表，并把声明视为主张，而不是 blob 内容的证明（EVM 无法读取 blob 内容）。
- 共识节点会在大约 18 天后修剪 blob 数据，但声明事件会永久保留。
- 分段可以作为 KZG 点求值证明的锚点，但链上验证每个字段元素约需 5 万 gas，因此只适用于较小的分段。
- [ERC-7588](/eip-7588/)（blob 交易元数据）与之互补，可以配合使用。


---

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