# 拜占庭容错

拜占庭容错（Byzantine fault tolerance，BFT）是[分布式算法](https://www.edgepedia.org/zh/distributed-algorithm)的一种性质：即使某些组件以任意方式失效——包括发出自相矛盾、伪造或恶意的消息——一组副本仍能达成正确的共识并持续运行。崩溃的节点只是不再响应，而拜占庭节点可以对不同的对等节点有选择地说谎，这正是攻击者或发生故障的航空电子板卡所表现出的行为。<sup>[1](https://cs.nyu.edu/~apanda/classes/sp26/notes/bft.pdf)</sup> 在安全攸关的控制系统与去中心化系统中，无法假定每个参与者都诚实，此时就要用到 BFT。

| 关键事实 | 细节 |
|---|---|
| 失效模型 | 拜占庭节点以任意且恶意的方式行事；崩溃失效节点只是停止运行（VR 处理后者）<sup>[2](https://pmg.csail.mit.edu/papers/vr-to-bft.pdf)</sup> |
| 副本数量下界 | 消息未经认证时，要容忍 f 个故障并达成一致，需要 n ≥ 3f+1 个副本 <sup>[3](https://dl.acm.org/doi/10.1145/322186.322188)</sup>；若采用认证机制，在较弱的假设下——故障处理器可以拒绝转发信息，但不能在转发时篡改信息——对任意 n ≥ f 都能达成一致，实践中以密码学方法近似实现这一条件 <sup>[4](https://www.microsoft.com/en-us/research/publication/reaching-agreement-presence-faults/)</sup>；可信硬件同样能限制副本的不当行为 <sup>[5](https://www.usenix.org/system/files/nsdi24-amiri.pdf)</sup><sup> • </sup><sup>[12](https://lamport.azurewebsites.net/pubs/reaching.pdf)</sup> |
| 不可能性 | 在完全异步系统中，没有任何确定性共识能同时保证安全性与活性（FLP）<sup>[6](https://doi.org/10.1145/3149.214121)</sup> |
| 经典协议 | PBFT（1999）通过预准备、准备、提交三个阶段对请求排序，正常情形下使用 MAC <sup>[7](https://doi.org/10.5555/296806.296824)</sup><sup> • </sup><sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup> |
| 实测开销 | 一个采用 BFT 复制的 NFS 服务仅比无复制的 NFS 慢 3% <sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup> |
| 规模指标 | SBFT 在 209 个地理复制的副本、容忍 f = 64 的情况下，持续达到每秒 170 笔以上交易，平均延迟 620 毫秒 <sup>[9](https://research.vmware.com/files/attachments/0/0/0/0/0/7/2/sbft_scaling_up_byzantine_fault_tolerance_5_.pdf)</sup> |
| 部署实例 | 波音 777 航空电子系统、SpaceX 猎鹰飞船、Libra 与 Algorand 等区块链，以及拜占庭鲁棒的分布式机器学习 <sup>[1](https://cs.nyu.edu/~apanda/classes/sp26/notes/bft.pdf)</sup><sup> • </sup><sup>[10](https://www.mdpi.com/2079-9292/12/18/3801)</sup> |

## 工作原理

这个问题通常被表述为拜占庭将军问题：一位指挥官必须向 n−1 位副官下达命令，使得两个交互一致性条件成立，即 IC1（所有忠诚的副官服从同一道命令）与 IC2（若指挥官忠诚，则每位忠诚的副官都服从该命令）。<sup>[11](https://lamport.org/pubs/byz.pdf)</sup> 故障参与者可能向不同的对等节点发送不同的值，因此忠诚副本必须靠多数票压过谎言。

核心结果是一个副本数量的下界。在消息未经认证的“口头”消息模型下，当且仅当超过三分之二的参与者忠诚时，一致才是可解的；1980 年《ACM 学报》上的论文证明，在 m 个故障处理器的情况下，可解当且仅当 n ≥ 3m+1 <sup>[3](https://dl.acm.org/doi/10.1145/322186.322188)</sup>，而且即便允许无限多轮，这个界也是紧的。<sup>[12](https://lamport.azurewebsites.net/pubs/reaching.pdf)</sup> 数字签名让接收方能够验证某个值源自何人，从而打破了这种不可区分性。<sup>[1](https://cs.nyu.edu/~apanda/classes/sp26/notes/bft.pdf)</sup> 在带不可伪造数字签名的同步拜占庭协议中，只要 n>f 就能达成一致 <sup>[4](https://www.microsoft.com/en-us/research/publication/reaching-agreement-presence-faults/)</sup>，因此并不存在普遍的 2f+1 要求；而可信硬件通过限制副本的不当行为，反倒能把副本要求降到 2f+1。<sup>[5](https://www.usenix.org/system/files/nsdi24-amiri.pdf)</sup><sup> • </sup><sup>[26](https://www.microsoft.com/en-us/research/publication/reaching-agreement-presence-faults/?lang=fr-ca)</sup>

时序假设决定了什么可以被证明。在完全异步系统中，FLP 结果表明，哪怕只有一个故障进程，也没有任何确定性共识能同时保证安全性与活性 <sup>[6](https://doi.org/10.1145/3149.214121)</sup>，因此异步协议依赖随机化或混合技术。<sup>[5](https://www.usenix.org/system/files/nsdi24-amiri.pdf)</sup> 包括 PBFT 在内的大多数实用协议都是部分同步的：安全性无条件成立，但只有在网络于假定的全局稳定时间之后变为同步时，活性才有保证。<sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup><sup> • </sup><sup>[13](https://arxiv.org/html/2407.19863v3)</sup>

## 实现方式

PBFT 由米格尔·卡斯特罗（Miguel Castro）与[芭芭拉·利斯科夫](https://www.edgepedia.org/zh/barbara-liskov)（Barbara Liskov）于 1999 年提出 <sup>[7](https://doi.org/10.5555/296806.296824)</sup>，它在 n = 3f+1 个副本上以三个阶段复制一个状态机 <sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup>：

1. 客户端向主节点发送请求，主节点为其分配序号，并多播一条预准备消息，提出该请求的排序。
2. 每个接受该预准备消息的备份节点进入准备阶段，多播一条准备消息；副本在收集到 2f 条一致的准备消息后即进入“已准备”状态。
3. 已准备的副本多播提交消息；副本在收到 2f+1 条提交消息（含自身的一条）后执行该请求，并回复客户端。
4. 客户端在收到来自不同副本的 f+1 条一致回复后接受该结果。

即使主节点是故障的，预准备与准备阶段也能在一个视图内对请求做全序排列；准备与提交阶段则跨视图对请求排序。<sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup> 正常情形下的认证使用消息认证码（MAC），公钥密码学只留给出现故障的情形——这正是 PBFT 比 Rampart、SecureRing 等前身协议快一个数量级以上的主要原因。<sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup> 主节点失效时，超时触发视图更换：备份节点多播视图更换消息，新的主节点多播新视图消息，从而恢复活性。<sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup>

## 起源

这个问题源自 NASA 20 世纪 70 年代的软件实现容错（Software Implemented Fault Tolerant，SIFT）项目，其目标是实现具有容错能力的飞机控制。<sup>[13](https://arxiv.org/html/2407.19863v3)</sup> 第一次精确的处理见于 M. 皮斯（M. Pease）、R. 肖斯塔克（R. Shostak）与 L. 兰波特（L. Lamport）发表于 1980 年 4 月《ACM 学报》的《在有故障的情况下达成一致》（"Reaching Agreement in the Presence of Faults"）。<sup>[3](https://dl.acm.org/doi/10.1145/322186.322188)</sup> 1982 年，[莱斯利·兰波特](https://www.edgepedia.org/zh/leslie-lamport)（Leslie Lamport）、罗伯特·肖斯塔克（Robert Shostak）与马歇尔·皮斯（Marshall Pease）在《ACM 程序设计语言与系统汇刊》上发表的论文《拜占庭将军问题》（第 382–401 页）<sup>[14](https://doi.org/10.1145/357172.357176)</sup><sup> • </sup><sup>[15](https://www.microsoft.com/en-us/research/publication/byzantine-generals-problem/)</sup> 给出了那个寓言及其算法；兰波特称，写这篇文章的主要目的就是给这个问题安上“拜占庭”这个新名字。<sup>[15](https://www.microsoft.com/en-us/research/publication/byzantine-generals-problem/)</sup> 相关的 FLP 不可能性结果由[迈克尔·J·菲舍尔](https://www.edgepedia.org/zh/michael-j-fischer)（Michael J. Fischer）、南希·A·林奇（Nancy A. Lynch）与迈克尔·S·佩特森（Michael S. Paterson）给出（《ACM 学报》，1985 年），它界定了任何异步协议所能保证的范围。<sup>[6](https://doi.org/10.1145/3149.214121)</sup>

## 变体

PBFT 的 O(n²) 全互联消息模式衍生出一长串后继。推测型协议：Zyzzyva（科特拉、阿尔维西、达林、克莱门特与王，2007）让副本乐观地采纳主节点的排序并立即回复，在 3f+1 个副本上达到每秒数万请求的吞吐量。<sup>[16](https://www.sigops.org/s/conferences/sosp/2007/papers/sosp052-kotla.pdf)</sup>

线性协议：HotStuff 是一种部分同步的、基于领导者的协议，其通信量与副本数成线性关系，视图更换也是线性的，并具有乐观响应性（一个正确的领导者只需前 n−f 个响应）；它通过三个阶段投票完成提交，这些投票被压缩成单个门限签名的法定证书。<sup>[17](https://dl.acm.org/doi/10.1145/3293611.3331591)</sup> SBFT 维持 n = 3f+2c+1 个副本，可容忍 f 个拜占庭服务器以及 c 个崩溃或落后的服务器，并使用门限签名，使收集者发出的消息大小恒定而非线性增长；它实现了双模式视图更换，可在乐观快速路径与线性 PBFT 慢速路径之间切换，而无需进行视图更换。<sup>[9](https://research.vmware.com/files/attachments/0/0/0/0/0/7/2/sbft_scaling_up_byzantine_fault_tolerance_5_.pdf)</sup>

基于 DAG 的协议与异步协议：Narwhal 与 Tusk（达内齐斯、科吉亚斯、索尼诺与斯皮格尔曼，2021）把交易传播分离到一个基于 DAG 的交易池中，与排序解耦，在没有指定领导者的情况下并行流水化交易 <sup>[18](https://doi.org/10.48550/arxiv.2105.11827)</sup><sup> • </sup><sup>[19](https://arxiv.org/html/2204.03181v3)</sup>；Bullshark（斯皮格尔曼、吉里达兰、索尼诺与科科里斯-科吉亚斯，2022）使 DAG BFT 在部分同步环境下变得实用。<sup>[20](https://doi.org/10.48550/arxiv.2201.05677)</sup> HoneyBadgerBFT 在至少 3f+1 个节点上、无需时序假设即可在异步网络中提供活性。<sup>[10](https://www.mdpi.com/2079-9292/12/18/3801)</sup>

## 应用

Algorand 使用 BFT 共识，更早的区块链项目也是如此，尤其是 Meta 于 2019 年推出的 Libra 支付项目，它后来更名为 Diem，并最终关停；<sup>[10](https://www.mdpi.com/2079-9292/12/18/3801)</sup><sup> • </sup><sup>[21](https://www.bbc.com/news/technology-60156682)</sup> 除区块链之外，BFT 还出现在分布式数据库以及云、边缘和物联网部署中。<sup>[10](https://www.mdpi.com/2079-9292/12/18/3801)</sup> 在航空电子与航天器领域，在安全至关重要的场合会采用 BFT 式复制，例如波音 777 飞机与 SpaceX 猎鹰飞船——那里由多个团队编写软件，再由一个共识协议就下一步动作达成一致。<sup>[1](https://cs.nyu.edu/~apanda/classes/sp26/notes/bft.pdf)</sup> 在机器学习中，任何基于工作者向量线性组合的梯度聚合规则都无法容忍哪怕一次拜占庭失效；Krum 规则假定 2f+2 < n，选取到其最近的 n−f−2 个向量的距离之和最小的工作者向量，为分布式随机梯度下降（SGD）提供了可证明的鲁棒性，每次聚合的期望时间为 O(n²d)。<sup>[22](https://proceedings.neurips.cc/paper_files/paper/2017/file/f4b9ec30ad9f68f89b29639786cb62ef-Paper.pdf)</sup>

## 局限与替代方案

主要代价在于副本数量与消息复杂度。PBFT 的全互联阶段构成一个全连接拓扑，消息量为 O(n²) <sup>[23](https://www.fim.uni-passau.de/fileadmin/dokumente/fakultaeten/fim/lehrstuhl/reiser/publications/Scalability_Survey_Paper__Preprint_.pdf)</sup>；在无故障情形下，它必须投递并解码 3t+1 条消息，尽管推进只需 2t+1 条回复。<sup>[24](https://pmc.ncbi.nlm.nih.gov/articles/PMC7276254/)</sup> 在 n = 64 时，HotStuff 的吞吐量比 PBFT 高 48%，但延迟高 32%，这是它多出一轮通信的代价。<sup>[5](https://www.usenix.org/system/files/nsdi24-amiri.pdf)</sup>

同步假设会带来攻击面。安全性依赖同步性的协议可能遭到 DoS 攻击：攻击者拖延非故障节点，直到它们被排除出副本组；PBFT 不会如此，因为它的安全性从不依赖同步性。<sup>[8](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)</sup> 基于 DAG 的协议能抵御针对领导者的 DDoS，因为即便某个领导者遭到攻击，进展也不会停止；而在部分同步协议中，不可预测的领导者选举在实证上效果有限。<sup>[25](https://eprint.iacr.org/2024/1242.pdf)</sup>

与崩溃容错相比，任意故障的代价相当高昂：PBFT 的崩溃失效前身 Viewstamped Replication（视图戳复制）只需 2f+1 个副本，这是崩溃模型下异步网络中的最小值。<sup>[2](https://pmg.csail.mit.edu/papers/vr-to-bft.pdf)</sup>

## References

1. [Byzantine Fault Tolerance (NYU course lecture notes)](https://cs.nyu.edu/~apanda/classes/sp26/notes/bft.pdf)
2. [From Viewstamped Replication to Byzantine Fault Tolerance (Liskov)](https://pmg.csail.mit.edu/papers/vr-to-bft.pdf)
3. [Reaching Agreement in the Presence of Faults (Pease, Shostak, Lamport), Journal of the ACM](https://dl.acm.org/doi/10.1145/322186.322188)
4. [Reaching Agreement in the Presence of Faults - Microsoft Research (Lamport retrospective)](https://www.microsoft.com/en-us/research/publication/reaching-agreement-presence-faults/)
5. [The Bedrock of Byzantine Fault Tolerance: A Unified Platform for BFT Protocols Analysis, Implementation, and Experimentation (NSDI 2024)](https://www.usenix.org/system/files/nsdi24-amiri.pdf)
6. [Michael J. Fischer, Nancy A. Lynch, Michael S. Paterson (1985). Impossibility of distributed consensus with one faulty process. Journal of the ACM.](https://doi.org/10.1145/3149.214121)
7. [Miguel Castro, Barbara Liskov (1999). Practical Byzantine fault tolerance. Operating Systems Design and Implementation.](https://doi.org/10.5555/296806.296824)
8. [Practical Byzantine Fault Tolerance (Castro & Liskov, OSDI '99 proceedings page)](https://www.usenix.org/legacy/events/osdi99/full_papers/castro/castro_html/castro.html)
9. [SBFT: Scaling Up Byzantine Fault Tolerance](https://research.vmware.com/files/attachments/0/0/0/0/0/7/2/sbft_scaling_up_byzantine_fault_tolerance_5_.pdf)
10. [Byzantine Fault-Tolerant Consensus Algorithms: A Survey (Electronics 2023)](https://www.mdpi.com/2079-9292/12/18/3801)
11. [The Byzantine Generals Problem (Lamport, Shostak, Pease)](https://lamport.org/pubs/byz.pdf)
12. [Reaching Agreement in the Presence of Faults (full PDF, author's copy)](https://lamport.azurewebsites.net/pubs/reaching.pdf)
13. [Half a Century of Distributed Byzantine Fault-Tolerant Consensus: Design Principles and Evolutionary Pathways](https://arxiv.org/html/2407.19863v3)
14. [Leslie Lamport, Robert Shostak, Marshall Pease (1982). The Byzantine Generals Problem. ACM Transactions on Programming Languages and Systems.](https://doi.org/10.1145/357172.357176)
15. [The Byzantine Generals Problem - Microsoft Research (Lamport retrospective)](https://www.microsoft.com/en-us/research/publication/byzantine-generals-problem/)
16. [Zyzzyva: Speculative Byzantine Fault Tolerance (SOSP 2007; excerpts merged from the ACM TOCS 27(4) 2009 journal-version DOI page)](https://www.sigops.org/s/conferences/sosp/2007/papers/sosp052-kotla.pdf)
17. [HotStuff: BFT Consensus with Linearity and Responsiveness (PODC 2019; excerpts merged from the VMware-hosted conference PDF of the same paper)](https://dl.acm.org/doi/10.1145/3293611.3331591)
18. [Danezis, George and colleagues (2021). Narwhal and Tusk: A DAG-based Mempool and Efficient BFT Consensus. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2105.11827)
19. [Reaching Consensus in the Byzantine Empire: A Comprehensive Review of BFT Consensus Algorithms](https://arxiv.org/html/2204.03181v3)
20. [Spiegelman, Alexander and colleagues (2022). Bullshark: DAG BFT Protocols Made Practical. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2201.05677)
21. [Facebook-funded cryptocurrency Diem winds down](https://www.bbc.com/news/technology-60156682)
22. [Machine Learning with Adversaries: Byzantine Tolerant Gradient Descent (NeurIPS 2017)](https://proceedings.neurips.cc/paper_files/paper/2017/file/f4b9ec30ad9f68f89b29639786cb62ef-Paper.pdf)
23. [SoK: Scalability Techniques for BFT Consensus](https://www.fim.uni-passau.de/fileadmin/dokumente/fakultaeten/fim/lehrstuhl/reiser/publications/Scalability_Survey_Paper__Preprint_.pdf)
24. [A Comparison of Message Exchange Patterns in BFT Protocols](https://pmc.ncbi.nlm.nih.gov/articles/PMC7276254/)
25. [Beyond the Whitepaper: Where BFT Consensus Protocols Meet Reality](https://eprint.iacr.org/2024/1242.pdf)
26. [Reaching Agreement in the Presence of Faults - Microsoft Research](https://www.microsoft.com/en-us/research/publication/reaching-agreement-presence-faults/?lang=fr-ca)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Titles 2 to Ma

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/byzantine-fault-tolerance

English original: https://www.edgepedia.org/byzantine-fault-tolerance
