---
eip: 8329
label: ERC-8329
title: Subject-Linked Impact Snapshot Log
status: Last Call
type: Standards Track
category: ERC
created: 2026-07-05
requires: 165
official: https://eips.ethereum.org/EIPS/eip-8329
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8329.md
canonical: https://eips.huatuo.xyz/zh/eip-8329/
lang: zh
tldr: 一个标准的仅追加日志，用于按对象和时段报告排放、能源或就业等影响数据，带有已承诺的方法论、线性的更正链，以及可选的背书或争议。
tags: [impact, reporting, attestations, sustainability, data]
---

# ERC-8329: Subject-Linked Impact Snapshot Log

> Defines append-only subject-linked impact snapshots with correction provenance, methodology versioning, and attestations

**TL;DR:** 一个标准的仅追加日志，用于按对象和时段报告排放、能源或就业等影响数据，带有已承诺的方法论、线性的更正链，以及可选的背书或争议。

## 它解决什么问题？

影响数据（排放或抵消的碳、产生的能源、处理的水、创造的就业、保护的公顷数……）通常以 PDF 或一次性的数据格式发布。在链上，没有一个通用接口，把这样的数值与它所涉及的*人或事物*、所覆盖的*时段*、所用的*单位*，以及*如何*计算联系起来。

单个可变的值同样不够：覆盖它会抹去先前声称的内容，也无法区分新的报告时段与对旧时段的重述。ERC-8329 定义了一个仅追加的快照日志，保留包括更正在内的完整历史。

## 它如何运作

**快照。** `recordSnapshot` 为 `(subjectId, indicatorId, [periodStart, periodEnd))` 存储一个值：

- `value` 是带有显式 `decimals` 的 `int256`（影响可以为负），因此数量为 `value × 10^-decimals`；
- `unit` 通常是单位字符串（`"tCO2e"`、`"kWh"`、`"m3"`……）的 `keccak256`；
- `methodologyHash`（方法论文档原文的 keccak）和非空的 `methodologyURI` 是必需的；
- 只接受已结束的时段（`periodEnd <= block.timestamp`），并且只有获授权的报告者才能写入。

**每个精确时段只有一份原始记录。** 对同一对象、指标和时段的第二次报告必须是**更正**：它用 `correctsIndex` 指向被它取代的快照，而该快照会被设置 `correctedByIndex`。每个快照只能被更正一次，因此链是线性的，绝不分叉。`currentSnapshotForPeriod` 返回链的末端；`latestIndicatorSnapshot` 只反映记录顺序。

**标准标识符。** 规范定义了诸如 `keccak256("ERC-8329:INDICATOR:CARBON_EMITTED")` 的指标，以及自定义指标的命名模式。

**可选扩展**（通过 [ERC-165](/eip-165/) 检测）：

- `IImpactAttestation`：除报告者地址之外的任何获授权者，都可以追加带有证据哈希的背书或争议。证明（attestation）永远不会被编辑或删除。
- `IMethodologyVersioning`：经治理流程切换到新的方法论，立即生效或从未来某个指标序号起生效，可通过 `activeMethodology` / `pendingMethodology` 发现。重新计算的历史必须作为更正提交。

## 示例代码

记录一份年度排放数据，然后读取该年度的当前值（ethers v6）：

```ts
import { Contract, id, formatUnits } from "ethers";

const abi = [
  "function recordSnapshot(bytes32,bytes32,int256,uint8,bytes32,uint64,uint64,bytes32,string,uint256) returns (uint256)",
  "function currentSnapshotForPeriod(bytes32,bytes32,uint64,uint64) view returns (uint256)",
  "function getSnapshot(bytes32,uint256) view returns (tuple(bytes32 subjectId,bytes32 indicatorId,int256 value,uint8 decimals,bytes32 unit,uint64 periodStart,uint64 periodEnd,bytes32 methodologyHash,string methodologyURI,address reportedBy,uint64 reportedAt,uint256 correctsIndex,uint256 correctedByIndex))",
];
const log = new Contract(LOG_ADDRESS, abi, reporter);

const NO_CORRECTION = 2n ** 256n - 1n;
const CARBON_EMITTED = id("ERC-8329:INDICATOR:CARBON_EMITTED");
const UNIT_TCO2E = id("tCO2e");
const [start, end] = [1735689600n, 1767225600n]; // [2025-01-01, 2026-01-01) UTC

await log.recordSnapshot(
  subjectId, CARBON_EMITTED, 12345n, 1, UNIT_TCO2E, // 1234.5 tCO2e
  start, end, methodologyHash, "ipfs://<cid>", NO_CORRECTION,
);

const idx = await log.currentSnapshotForPeriod(subjectId, CARBON_EMITTED, start, end);
const s = await log.getSnapshot(subjectId, idx);
console.log(formatUnits(s.value, s.decimals), "tCO2e");
```

## 需要注意

- 状态为 **Last Call**（规范中的截止日期为 2026-10-19），因此接口仍可能有最后的改动。
- 日志证明的是*谁*报告了某个值，而不是它是否属实。它不验证测量结果，不为报告者或证明者做资质认证，也不计算任何评分。
- 重叠的时段、相关的指标和各自独立的注册表可能描述同一个现实世界的影响；汇总时请小心，避免重复计算。
- 务必检查 `unit`、`decimals` 和符号，并用哈希核对方法论文档。
- 公链上的数据是公开的：请使用不透明的对象 ID，并把敏感证据保存在链下。


---

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