{"eip":3436,"title":"Expanded Clique Block Choice Rule","description":"Add a four step block rule to Clique that should reduce block production deadlocks","authors":["Danno Ferrin (@shemnon)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2021-03-25","requires":[225],"discussionsTo":"https://ethereum-magicians.org/t/eip-3436-expanded-clique-block-choice-rule/5809","repo":"EIPs","label":"EIP-3436","officialUrl":"https://eips.ethereum.org/EIPS/eip-3436","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3436.md","url":"https://eips.huatuo.xyz/eip-3436/","tldr":{"en":"A deterministic four-step fork-choice tie-breaker for Clique proof-of-authority networks, meant to stop the chain halts seen on Goerli when validators split into equally weighted forks.","ja":"Clique のプルーフ・オブ・オーソリティ（PoA）ネットワーク向けの、決定論的な 4 段階のフォーク選択タイブレーカー。バリデーターが同じ重みのフォークに分裂したときに Goerli で見られたチェーン停止を防ぐことを目的とする。","ko":"Clique 권한 증명(PoA) 네트워크를 위한 결정론적 4단계 포크 선택 동점 처리 규칙. 검증자들이 같은 가중치의 포크로 갈라졌을 때 Goerli에서 나타난 체인 정지를 막는 것을 목표로 한다.","zh":"为 Clique 权威证明网络设计的确定性四步分叉选择平局决胜规则，旨在避免验证者分裂成权重相同的分叉时在 Goerli 上出现的链停摆。"},"tags":["clique","consensus","proof-of-authority","fork-choice","testnet"],"explainers":{"en":{"lang":"en","tldr":"A deterministic four-step fork-choice tie-breaker for Clique proof-of-authority networks, meant to stop the chain halts seen on Goerli when validators split into equally weighted forks.","tags":["clique","consensus","proof-of-authority","fork-choice","testnet"],"related":[225,3675],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3436/","markdown":"## What problem does it solve?\n\n[Clique](/eip-225/) is the proof-of-authority engine used by several Ethereum testnets and private networks. Signers take turns; an **in-turn** block has difficulty 2 and an out-of-turn block difficulty 1, and nodes follow the chain with the highest total difficulty.\n\nWhen two competing chain heads have the same total difficulty, the original spec says nothing more, so clients fell back to \"keep whichever I saw first\". On the multi-client Goerli testnet this caused real **deadlocks**: honest validators sat on two equally heavy forks, each refusing to switch, and the chain halted even though more than half of validators were online. One incident was resolved only when an offline validator came back.\n\nGeth already added a \"prefer the shorter chain\" rule, but the EIP shows a configuration where even that does not break the tie.\n\n## How it works\n\nWhen choosing between two chain heads, a Clique validator applies these rules in order:\n\n1. **Most total difficulty.**\n2. **Lowest block number** (the shorter chain, which implicitly has more in-turn blocks).\n3. **Validator whose in-turn slot is least recent.** Compute, and prefer the **largest** value of:\n\n   ```\n   (header_number - validator_index) % validator_count\n   ```\n\n   where `validator_index` is the signer's position in the sorted validator list. An in-turn block counts as the most recent. The idea is to decline the fork of the validator who will be in-turn soonest, freeing them to produce an in-turn block.\n4. **Lowest block hash**, interpreted as an unsigned 256-bit integer, as a final catch-all.\n\nBecause every step is deterministic, validators who see the same two heads always pick the same one. The rule degrades gracefully: if only some clients implement it, or implement only the higher-priority rules, behaviour is no worse than before.\n\n## Sample code\n\nThe choice rule as a comparison key (Python):\n\n```python\ndef clique_choice_key(head, validators):\n    \"\"\"Higher key wins. validators = signer addresses sorted as in epoch checkpoints.\"\"\"\n    n = len(validators)\n    idx = validators.index(head.signer)\n    recency = (head.number - idx) % n      # rule 3: larger = less recent in-turn\n    return (\n        head.total_difficulty,             # rule 1: more is better\n        -head.number,                      # rule 2: lower number is better\n        recency,                           # rule 3\n        -int.from_bytes(head.hash, \"big\"), # rule 4: lower hash is better\n    )\n\ndef choose(a, b, validators):\n    return a if clique_choice_key(a, validators) \u003e= clique_choice_key(b, validators) else b\n```\n\n## Things to know\n\n- **Status: Stagnant.** It was not finalized as a change to the Clique spec.\n- A deterministic lowest-hash tiebreak makes it somewhat easier for a malicious validator to produce a replacement block; the author judged this impact low.\n- Clique only matters for proof-of-authority networks. Ethereum mainnet moved to proof-of-stake with [EIP-3675](/eip-3675/), and Goerli, the network that motivated this EIP, has since been deprecated.\n"},"ja":{"lang":"ja","tldr":"Clique のプルーフ・オブ・オーソリティ（PoA）ネットワーク向けの、決定論的な 4 段階のフォーク選択タイブレーカー。バリデーターが同じ重みのフォークに分裂したときに Goerli で見られたチェーン停止を防ぐことを目的とする。","tags":["clique","consensus","proof-of-authority","fork-choice","testnet"],"related":[225,3675],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3436/","markdown":"## 何を解決するのか\n\n[Clique](/eip-225/) は、複数の Ethereum テストネットやプライベートネットワークで使われるプルーフ・オブ・オーソリティのエンジンです。署名者は順番に担当します。**自分の番（in-turn）** のブロックの difficulty は 2、番外（out-of-turn）のブロックは 1 で、ノードは合計 difficulty が最大のチェーンに従います。\n\n競合する 2 つのチェーン先頭の合計 difficulty が同じ場合、元の仕様はそれ以上何も定めておらず、クライアントは「先に見たほうを保つ」に頼っていました。複数クライアントが動く Goerli テストネットでは、これが実際の**デッドロック**を引き起こしました。正直なバリデーターが同じ重さの 2 つのフォークに分かれ、どちらも切り替えを拒み、半数を超えるバリデーターがオンラインだったにもかかわらずチェーンが停止したのです。ある事案は、オフラインだったバリデーターが復帰して初めて解消しました。\n\nGeth はすでに「短いチェーンを優先する」ルールを追加していますが、この EIP は、それでも決着がつかない構成を示しています。\n\n## 仕組み\n\n2 つのチェーン先頭のどちらかを選ぶとき、Clique のバリデーターは次のルールを順に適用します。\n\n1. **合計 difficulty が最大のもの。**\n2. **ブロック番号が最小のもの**（短いチェーン。暗黙的に in-turn ブロックの比率が高い）。\n3. **自分の番のスロットが最も古いバリデーターのもの。** 次の値を計算し、その**最大**値を優先します。\n\n   ```\n   (header_number - validator_index) % validator_count\n   ```\n\n   ここで `validator_index` は、ソートされたバリデーターリスト内での署名者の位置です。in-turn のブロックは最も新しいものとして数えます。狙いは、もうすぐ自分の番が来るバリデーターのフォークを退けて、その人が in-turn ブロックを作れるようにすることです。\n4. **ブロックハッシュが最小のもの。** 符号なし 256 ビット整数として解釈し、最後の受け皿とします。\n\nすべての手順が決定論的なので、同じ 2 つの先頭を見たバリデーターは常に同じほうを選びます。このルールは段階的に劣化します。一部のクライアントしか実装していない、あるいは優先度の高いルールだけを実装している場合でも、動作は以前より悪くなりません。\n\n## サンプルコード\n\n選択ルールを比較キーとして表現したもの（Python）:\n\n```python\ndef clique_choice_key(head, validators):\n    \"\"\"Higher key wins. validators = signer addresses sorted as in epoch checkpoints.\"\"\"\n    n = len(validators)\n    idx = validators.index(head.signer)\n    recency = (head.number - idx) % n      # rule 3: larger = less recent in-turn\n    return (\n        head.total_difficulty,             # rule 1: more is better\n        -head.number,                      # rule 2: lower number is better\n        recency,                           # rule 3\n        -int.from_bytes(head.hash, \"big\"), # rule 4: lower hash is better\n    )\n\ndef choose(a, b, validators):\n    return a if clique_choice_key(a, validators) \u003e= clique_choice_key(b, validators) else b\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant（停滞）。** Clique 仕様の変更として確定しませんでした。\n- ハッシュ最小による決定論的なタイブレークは、悪意のあるバリデーターが置き換えブロックを作ることをやや容易にします。著者はこの影響を小さいと判断しました。\n- Clique が重要なのはプルーフ・オブ・オーソリティのネットワークだけです。Ethereum メインネットは [EIP-3675](/eip-3675/) でプルーフ・オブ・ステークへ移行し、この EIP のきっかけとなった Goerli も、その後廃止されました。\n"},"ko":{"lang":"ko","tldr":"Clique 권한 증명(PoA) 네트워크를 위한 결정론적 4단계 포크 선택 동점 처리 규칙. 검증자들이 같은 가중치의 포크로 갈라졌을 때 Goerli에서 나타난 체인 정지를 막는 것을 목표로 한다.","tags":["clique","consensus","proof-of-authority","fork-choice","testnet"],"related":[225,3675],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3436/","markdown":"## 어떤 문제를 해결하나요?\n\n[Clique](/eip-225/)는 여러 이더리움 테스트넷과 프라이빗 네트워크가 쓰는 권한 증명 엔진입니다. 서명자들이 번갈아 가며 블록을 만들고, **자기 차례(in-turn)** 의 블록은 난이도가 2, 차례가 아닌(out-of-turn) 블록은 난이도가 1이며, 노드는 총 난이도가 가장 높은 체인을 따릅니다.\n\n경쟁하는 두 체인 헤드의 총 난이도가 같을 때 원래 명세는 더 이상 아무것도 정하지 않았고, 클라이언트들은 \"먼저 본 것을 유지\"하는 방식으로 대응했습니다. 여러 클라이언트가 도는 Goerli 테스트넷에서 이것이 실제 **교착 상태**를 일으켰습니다. 정직한 검증자들이 똑같이 무거운 두 포크에 나뉘어 각자 전환을 거부했고, 검증자의 절반 이상이 온라인이었는데도 체인이 멈췄습니다. 한 사건은 오프라인이던 검증자가 돌아와서야 해결되었습니다.\n\nGeth는 이미 \"더 짧은 체인을 선호\"하는 규칙을 추가했지만, 이 EIP는 그 규칙으로도 동점이 깨지지 않는 구성을 보여 줍니다.\n\n## 어떻게 동작하나요?\n\n두 체인 헤드 중에서 고를 때 Clique 검증자는 다음 규칙을 순서대로 적용합니다.\n\n1. **총 난이도가 가장 큰 것.**\n2. **블록 번호가 가장 낮은 것**(더 짧은 체인으로, 암묵적으로 in-turn 블록이 더 많음).\n3. **자기 차례 슬롯이 가장 오래된 검증자의 것.** 다음 값을 계산하여 **가장 큰** 값을 선호합니다.\n\n   ```\n   (header_number - validator_index) % validator_count\n   ```\n\n   여기서 `validator_index`는 정렬된 검증자 목록에서 서명자의 위치입니다. in-turn 블록은 가장 최근인 것으로 칩니다. 곧 자기 차례가 올 검증자의 포크를 거부해서 그 검증자가 in-turn 블록을 만들 수 있게 하자는 발상입니다.\n4. **블록 해시가 가장 낮은 것.** 부호 없는 256비트 정수로 해석하며, 마지막 보루입니다.\n\n모든 단계가 결정론적이므로 같은 두 헤드를 본 검증자들은 항상 같은 쪽을 고릅니다. 이 규칙은 점진적으로 열화됩니다. 일부 클라이언트만 구현했거나 우선순위가 높은 규칙만 구현했더라도 동작은 이전보다 나빠지지 않습니다.\n\n## 샘플 코드\n\n선택 규칙을 비교 키로 표현한 것(Python):\n\n```python\ndef clique_choice_key(head, validators):\n    \"\"\"Higher key wins. validators = signer addresses sorted as in epoch checkpoints.\"\"\"\n    n = len(validators)\n    idx = validators.index(head.signer)\n    recency = (head.number - idx) % n      # rule 3: larger = less recent in-turn\n    return (\n        head.total_difficulty,             # rule 1: more is better\n        -head.number,                      # rule 2: lower number is better\n        recency,                           # rule 3\n        -int.from_bytes(head.hash, \"big\"), # rule 4: lower hash is better\n    )\n\ndef choose(a, b, validators):\n    return a if clique_choice_key(a, validators) \u003e= clique_choice_key(b, validators) else b\n```\n\n## 알아둘 점\n\n- **상태: Stagnant(정체).** Clique 명세의 변경으로 확정되지 않았습니다.\n- 결정론적인 최저 해시 동점 처리는 악의적인 검증자가 대체 블록을 만들기 다소 쉽게 합니다. 저자는 이 영향이 작다고 판단했습니다.\n- Clique는 권한 증명 네트워크에서만 의미가 있습니다. 이더리움 메인넷은 [EIP-3675](/eip-3675/)로 지분 증명으로 옮겨 갔고, 이 EIP의 계기가 된 Goerli도 이후 지원이 중단되었습니다.\n"},"zh":{"lang":"zh","tldr":"为 Clique 权威证明网络设计的确定性四步分叉选择平局决胜规则，旨在避免验证者分裂成权重相同的分叉时在 Goerli 上出现的链停摆。","tags":["clique","consensus","proof-of-authority","fork-choice","testnet"],"related":[225,3675],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3436/","markdown":"## 它解决什么问题？\n\n[Clique](/eip-225/) 是几个以太坊测试网和私有网络使用的权威证明共识引擎。签名者轮流出块；**轮到自己（in-turn）** 的区块难度为 2，非轮次（out-of-turn）的区块难度为 1，节点跟随总难度最高的链。\n\n当两个互相竞争的链头总难度相同时，原始规范没有再说明什么，因此客户端退而采用\"保留我先看到的那个\"。在多客户端的 Goerli 测试网上，这导致了真实的**死锁**：诚实的验证者分处两个同样重的分叉，各自拒绝切换，即使超过一半的验证者在线，链也停摆了。其中一次事件直到一个离线的验证者重新上线才得以解决。\n\nGeth 已经加入了\"优先选择较短的链\"的规则，但该 EIP 展示了一种连这条规则也无法打破平局的配置。\n\n## 它如何运作\n\n在两个链头之间做选择时，Clique 验证者依次应用以下规则：\n\n1. **总难度最大。**\n2. **区块号最小**（较短的链，隐含着更多 in-turn 区块）。\n3. **in-turn 时隙最不近的验证者。** 计算下面的值，并优先选择其**最大**者：\n\n   ```\n   (header_number - validator_index) % validator_count\n   ```\n\n   其中 `validator_index` 是签名者在排序后的验证者列表中的位置。in-turn 区块算作最近的。其思路是拒绝即将轮到的那个验证者的分叉，让他能够产出 in-turn 区块。\n4. **区块哈希最小**，按无符号 256 位整数解释，作为最后的兜底。\n\n由于每一步都是确定性的，看到同样两个链头的验证者总会选出同一个。该规则可以平滑降级：如果只有部分客户端实现了它，或者只实现了较高优先级的规则，行为也不会比以前更差。\n\n## 示例代码\n\n把选择规则表示为比较键（Python）：\n\n```python\ndef clique_choice_key(head, validators):\n    \"\"\"Higher key wins. validators = signer addresses sorted as in epoch checkpoints.\"\"\"\n    n = len(validators)\n    idx = validators.index(head.signer)\n    recency = (head.number - idx) % n      # rule 3: larger = less recent in-turn\n    return (\n        head.total_difficulty,             # rule 1: more is better\n        -head.number,                      # rule 2: lower number is better\n        recency,                           # rule 3\n        -int.from_bytes(head.hash, \"big\"), # rule 4: lower hash is better\n    )\n\ndef choose(a, b, validators):\n    return a if clique_choice_key(a, validators) \u003e= clique_choice_key(b, validators) else b\n```\n\n## 需要注意\n\n- **状态：Stagnant（停滞）。** 它没有被最终确定为对 Clique 规范的修改。\n- 确定性的最低哈希平局决胜规则，使恶意验证者更容易产出一个替换区块；作者判断这一影响较小。\n- Clique 只对权威证明网络有意义。以太坊主网已经通过 [EIP-3675](/eip-3675/) 转向权益证明，而催生该 EIP 的 Goerli 网络此后也已被弃用。\n"}}}
