---
eip: 6465
label: EIP-6465
title: SSZ withdrawals root
status: Draft
type: Standards Track
category: Core
created: 2023-02-08
requires: 2718, 4895, 6404, 7495, 7916
official: https://eips.ethereum.org/EIPS/eip-6465
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6465.md
canonical: https://eips.huatuo.xyz/zh/eip-6465/
lang: zh
tldr: 提议把执行区块头中的 withdrawals_root 从 Merkle Patricia Trie 根改为 SSZ hash_tree_root，使执行层和共识层以相同方式承诺提款。
tags: [ssz, withdrawals, core, consensus, block-header]
---

# EIP-6465: SSZ withdrawals root

> Migration of withdrawals MPT commitment to SSZ

**TL;DR:** 提议把执行区块头中的 withdrawals_root 从 Merkle Patricia Trie 根改为 SSZ hash_tree_root，使执行层和共识层以相同方式承诺提款。

## 它解决什么问题？

验证者提款（[EIP-4895](/eip-4895/)）由共识层推入每个执行区块。两层都存储一个 `withdrawals_root`，但含义不同：执行区块头保存的是 RLP 编码提款的 **Merkle Patricia Trie（MPT）** 根，而共识层的 `ExecutionPayloadHeader` 保存的是 **SSZ** 根。

名称相同，却是两种不同的哈希。EIP-6465 让执行层区块头也使用 SSZ 根。这样客户端少了一个需要 MPT 的地方，也让 `withdrawals_root` 在所有地方都只有一种含义。

## 它如何运作

- 共识层的 `Withdrawal` 容器迁移为 [EIP-7495](/eip-7495/) 的 `ProgressiveContainer`，保留相同的四个字段：`index`、`validator_index`、`address`（20 字节）和 `amount`（以 Gwei 为单位）。
- 区块的提款变为 `ProgressiveList[Withdrawal]`（progressive list 来自 [EIP-7916](/eip-7916/)）。
- 执行层区块头的 `withdrawals_root` 被设为该列表的 SSZ `hash_tree_root()`，而不是 MPT 根。
- 共识层的 `ExecutionPayload.withdrawals` 使用同一种 progressive list 类型，状态转换仍然把提款数量限制在 `MAX_WITHDRAWALS_PER_PAYLOAD` 以内。

它属于"处处使用 SSZ"这一系列提案，与 [EIP-6404](/eip-6404/)（SSZ 交易根）并列。

## 示例代码

新的定义和根的计算，采用规范中的 Python 风格：

```python
class Withdrawal(ProgressiveContainer(active_fields=[1, 1, 1, 1])):
    index: WithdrawalIndex          # uint64
    validator_index: ValidatorIndex # uint64
    address: ExecutionAddress       # Bytes20
    amount: Gwei                    # uint64

withdrawals = ProgressiveList[Withdrawal](
    withdrawal_0, withdrawal_1, withdrawal_2, ...)

# Before: MPT root over RLP-encoded withdrawals
# After:
block_header.withdrawals_root = withdrawals.hash_tree_root()
```

## 需要注意

- 状态为 **Draft**。这是一项需要硬分叉的 Core 变更，尚未在主网上线。
- 它最初曾被考虑纳入 Shanghai，但为了让提款能更早上线而被推迟。
- 任何依据区块头中 MPT `withdrawals_root` 来验证提款的东西（轻客户端、证明器、索引器）都需要改用 SSZ 证明。
- 提款的 RLP 和 SSZ 编码可能会冲突。每个通道只使用一种格式，并通过区块所属的分叉判断适用哪一种。


---

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