---
eip: 4895
label: EIP-4895
title: Beacon chain push withdrawals as operations
status: Final
type: Standards Track
category: Core
created: 2022-03-10
official: https://eips.ethereum.org/EIPS/eip-4895
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4895.md
canonical: https://eips.huatuo.xyz/zh/eip-4895/
lang: zh
tldr: 让验证者的提款从信标链流入执行层，作为一种新的系统级“withdrawal”操作，无需交易也无需 gas 即可向地址入账 ETH；已在 Shanghai/Capella 升级中激活。
tags: [staking, withdrawals, consensus, core, shanghai]
---

# EIP-4895: Beacon chain push withdrawals as operations

> Support validator withdrawals from the beacon chain to the EVM via a new "system-level" operation type.

**TL;DR:** 让验证者的提款从信标链流入执行层，作为一种新的系统级“withdrawal”操作，无需交易也无需 gas 即可向地址入账 ETH；已在 Shanghai/Capella 升级中激活。

## 它解决什么问题？

合并（the Merge，[EIP-3675](/eip-3675/)）之后，质押者的 ETH 留在信标链上，无法回到 EVM。奖励不断累积，退出也是可能的，但这些 ETH 无法使用。

EIP-4895 定义了提取出的 ETH 如何从共识层进入执行层余额。它采用**推送**模型：当共识层把一笔提款从队列中取出时，执行层必须在该区块中应用它。无需任何人发送交易来领取。

## 它如何运作

- 一种新的负载对象 **withdrawal**，与用户交易分开：`[index, validator_index, address, amount]`。`index` 是全局计数器，`amount` 以 **Gwei** 为单位且非零。
- 执行负载新增 `withdrawals` 列表，区块头新增 `withdrawals_root`，它是以与交易根相同的方式构建的 Merkle-Patricia 树根。
- 提款在区块中所有交易**之后**处理。每一笔只是把 `address` 的余额增加 `amount × 10^9` wei。
- 这种余额增加是无条件的，不得失败，不消耗 gas，也**不运行任何 EVM 代码**。

激活基于时间戳：`FORK_TIMESTAMP = 1681338455`（2023 年 4 月，执行层 Shanghai / 共识层 Capella 升级）。

为什么不用新的交易类型？提款由系统发起，而不是由用户发起。将其作为独立对象，可以避免与普通交易处理产生交互，并简化测试和安全审查。共识层限制了每个区块中出现的提款数量，因此跳过 gas 计算是安全的。

## 示例代码

通过 JSON-RPC 从区块中读取提款（ethers v6）：

```ts
import { JsonRpcProvider, formatEther } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const block = await provider.send("eth_getBlockByNumber", ["latest", false]);

console.log("withdrawalsRoot:", block.withdrawalsRoot);
for (const w of block.withdrawals ?? []) {
  const wei = BigInt(w.amount) * 10n ** 9n; // amount is in Gwei
  console.log(`#${BigInt(w.index)} validator ${BigInt(w.validatorIndex)} -> ${w.address}: ${formatEther(wei)} ETH`);
}
```

## 需要注意

- 提款不会调用接收方。接收提款的合约不会运行 `receive()` 或 `fallback()`，也不会产生日志。请通过区块的 `withdrawals` 列表而不是事件来跟踪它们。
- 由于提款不是交易，它不会出现在交易列表或回执中。
- 哪些验证者提款以及提多少，完全由共识层决定；这个 EIP 只是应用结果。
- 后续升级扩展了质押流程：[EIP-7002](/eip-7002/) 允许提款凭证从执行层触发退出，[EIP-6110](/eip-6110/) 将存款移到链上，[EIP-7251](/eip-7251/) 提高了最大有效余额。


---

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