---
eip: 8077
label: EIP-8077
title: eth/XX - announce transactions with nonce
status: Draft
type: Standards Track
category: Networking
created: 2025-11-07
requires: 7642
official: https://eips.ethereum.org/EIPS/eip-8077
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8077.md
canonical: https://eips.huatuo.xyz/zh/eip-8077/
lang: zh
tldr: 一个新的 devp2p `eth` 协议版本，其交易公告还会携带每笔交易的发送方和 nonce，让节点无需猜测，就能按顺序获取交易、填补 nonce 空缺并丢弃过期交易。
tags: [networking, devp2p, mempool, transactions, p2p]
---

# EIP-8077: eth/XX - announce transactions with nonce

> Adds source and nonce to transaction announcements

**TL;DR:** 一个新的 devp2p `eth` 协议版本，其交易公告还会携带每笔交易的发送方和 nonce，让节点无需猜测，就能按顺序获取交易、填补 nonce 空缺并丢弃过期交易。

## 它解决什么问题？

以太坊节点通过两种方式共享待处理交易：把小交易**完整推送**给少数对等节点，并用 `NewPooledTransactionHashes` **公告**其余交易，让对等节点按需拉取。大交易和 blob 交易（[EIP-4844](/eip-4844/)）只会被公告。目前一条公告只包含类型、大小和哈希。

只有哈希时，接收节点是在盲目获取：

- 它可能拉取了一笔其前序 nonce 自己并没有的交易，造成空缺，使该交易无法被打包。
- 填补空缺只能靠试错：请求更多哈希，然后碰运气。
- 要忽略已被打包的交易，它必须维护一份链上哈希的缓存，而不能简单地拿 nonce 与状态比较。
- 它无法优先处理来自特定发送方的交易。

随着吞吐量增长，节点可能无法获取全部交易，更聪明的选择性获取就更重要了。

## 它如何运作

`NewPooledTransactionHashes`（0x08）消息在新的协议版本（`eth/XX`，基于 [EIP-7642](/eip-7642/) 的 eth/69）中增加了两个并行列表：

```
eth/69: [txtypes, [txsize...], [txhash...]]
eth/XX: [txtypes, [txsize...], [txhash...], [txsource...], [txnonce...]]
```

- `txsource`（20 字节）是该交易消耗其 nonce 的账户；对于普通类型 `0x00`–`0x04`，它就是从签名中恢复出的地址。
- `txnonce` 是它所消耗的 nonce。

发送方只需附带这些额外数据。接收方*可以*用它们来调度（按 nonce 顺序获取、填补空缺、跳过小于当前账户 nonce 的交易）；具体策略交由客户端决定。

对于 [EIP-8141](/eip-8141/) 的 frame 交易，`txsource` 是显式的 `sender` 字段。如果启用了 [EIP-8250](/eip-8250/) 的 keyed nonce，`txnonce` 就只是一个序列值，接收方不得把它与账户 nonce 比较，也不得把 `<source, nonce>` 当作该交易的标识。

## 示例代码

两笔交易的公告的 RLP 结构（伪代码）：

```python
announcement = [
    bytes([0x02, 0x03]),                    # txtypes: one byte per tx
    [180, 131_200],                         # txsize
    [hash_a, hash_b],                       # 32-byte hashes
    [sender_a, sender_b],                   # 20-byte addresses (new)
    [41, 7],                                # nonces (new)
]
msg = rlp.encode(announcement)              # sent as message 0x08
```

接收方使用新字段的过滤器：

```python
for t, size, h, src, nonce in zip(*announcement):
    if t in FRAME_TX_TYPES:
        continue                            # nonce may be a keyed sequence; don't compare
    if nonce < state_nonce(src):
        continue                            # already mined, skip without a hash cache
    schedule_fetch(h, priority=(src, nonce))
```

## 需要注意

- **状态：Draft。** 协议版本号仍是占位符（`eth/XX`）。
- 仅涉及网络层：无需硬分叉。新旧客户端通过协商协议版本实现互操作。
- 公告会变大（每笔交易额外多出一个 20 字节的地址和一个 nonce）；作者认为值得，但开销分析仍标记为 TODO。
- 在获取到交易之前，公告中的 source 和 nonce 都未经验证。如果与获取到的交易不一致，应将其视为发出公告的对等节点违反了协议；节点在根据公告地址进行状态查询之前，应先做速率限制。


---

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