{
  "id": "distributed-consensus",
  "title": "Distributed Consensus",
  "lang": "en",
  "source_lang": "en",
  "summary": "Distributed consensus enables independent computing processes to agree on a common decision despite failures, communication delays, or malicious behavior.",
  "category": "computer-science",
  "subcategory": "algorithms-theory",
  "type": "concept",
  "aliases": [
    "Distributed agreement",
    "Consensus in distributed systems"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/distributed-consensus/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/distributed-consensus/",
      "json": "https://aiwiki.page/zh/distributed-consensus.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Distributed consensus is the problem of getting several independent computing processes to agree on a decision while operating under explicitly defined assumptions about communication and failures. It is a foundational problem in distributed computing because a collection of machines has no automatically shared view of events: messages arrive at different times, machines stop responding, and some participants may provide contradictory information. A consensus protocol specifies how agreement remains correct despite such conditions and when a decision is guaranteed to become possible.\n\nConsensus provides a basis for fault tolerance, replicated coordination services, and state machine replication, in which multiple computers execute the same ordered sequence of commands. It is used in database replication, infrastructure management, and some blockchain systems. Its guarantees depend on the failure model, timing assumptions, membership rules, and definition of agreement. Protocols designed for accidental crashes are therefore not interchangeable with protocols designed to tolerate malicious participants.\n\nThe subject combines mathematical impossibility results with practical engineering. Its central questions concern not only how participants reach agreement, but also which failures can be tolerated, what information must survive a restart, how authority passes between leaders, and how an agreement becomes visible to applications."
    },
    {
      "heading": "The consensus problem and its system models",
      "text": "In a standard formulation, each of \\(n\\) processes begins with a proposed value and executes an algorithm that may eventually produce an irrevocable decision. Consensus is usually specified through three properties. Agreement requires that no two correct processes decide differently. Validity constrains what may be decided, commonly requiring that the decision be a proposed value or that a unanimously proposed value be selected. Termination requires every correct process eventually to decide. Some formulations state integrity separately: a process decides at most once.\n\nThese definitions have important variants. Ordinary agreement constrains correct processes; uniform agreement also constrains decisions made by processes that later fail. For Byzantine failures, validity must account for dishonest proposals, and different tasks use different conditions. A protocol may guarantee selection of a correct participant’s input under specified circumstances, or require a decision to satisfy a publicly checkable predicate. These distinctions affect both feasibility and application behavior. Merely producing the same arbitrary constant is not a useful solution when validity requires the outcome to reflect participants’ inputs.\n\nThe failure model determines what a faulty process can do. In a crash-stop model, a process permanently halts. In a crash-recovery model, it may restart, so the protocol must distinguish volatile state from information preserved on stable storage. An omission failure involves lost sends or receives. A Byzantine failure permits arbitrary behavior, including sending inconsistent messages to different recipients, inventing protocol states, or cooperating with other faulty processes. Byzantine behavior need not imply intentional attack: software defects or corrupted state can also violate protocol rules.\n\nTiming assumptions are equally fundamental. A synchronous model provides known bounds on message delivery and processing. A fully asynchronous model provides no such bounds, even when messages between correct processes are eventually delivered. Partial synchrony occupies an intermediate position: bounds may exist but be unknown, or may become valid only after an unknown stabilization time. Most practical consensus systems preserve agreement during arbitrary delays but require sufficiently stable communication to make progress.\n\nCommunication and identity assumptions complete the model. Point-to-point channels may authenticate senders without allowing messages to serve as transferable proof; digital signatures provide stronger evidence when their security assumptions hold. Membership may be fixed, explicitly reconfigured, or open to participants who satisfy a resource-based admission rule. Consequently, a statement such as “this protocol tolerates one-third failures” is incomplete without specifying timing, authentication, membership, and the particular guarantee being claimed."
    },
    {
      "heading": "Impossibility results and the development of consensus theory",
      "text": "Research on reliable distributed agreement developed alongside distributed operating systems and replicated services during the 1970s and 1980s. Leslie Lamport’s 1978 work on logical clocks and event ordering supplied a framework for reasoning about executions without a universal physical clock. In 1980, Marshall Pease, Robert Shostak, and Lamport published results on agreement in the presence of faults; their 1982 Byzantine generals formulation made the problem widely recognizable. These results established that contradictory communication is a mathematical obstacle, not merely an implementation defect.\n\nFor synchronous Byzantine agreement using unauthenticated messages, tolerating \\(f\\) faulty participants requires more than \\(3f\\) participants. With only three participants and one possible traitor, different recipients cannot always distinguish a dishonest sender from a dishonest intermediary. Authentication changes the problem because an adversary cannot freely impersonate correct participants. Thus, the familiar \\(n \\geq 3f+1\\) threshold is not a universal law applying unchanged to every agreement model.\n\nA different limit was established by Michael Fischer, Nancy Lynch, and Michael Paterson in their 1985 paper on the impossibility of distributed consensus with one faulty process. The FLP impossibility result shows that deterministic consensus cannot guarantee termination in a fully asynchronous message-passing system if even one process may crash. The model permits reliable communication; the difficulty is the absence of timing information that could distinguish a failed process from one whose messages are merely delayed. The proof constructs an admissible execution in which a decision remains perpetually unresolved.\n\nFLP does not establish that practical consensus is impossible, nor that agreement must fail during an outage. Instead, it prevents a particular combination of unconditional guarantees. Protocols may preserve safety while temporarily losing liveness, assume eventual timing bounds, or introduce randomization. Michael Ben-Or’s 1983 work demonstrated how randomized algorithms could circumvent deterministic impossibility under appropriate fault assumptions. Probabilistic termination is a different guarantee from a fixed worst-case completion time.\n\nCynthia Dwork, Nancy Lynch, and Larry Stockmeyer formalized influential partial-synchrony models in 1988. Tushar Chandra and Sam Toueg subsequently developed the theory of failure detectors, with a major publication in 1996. Such detectors expose suspicions about failures and are characterized by completeness and accuracy properties. A timeout-based detector can make mistakes during network delays; many protocols remain safe despite those mistakes but require eventual stability to terminate. These developments separate two issues that operational descriptions often conflate: preserving a unique decision and eventually obtaining enough timely information to reach one."
    },
    {
      "heading": "Quorums, durable evidence, and the preservation of decisions",
      "text": "A central technique in consensus is to require decisions to obtain support from a quorum, a subset of participants whose size and structure ensure a necessary intersection with other relevant subsets. In a crash-tolerant system with \\(n=2f+1\\) voting replicas, a majority has \\(f+1\\) members. Any two majorities intersect. If replicas preserve the protocol information that they promise or accept, a later leader can discover enough evidence to avoid contradicting an earlier decision.\n\nIntersection alone is not a consensus algorithm. If replicas vote for arbitrary conflicting proposals whenever asked, two overlapping groups can still endorse incompatible outcomes at different times. Correctness depends on rules governing votes, proposal numbers, recovery, and what information a participant must retain. Durable evidence matters especially after restart: forgetting an earlier promise or accepted value can allow a replica to behave as though it had never participated, invalidating the argument that connects successive quorums.\n\nThe arithmetic changes when some participants can equivocate. For two quorums of size \\(q\\) among \\(n\\) participants, their intersection contains at least \\(2q-n\\) participants. To ensure that this intersection includes a correct participant when up to \\(f\\) are Byzantine, a common requirement is\n\n\\[2q-n>f.\\]\n\nThe familiar choice \\(n=3f+1\\) and \\(q=2f+1\\) produces an intersection of at least \\(f+1\\), including at least one correct participant. That correct participant must also obey locking or voting rules that prevent conflicting decisions. The counting argument explains why a certificate is meaningful, but those rules establish how certificates remain mutually compatible across rounds.\n\nNot all protocols require every quorum to be a majority. Flexible Paxos, for example, distinguishes quorums used to establish a leader’s authority from quorums used to accept values. Its essential intersection condition is between the relevant phase-one and phase-two quorums, rather than between every pair of quorums of every type. This permits asymmetric configurations, although the resulting availability differs between ordinary operation and leader recovery. Weighted voting and geographically structured quorums similarly change which failures can be tolerated.\n\nA decision also differs from knowledge of a decision. A value may already have received the required acceptances when the leader fails before notifying clients or learners. Recovery must preserve that value even if no surviving client observed success. Conversely, an unanswered client request may have committed. This distinction explains why retry handling cannot rely solely on whether a client received an acknowledgment: agreement establishes a durable system fact, while communication determines which participants have learned that fact."
    },
    {
      "heading": "Crash-tolerant protocols: Paxos and Raft",
      "text": "Paxos, developed by Leslie Lamport and presented in “The Part-Time Parliament,” published in 1998, organizes agreement around numbered proposals and persistent acceptor state. In single-decree Paxos, a proposer first sends a prepare request with a proposal number. An acceptor that responds promises not to accept lower-numbered proposals and reports its highest-numbered previously accepted proposal, if any. After collecting a suitable quorum of responses, the proposer must select the value associated with the highest accepted proposal it learned about; if none was reported, it may propose a new value.\n\nThe proposer then asks acceptors to accept the selected value under its proposal number. Once a quorum accepts the same proposal, the value is chosen. Different proposals may carry the same value, and competing proposers may prevent progress by repeatedly superseding one another. Safety does not require a permanently stable leader, but practical progress generally benefits from one. Proposal numbers must be uniquely ordered, and promises and accepted proposals must survive the failures covered by the system model.\n\nMulti-Paxos applies this machinery to a sequence of log positions. Once a leader has established authority, it can commonly avoid repeating the full preparation exchange for each position, giving the steady-state replication path a proposal and acknowledgment exchange. A replacement leader must recover relevant accepted values and preserve already chosen entries. Implementations also need mechanisms for catch-up, snapshots, membership changes, duplicate client requests, and log truncation; these are substantial parts of a production system rather than consequences of the single-decree algorithm alone.\n\nThe Raft consensus algorithm, described by Diego Ongaro and John Ousterhout in 2014, explicitly separates leader election, log replication, and safety. Time is divided into numbered terms. A candidate requests votes and must obtain a majority; voters reject candidates whose logs are insufficiently up to date under Raft’s comparison rule. Once elected, a leader sends AppendEntries messages containing commands and information about the preceding log entry. Followers use the preceding index and term to detect disagreement and replace conflicting suffixes.\n\nRaft’s commitment rule contains an important qualification: a leader directly advances commitment by counting replicas for entries from its own current term. Once such an entry is committed, preceding entries become committed as well. Simply observing that an older-term entry appears on a majority is insufficient in all executions. This rule, together with election restrictions, prevents a future leader from discarding committed commands. Paxos and Raft thus express a common principle through different protocol structures: leadership changes must inherit durable agreement rather than create a fresh, incompatible history."
    },
    {
      "heading": "Byzantine agreement and cryptographic certificates",
      "text": "Byzantine fault-tolerant consensus addresses participants that may violate the protocol rather than merely stop. A malicious leader can send different proposed histories to different replicas, while dishonest voters can support incompatible proposals. Cryptography can authenticate messages and protect their integrity, but it cannot by itself prevent an authorized participant from signing contradictory statements. The protocol must ensure that such behavior cannot produce conflicting decisions within the assumed fault bound.\n\nMiguel Castro and Barbara Liskov’s Practical Byzantine Fault Tolerance, or PBFT, was published in 1999 and demonstrated a practical approach for replicated services. Its normal operation uses a primary and backup replicas, commonly with \\(3f+1\\) replicas to tolerate \\(f\\) Byzantine faults. Requests pass through pre-prepare, prepare, and commit stages. The prepare exchange establishes evidence about the ordering of a request, while the commit exchange ensures that enough correct replicas hold information needed to preserve that ordering through a change of primary.\n\nA view change is therefore more than electing a different coordinator. Replicas communicate evidence about prepared requests and stable checkpoints, and the new primary must construct a history consistent with that evidence. Without this transfer of constraints, a faulty primary could cause one group to make progress on one value and a later primary to complete a conflicting value. Byzantine protocols spend considerable complexity defining which certificates justify a lock, when a lock may be superseded, and which information must accompany a leadership transition.\n\nLater designs reorganized these mechanisms to reduce communication or improve behavior under wide-area conditions. HotStuff, presented in 2019, uses chained certificates and a leader-driven structure that can achieve linear communication per successful view when threshold-signature techniques are used as assumed. Tendermint organizes voting into rounds with proposal, prevote, and precommit stages, using locks to constrain subsequent votes. These protocols share the need for safe evidence transfer but differ in their round structure, leader replacement, and progress conditions.\n\nA quorum certificate is evidence that a specified voting threshold endorsed a statement. It may contain individual signatures or a compact aggregate or threshold signature, depending on the construction. A compact certificate reduces transmission and verification overhead, but the underlying votes still have to be collected. Key generation, validator admission, key compromise, and membership updates remain part of the security model. Moreover, Byzantine consensus only protects the agreed computation against the modeled faults: if every correct replica executes the same application bug, agreement faithfully reproduces the erroneous result rather than correcting it."
    },
    {
      "heading": "From decisions to replicated services and consistency",
      "text": "A single consensus instance chooses one value; a service usually needs a continuing sequence of operations. State machine replication connects these levels by agreeing on an ordered log and having each replica apply the same commands to the same initial state. If execution is deterministic, replicas that have applied the same log prefix reach the same state. A replicated key–value store might therefore agree that a write precedes a conditional update, ensuring that all correct replicas evaluate the condition against the same logical history.\n\nDeterminism has concrete implications. Commands cannot independently sample local clocks, random generators, or external services and still be expected to produce identical results. Such inputs must be agreed as part of the command, generated through a controlled protocol, or handled outside the replicated deterministic core. A finite-state machine in this context may have an enormous practical state space; the key property is reproducible state transition behavior, not a small number of states.\n\nConsensus is often used to implement linearizability, under which each operation appears to take effect at one instant between invocation and response, respecting real-time precedence. An ordered log alone does not automatically provide this property for every client interaction. In particular, a former leader isolated from a majority may still believe itself authoritative. If it answers reads from stale local state, those reads can violate linearizability even though no conflicting log entries commit.\n\nStrong reads therefore need an appropriate authority check. A leader may commit a log entry, confirm contact with a quorum, or use a lease whose timing assumptions establish that another leader cannot simultaneously serve authoritative operations. Read-index techniques allow some protocols to confirm leadership without appending a separate log record for every read, after the necessary current-term conditions are established. Lease-based methods can reduce communication, but clock drift, pauses, and lease expiration must be included in their correctness argument.\n\nClient semantics form another boundary. A command can commit even when the client times out, so retrying it may execute the same logical operation twice unless the service records request identifiers and prior results. “Exactly once” is consequently not an automatic property of consensus messages. Applications also differ in their consistency needs: some accept stale reads, while others permit independent updates that later merge. Consensus is valuable when a unique authoritative order is required, but it is not necessary for every form of replicated data. The CAP theorem describes a related constraint: during a network partition, a system cannot guarantee both linearizable behavior and a successful response to every request at every non-failing participant."
    },
    {
      "heading": "Transactions, membership changes, and system boundaries",
      "text": "Consensus and transaction processing solve related but distinct problems. Consensus establishes an agreed decision despite the modeled failures. Atomic commitment determines whether every participant in a distributed transaction commits or aborts, subject to transaction-specific validity conditions. In two-phase commit, a coordinator first collects participants’ preparedness to commit and then communicates the outcome. A participant that has prepared may need to wait if the coordinator fails and no authoritative decision is available, making ordinary two-phase commit a blocking protocol.\n\nReplicating the coordinator through consensus can preserve its decision across coordinator failures, but does not erase every source of transaction blocking. An unavailable participant may still be needed to determine whether its work was prepared, and transaction execution may depend on locks or other concurrency-control state. ACID properties also cover concerns beyond agreement: isolation constrains interactions among concurrent transactions, while durability concerns persistence. A correct consensus log can support these properties without, by itself, implementing all of them.\n\nLarge databases commonly divide data into shards, with each shard replicated by its own consensus group. A transaction touching one shard may use that group’s local ordering; a transaction spanning shards requires additional coordination. Google’s Spanner, described in 2012, combined Paxos-replicated groups, distributed transactions, and a clock-uncertainty interface called TrueTime. This architecture illustrates that replication agreement, cross-group commitment, concurrency control, and time-based ordering occupy different layers, even when they cooperate to expose a unified database interface.\n\nChanging the voting membership creates another agreement problem. If an old configuration and a new configuration independently allow disjoint majorities to decide, both may continue operating during a partition and produce incompatible histories. Safe reconfiguration must therefore connect authority across configurations. Raft’s joint-consensus approach uses an intermediate configuration in which decisions require the relevant majorities of both the old and new sets. Other protocols use different transition rules, but all must preserve the evidence on which earlier decisions depend.\n\nMembership changes also interact with recovery and external resources. A newly added replica must obtain a sufficiently current snapshot and log before it can safely contribute as intended. A removed leader may still have access to a storage device or external service, even though it can no longer commit entries. Fencing tokens address this boundary by attaching monotonically increasing authority numbers to operations; the external resource rejects operations carrying an obsolete number. Consensus can establish who is authorized, but that authority has practical effect only where downstream components enforce it."
    },
    {
      "heading": "Open-membership consensus and blockchains",
      "text": "Traditional consensus protocols generally assume an identifiable set of voting participants. An open peer-to-peer network cannot safely assign one vote to each network identity because a participant can create many identities. This Sybil attack makes admission and voting weight central to permissionless systems. Blockchain consensus therefore combines mechanisms for selecting or weighting participants with rules for choosing a common ledger history.\n\nBitcoin’s design, published under the name Satoshi Nakamoto in 2008 and deployed in 2009, uses proof of work. Miners repeatedly evaluate a cryptographic hash function while searching for a block header whose hash satisfies a difficulty target. Nodes independently validate blocks and select a valid chain according to accumulated proof of work. The relevant comparison is cumulative work, not merely the number of blocks, although these often coincide over short intervals.\n\nThis approach provides a different form of finality from a fixed-membership quorum certificate. Temporary forks can occur when different miners find blocks before learning about one another’s results. As more work accumulates above a transaction, reversing it generally becomes less likely under the protocol’s assumptions about adversarial resources and communication. This is probabilistic settlement, not an unconditional statement that a transaction can never be displaced after a particular number of confirmations. Network conditions and the adversary’s capabilities remain material.\n\nProof of stake instead assigns influence using stake recognized by the protocol. Many proof-of-stake systems combine weighted validator selection with Byzantine voting and explicit finality rules. Ethereum’s transition from proof of work to proof of stake occurred in September 2022. Its design separates a rule for selecting the chain head from checkpoint finality, illustrating that “consensus” can refer to several interacting mechanisms rather than one voting step.\n\nOpen-membership protocols introduce issues absent or less prominent in fixed clusters. Historical keys may support long-range attacks; stake can change ownership; penalties depend on what misconduct can be proved; and participants may need a trusted recent checkpoint under the protocol’s synchronization assumptions. Blockchain consensus also distinguishes transaction validity from transaction selection: agreement on a block does not mean every submitted transaction was included promptly or fairly. A system may preserve a common history while particular proposers delay certain valid transactions. Permissioned blockchains, by contrast, may use conventional Byzantine agreement among explicitly admitted organizations, without proof-of-work competition or unrestricted validator creation."
    },
    {
      "heading": "Performance, deployment, and operational failure",
      "text": "Consensus performance is shaped by communication dependencies rather than processor speed alone. A leader-based protocol normally waits for a qualifying set of acknowledgments before confirming a write. Its latency therefore includes network propagation, queuing, serialization, and whatever durable-storage operations the implementation requires before acknowledging. A deployment spread across continents gains geographical resilience but cannot avoid the propagation time of the quorum it must contact.\n\nThroughput and latency can be optimized differently. Batching combines many commands into one replicated entry or communication round, amortizing fixed costs while potentially increasing the waiting time for lightly loaded requests. Pipelining allows multiple entries to be in flight simultaneously. In steady-state leader-based replication, message volume often grows linearly with the number of replicas, while leader bandwidth, follower persistence, or application execution becomes the bottleneck. Protocols with all-to-all voting may incur quadratic message counts unless aggregation or other structural techniques reduce the exchange.\n\nA larger replica set does not necessarily increase throughput. Five majority-voting crash-tolerant replicas can tolerate two unavailable replicas, whereas three can tolerate one, but every additional replica also consumes replication and recovery resources. Placement matters as much as count. Several replicas on machines sharing one power domain, storage service, or network path do not represent independent failures. Cloud availability zones and regional placement help define deployment boundaries, but the actual failure dependencies must match the assumptions used to interpret the quorum.\n\nTimeouts govern responsiveness, not proof of failure. Very short election timeouts may cause repeated leadership changes during congestion or pauses. Very long timeouts delay recovery after a genuine crash. Randomized election timers can reduce simultaneous candidacies, but cannot guarantee progress under permanently adversarial delay. Load balancing and client routing also matter: sending every read to a distant leader may impose avoidable costs, while routing to arbitrary replicas requires clearly defined freshness guarantees.\n\nOperational recovery can threaten safety if it bypasses protocol rules. Restoring several replicas from incompatible snapshots, discarding persistent votes, or manually forming a new cluster while an old majority remains active can invalidate the original fault model. Snapshot transfer must bind application state to an agreed log position, and log compaction must retain enough information to preserve future decisions. Metrics therefore need to distinguish committed entries, applied entries, follower lag, leadership changes, and client-visible latency. A process that is alive and accepting connections may still be unable to participate in a quorum or serve an authoritative result."
    },
    {
      "heading": "Verification, testing, and continuing research",
      "text": "Consensus protocols are especially susceptible to errors that require unusual interleavings to expose. A design may work through many ordinary crashes yet fail when a leader changes during recovery, a delayed message crosses several terms, and a replica restarts from partially persisted state. Formal verification addresses this difficulty by expressing the protocol as a transition system and establishing invariants over all modeled executions. Typical invariants state that committed entries never conflict, accepted proposals constrain later choices, or a replica’s durable state never moves backward in a forbidden way.\n\nTools based on TLA+, proof assistants, and model checking support different levels of assurance. A bounded model checker can systematically explore small configurations and reveal subtle counterexamples, but bounded exploration alone is not a proof for arbitrary cluster sizes and unbounded executions. A mechanized proof can establish a general theorem under its stated model, although the theorem remains conditional on modeling assumptions. Proof assistants have been used to verify substantial distributed algorithms and implementations, including work on Raft.\n\nThe relationship between a proof and deployed code is a separate challenge. A correct abstract protocol may be implemented with an unsafe persistence order, integer overflow, an incorrectly reused identifier, or a snapshot mechanism that omits essential state. Verification efforts therefore increasingly address refinement: showing that lower-level implementation steps preserve the behavior of a higher-level specification. Storage, networking libraries, and operating-system interfaces can still introduce assumptions beyond the verified core.\n\nTesting complements proof rather than replacing it. Fault-injection systems introduce dropped or delayed messages, process crashes, partitions, and restarts. Recorded client histories can be checked against a sequential specification to detect linearizability violations. Deterministic simulation makes timing-dependent failures reproducible and allows systematic variation of event order. Such testing cannot establish correctness for every execution, but it is valuable for detecting mismatches between the intended model and the actual implementation, especially around recovery and client retry semantics.\n\nContinuing research examines lower latency, reduced communication, safe reconfiguration, adversarial scheduling, and stronger connections between specifications and production systems. Leaderless consensus and leader-independent dissemination seek to avoid concentrating all work on a single coordinator, sometimes using directed acyclic graphs to organize proposed data. Other designs separate data availability from ordering so that agreement messages need not repeatedly carry entire payloads. These approaches change bottlenecks rather than eliminate the underlying need for evidence of agreement. Their guarantees still depend on who may fail, what information remains available, which participants intersect, and when the network permits progress."
    }
  ],
  "links": [
    "distributed-computing",
    "database-replication",
    "algorithm",
    "digital-signature",
    "randomized-algorithm",
    "raft-consensus-algorithm",
    "cryptography",
    "finite-state-machine",
    "cap-theorem",
    "database-transaction",
    "acid-properties",
    "peer-to-peer",
    "sybil-attack",
    "cryptographic-hash-function",
    "cloud-computing",
    "load-balancing",
    "formal-verification",
    "proof-assistant",
    "operating-system"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}