---
eip: 7642
label: EIP-7642
title: eth/69 - history expiry and simpler receipts
status: Final
type: Standards Track
category: Networking
created: 2024-02-29
requires: 5793
official: https://eips.ethereum.org/EIPS/eip-7642
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7642.md
canonical: https://eips.huatuo.xyz/ja/eip-7642/
lang: ja
tldr: Ethereum の eth ピアツーピアプロトコルのバージョン 69。ピアが、まだ提供しているブロック範囲を告知する（マージ前の履歴を破棄すると必要になる）。ハンドシェイクから廃止済みの total difficulty がなくなり、レシートは 256 バイトの bloom フィルターなしで送られる。
tags: [networking, p2p, devp2p, history-expiry, receipts]
---

# EIP-7642: eth/69 - history expiry and simpler receipts

> Adds history serving window and removes bloom filter in receipt

**TL;DR:** Ethereum の eth ピアツーピアプロトコルのバージョン 69。ピアが、まだ提供しているブロック範囲を告知する（マージ前の履歴を破棄すると必要になる）。ハンドシェイクから廃止済みの total difficulty がなくなり、レシートは 256 バイトの bloom フィルターなしで送られる。

## 何を解決するのか

`eth` ワイヤープロトコルに残っていた 3 つの名残が、コストの原因になったり、誤解を招いたりしていました。

1. **履歴の期限切れ（history expiry）。** history expiry ワーキンググループは、クライアントがマージ前のブロック履歴を破棄してよい（2025 年 5 月 1 日以降）と決めました。すると、p2p で履歴を同期するノードは、*どのピアがまだそれを持っているか*を知る必要があります。それがなければ、尋ねて失敗することで知るしかありません。以前の同様の提案 [EIP-7542](/eip-7542/) は、history expiry が合意される前に取り下げられました。
2. **Total difficulty。** `Status` ハンドシェイクは `td` を運んでいましたが、マージ以降は意味がありません（マージ後のブロックの difficulty は 0 です）。
3. **レシートの bloom。** どのクライアントもレシートの bloom フィルターを保存していません。ログから再計算できるからです。それでもプロトコルは、提供側のノードにそれを再生成して送らせていました。仕様は、これをフルシンクあたり約 530 GB の余分な転送と見積もっています（snappy 圧縮後で約 95 GiB）。

## 仕組み

`eth/69` は 3 つのメッセージを変更します。

**Status (0x00)**: `td` を削除し、提供範囲を追加します。

```text
eth/68: [version, networkid, td, blockhash, genesis, forkid]
eth/69: [version, networkid, genesis, forkid, earliestBlock, latestBlock, latestBlockHash]
```

**Receipts (0x10)**: フラットなリストで、bloom なし、型付きレシート用の特別なラッピングもありません。

```text
eth/68: legacy = [status, cumulative-gas, bloom, logs]; typed = tx-type || rlp(legacy)
eth/69: receipt = [tx-type, post-state-or-status, cumulative-gas, logs]
```

受信側は、ブロックのレシートルートを検証するために、ログから各 bloom を再計算します。これは安価です。

**BlockRangeUpdate (0x11)**（新規）: `[earliestBlock, latestBlock, latestBlockHash]`。提供範囲が変わったときに送られますが、トラフィックを抑えるために、多くても 1 エポック（32 ブロック）に 1 回程度です。

## サンプルコード

eth/69 のレシートからコンセンサスのレシート（bloom 付き）を再構築する。TypeScript の疑似コード:

```ts
import { encodeRlp, concat, toBeHex } from "ethers";

type Log = [address: string, topics: string[], data: string];
type Eth69Receipt = [txType: number, status: string, cumulativeGas: string, logs: Log[]];

function toConsensusEncoding([txType, status, gas, logs]: Eth69Receipt): string {
  const bloom = logsBloom(logs);                     // 256-byte bloom over addresses + topics
  const body = encodeRlp([status, gas, bloom, logs]);
  return txType === 0 ? body : concat([toBeHex(txType, 1), body]);  // typed: type || rlp(...)
}
```

`logsBloom` は標準の Ethereum ログ bloom です（2048 ビットのフィルターで、アドレスとトピックごとに 3 ビットを立てます）。

## 知っておくべきこと

- ステータスは **Final** です。ネットワーク層のみの変更で、ハードフォークもコンセンサスの変更もありません。クライアントは、サポートするピアとは `eth/69` をネゴシエートし、古いピアとは引き続き `eth/68` で通信できます。
- これは、アナウンスにトランザクションタイプを追加した `eth/68`（[EIP-5793](/eip-5793/)）を土台にしています。
- `earliestBlock` は、将来のローリング式の履歴ウィンドウ（[EIP-4444](/eip-4444/)）にも備えるもので、クローラーが、完全な履歴をまだ提供しているノードの数を測定できるようにします。
- 次のプロトコルバージョンは別途検討が進んでいます。[EIP-7975](/eip-7975/) は、部分的なブロックレシートリストを備えた `eth/70` を提案しています（執筆時点では Last Call）。


---

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