{"eip":8310,"title":"Post-Quantum Keystore for Stateful Keys","description":"A keystore format for XMSS and other consumable signing keys, defining state authority, durability ordering, and safe import/export.","authors":["Anshal Shukla (@anshalshukla)","Benedikt Wagner (@benedikt-wagner)","Gajinder Singh (@g11tech)","Guillaume Ballet (@gballet)","Justin Drake (@JustinDrake)","Kolby Moroz Liebl (@KolbyML)","Parthasarathy Ramanujam (@ch4r10t33r)","Shariq Naiyer (@shariqnaiyer)","Thomas Coratger (@tcoratger)","Unnawut Leepaisalsuwanna (@unnawut)"],"status":"Draft","type":"Standards Track","category":"Interface","created":"2026-06-19","requires":[2335,3076],"discussionsTo":"https://ethereum-magicians.org/t/eip-8310-post-quantum-keystore-for-stateful-keys/28853","repo":"EIPs","label":"EIP-8310","officialUrl":"https://eips.ethereum.org/EIPS/eip-8310","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8310.md","url":"https://eips.huatuo.xyz/eip-8310/","tldr":{"en":"A keystore format (version 5) for post-quantum XMSS validator keys that can only sign each leaf once, with strict rules on where signing state lives and how keys are backed up and restored.","ja":"各リーフに一度しか署名できないポスト量子 XMSS バリデーター鍵のためのキーストア形式（バージョン 5）。署名状態の置き場所や、鍵のバックアップと復元の方法について厳格なルールを定める。","ko":"각 리프에 한 번만 서명할 수 있는 양자 내성 XMSS 검증자 키를 위한 키스토어 형식(버전 5). 서명 상태를 어디에 두는지, 키를 어떻게 백업하고 복원하는지에 대해 엄격한 규칙을 둔다.","zh":"适用于后量子 XMSS 验证者密钥的 keystore 格式（版本 5），这类密钥每个叶子只能签名一次，并对签名状态存放在何处、密钥如何备份和恢复作出严格规定。"},"tags":["post-quantum","keystore","xmss","validators","staking"],"explainers":{"en":{"lang":"en","tldr":"A keystore format (version 5) for post-quantum XMSS validator keys that can only sign each leaf once, with strict rules on where signing state lives and how keys are backed up and restored.","tags":["post-quantum","keystore","xmss","validators","staking"],"related":[2335,3076],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8310/","markdown":"## What problem does it solve?\n\nValidators today store BLS keys in [ERC-2335](/eip-2335/) keystores. Those keys are **reusable**: the file never changes, can be copied to another machine, and can be restored from any backup.\n\nLean Ethereum plans to replace BLS with **XMSS**, a hash-based, post-quantum signature scheme. XMSS keys are **consumable**: every signature uses a one-time leaf, and signing two different messages with the same leaf lets an attacker forge signatures, destroying the key, possibly with no visible on-chain penalty. Copying the key to two machines, or restoring an old backup, becomes dangerous. EIP-8310 keeps the 2335 container but adds the state-management rules a consumable key needs.\n\n## How it works\n\n- **Version 5 keystore.** Cipher must be AES-256 class (`aes-256-gcm` recommended; `aes-128-ctr` forbidden), and `argon2id` is allowed as a KDF. The encrypted payload is the XMSS **seed**, not live signing state.\n- **`scheme` object.** Immutable parameters needed to regenerate the public key and verify signatures: scheme name (`leanxmss`), hash identifier, tree height, encoding, Winternitz base, dimension, target sum, `index_mode` and lifetime. Readers must refuse unknown schemes.\n- **`state` snapshot.** Shows capacity and high-water mark for operators, but must always say `\"authoritative\": false`. It is never used when signing.\n- **Where the real state lives.** In *synchronized* mode the leaf is derived from the epoch or slot, so the [EIP-3076](/eip-3076/) slashing-protection database is authoritative: \"never double-sign a slot\" equals \"never reuse a leaf\", and key and history must move together. In *counter* mode (off-protocol signing such as builder bids) a dedicated atomic store keyed by keystore UUID holds the counter.\n- **Commit before sign.** The advanced high-water mark must be durably written (flushed and atomically committed) before a signature is released, so a crash can never cause reuse.\n- **Reserved ranges.** The leaf space can be split into disjoint ranges, each owned by one signer instance, for concurrent signers. Exhausting a range means refusing to sign.\n- **Recover vs. resume.** Recovering the key from the seed is always safe; resuming signing needs the latest authoritative state. Importing with empty state is a hard error, and a detected high-water regression blocks signing.\n\n## Sample code\n\nShape of a v5 keystore (other ERC-2335 fields such as `crypto`, `pubkey`, `uuid` omitted):\n\n```json\n{\n  \"version\": 5,\n  \"scheme\": {\n    \"name\": \"leanxmss\",\n    \"params\": {\n      \"hash\": \"\u003chash identifier\u003e\",\n      \"tree_height\": 32, \"hypertree_layers\": 1,\n      \"encoding\": \"target_sum\", \"winternitz_w\": 8, \"dimension\": 46, \"target_sum\": 200,\n      \"index_mode\": \"synchronized\", \"activation_epoch\": 0, \"lifetime_leaves\": 4294967296\n    }\n  },\n  \"state\": {\n    \"authoritative\": false,\n    \"authority\": \"slashing-protection\",\n    \"high_water\": 12345,\n    \"reserved_ranges\": []\n  }\n}\n```\n\nCommit-before-sign ordering:\n\n```python\ndef sign(msg, leaf):\n    hw = store.high_water()            # authoritative store, never the file\n    if leaf \u003c= hw:\n        raise RefuseToSign(\"leaf reuse\")\n    store.write_and_fsync(leaf)        # durable before release\n    sig = xmss_sign(seed, leaf, msg)\n    return sig\n```\n\n## Things to know\n\n- **Status: Draft** (category: Interface). Test cases and a reference implementation are still marked \"to be added\", and the concrete hash function (for example Poseidon over KoalaBear) is still under evaluation.\n- v5 is not readable by v4 tools, by design: a v5-aware client must never treat a consumable key as a reusable one.\n- The biggest operational risk is restoring a stale backup and signing. Back up the seed, but always reconcile with the latest state before resuming.\n- Keys have finite capacity (for example 2^32 leaves with these parameters); monitor remaining leaves.\n"},"ja":{"lang":"ja","tldr":"各リーフに一度しか署名できないポスト量子 XMSS バリデーター鍵のためのキーストア形式（バージョン 5）。署名状態の置き場所や、鍵のバックアップと復元の方法について厳格なルールを定める。","tags":["post-quantum","keystore","xmss","validators","staking"],"related":[2335,3076],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8310/","markdown":"## 何を解決するのか\n\n現在のバリデーターは BLS 鍵を [ERC-2335](/eip-2335/) のキーストアに保存しています。これらの鍵は**再利用可能**です。ファイルは変化せず、別のマシンにコピーでき、どのバックアップからでも復元できます。\n\nLean Ethereum は、BLS をハッシュベースのポスト量子署名方式である **XMSS** に置き換える計画です。XMSS 鍵は**消費型**です。署名のたびに使い捨てのリーフを使い、同じリーフで 2 つの異なるメッセージに署名すると、攻撃者が署名を偽造でき、鍵が破壊されます。しかも、オンチェーンで目に見えるペナルティがない場合もあります。鍵を 2 台のマシンにコピーしたり、古いバックアップを復元したりすることが危険になります。EIP-8310 は 2335 のコンテナを維持しつつ、消費型の鍵に必要な状態管理のルールを追加します。\n\n## 仕組み\n\n- **バージョン 5 のキーストア。** 暗号は AES-256 クラスでなければならず（`aes-256-gcm` を推奨、`aes-128-ctr` は禁止）、KDF として `argon2id` が許可されます。暗号化されるペイロードは XMSS の**シード**であり、実際の署名状態ではありません。\n- **`scheme` オブジェクト。** 公開鍵の再生成と署名の検証に必要な不変のパラメーターです。方式名（`leanxmss`）、ハッシュ識別子、ツリーの高さ、エンコーディング、Winternitz の底、次元、ターゲットサム、`index_mode`、有効期間です。リーダーは未知の方式を拒否しなければなりません。\n- **`state` スナップショット。** オペレーター向けに容量とハイウォーターマークを示しますが、常に `\"authoritative\": false` と記さなければなりません。署名時には決して使われません。\n- **本当の状態の置き場所。** *同期*モードでは、リーフがエポックまたはスロットから導出されるため、[EIP-3076](/eip-3076/) のスラッシング防止データベースが正（authoritative）となります。「スロットに二重署名しない」は「リーフを再利用しない」に等しく、鍵と履歴は一緒に移動しなければなりません。*カウンター*モード（ビルダー入札などプロトコル外の署名）では、キーストアの UUID をキーとする専用のアトミックストアがカウンターを保持します。\n- **署名の前にコミット。** 進めたハイウォーターマークは、署名を出す前に永続的に書き込まれ（フラッシュされ、アトミックにコミットされ）なければなりません。そのため、クラッシュしてもリーフの再利用は起こりえません。\n- **予約範囲。** リーフ空間は互いに重ならない範囲に分割でき、各範囲を 1 つの署名者インスタンスが所有することで、並行する署名者に対応します。範囲を使い切った場合は署名を拒否します。\n- **復旧と再開。** シードからの鍵の復旧は常に安全ですが、署名の再開には最新の正しい状態が必要です。空の状態でのインポートは致命的なエラーであり、ハイウォーターの後退を検出すると署名がブロックされます。\n\n## サンプルコード\n\nv5 キーストアの形（`crypto`、`pubkey`、`uuid` など、ERC-2335 の他のフィールドは省略）:\n\n```json\n{\n  \"version\": 5,\n  \"scheme\": {\n    \"name\": \"leanxmss\",\n    \"params\": {\n      \"hash\": \"\u003chash identifier\u003e\",\n      \"tree_height\": 32, \"hypertree_layers\": 1,\n      \"encoding\": \"target_sum\", \"winternitz_w\": 8, \"dimension\": 46, \"target_sum\": 200,\n      \"index_mode\": \"synchronized\", \"activation_epoch\": 0, \"lifetime_leaves\": 4294967296\n    }\n  },\n  \"state\": {\n    \"authoritative\": false,\n    \"authority\": \"slashing-protection\",\n    \"high_water\": 12345,\n    \"reserved_ranges\": []\n  }\n}\n```\n\n署名前コミットの順序:\n\n```python\ndef sign(msg, leaf):\n    hw = store.high_water()            # authoritative store, never the file\n    if leaf \u003c= hw:\n        raise RefuseToSign(\"leaf reuse\")\n    store.write_and_fsync(leaf)        # durable before release\n    sig = xmss_sign(seed, leaf, msg)\n    return sig\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft**（カテゴリ: Interface）。テストケースとリファレンス実装は「追加予定」のままで、具体的なハッシュ関数（たとえば KoalaBear 上の Poseidon）はまだ評価中です。\n- v5 は設計上、v4 のツールでは読めません。v5 に対応したクライアントは、消費型の鍵を再利用可能な鍵として扱ってはなりません。\n- 運用上の最大のリスクは、古いバックアップを復元して署名してしまうことです。シードはバックアップしておき、署名を再開する前に必ず最新の状態と突き合わせてください。\n- 鍵の容量は有限です（このパラメーターでは 2^32 リーフなど）。残りのリーフ数を監視してください。\n"},"ko":{"lang":"ko","tldr":"각 리프에 한 번만 서명할 수 있는 양자 내성 XMSS 검증자 키를 위한 키스토어 형식(버전 5). 서명 상태를 어디에 두는지, 키를 어떻게 백업하고 복원하는지에 대해 엄격한 규칙을 둔다.","tags":["post-quantum","keystore","xmss","validators","staking"],"related":[2335,3076],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8310/","markdown":"## 어떤 문제를 해결하나요?\n\n오늘날 검증자는 BLS 키를 [ERC-2335](/eip-2335/) 키스토어에 보관합니다. 이 키들은 **재사용 가능**합니다. 파일은 바뀌지 않고, 다른 머신으로 복사할 수 있으며, 어떤 백업에서든 복원할 수 있습니다.\n\nLean Ethereum은 BLS를 해시 기반 양자 내성 서명 방식인 **XMSS**로 대체할 계획입니다. XMSS 키는 **소모형**입니다. 서명마다 일회용 리프를 쓰며, 같은 리프로 서로 다른 두 메시지에 서명하면 공격자가 서명을 위조할 수 있어 키가 파괴됩니다. 온체인에서 눈에 보이는 페널티가 없을 수도 있습니다. 키를 두 머신에 복사하거나 오래된 백업을 복원하는 일이 위험해집니다. EIP-8310은 2335 컨테이너를 유지하면서 소모형 키에 필요한 상태 관리 규칙을 추가합니다.\n\n## 어떻게 동작하나요?\n\n- **버전 5 키스토어.** 암호는 AES-256 급이어야 하며(`aes-256-gcm` 권장, `aes-128-ctr` 금지), KDF로 `argon2id`를 쓸 수 있습니다. 암호화되는 페이로드는 실시간 서명 상태가 아니라 XMSS **시드**입니다.\n- **`scheme` 객체.** 공개 키를 재생성하고 서명을 검증하는 데 필요한 불변 매개변수입니다. 방식 이름(`leanxmss`), 해시 식별자, 트리 높이, 인코딩, Winternitz 밑, 차원, 타깃 합, `index_mode`, 수명이 들어 있습니다. 리더는 알 수 없는 방식을 거부해야 합니다.\n- **`state` 스냅숏.** 운영자에게 용량과 하이워터 마크를 보여 주지만 항상 `\"authoritative\": false`라고 적어야 합니다. 서명할 때는 절대 사용되지 않습니다.\n- **진짜 상태는 어디에 있나.** *동기화* 모드에서는 리프가 에포크나 슬롯에서 도출되므로 [EIP-3076](/eip-3076/) 슬래싱 방지 데이터베이스가 권위를 가집니다. \"슬롯에 이중 서명하지 않는다\"는 \"리프를 재사용하지 않는다\"와 같고, 키와 이력은 함께 이동해야 합니다. *카운터* 모드(빌더 입찰 같은 프로토콜 외 서명)에서는 키스토어 UUID를 키로 하는 전용 원자적 저장소가 카운터를 보관합니다.\n- **서명 전에 커밋.** 올린 하이워터 마크는 서명이 나가기 전에 영속적으로 기록(플러시하고 원자적으로 커밋)되어야 하므로, 크래시가 나도 재사용이 생길 수 없습니다.\n- **예약 범위.** 리프 공간은 서로 겹치지 않는 범위로 나눌 수 있으며, 각 범위는 서명자 인스턴스 하나가 소유해 동시 서명자를 지원합니다. 범위를 다 쓰면 서명을 거부한다는 뜻입니다.\n- **복구 대 재개.** 시드에서 키를 복구하는 것은 항상 안전하지만, 서명을 재개하려면 최신의 권위 있는 상태가 필요합니다. 빈 상태로 가져오는 것은 치명적 오류이며, 하이워터 후퇴가 감지되면 서명이 차단됩니다.\n\n## 샘플 코드\n\nv5 키스토어의 형태(`crypto`, `pubkey`, `uuid` 등 ERC-2335의 다른 필드는 생략):\n\n```json\n{\n  \"version\": 5,\n  \"scheme\": {\n    \"name\": \"leanxmss\",\n    \"params\": {\n      \"hash\": \"\u003chash identifier\u003e\",\n      \"tree_height\": 32, \"hypertree_layers\": 1,\n      \"encoding\": \"target_sum\", \"winternitz_w\": 8, \"dimension\": 46, \"target_sum\": 200,\n      \"index_mode\": \"synchronized\", \"activation_epoch\": 0, \"lifetime_leaves\": 4294967296\n    }\n  },\n  \"state\": {\n    \"authoritative\": false,\n    \"authority\": \"slashing-protection\",\n    \"high_water\": 12345,\n    \"reserved_ranges\": []\n  }\n}\n```\n\n서명 전 커밋 순서:\n\n```python\ndef sign(msg, leaf):\n    hw = store.high_water()            # authoritative store, never the file\n    if leaf \u003c= hw:\n        raise RefuseToSign(\"leaf reuse\")\n    store.write_and_fsync(leaf)        # durable before release\n    sig = xmss_sign(seed, leaf, msg)\n    return sig\n```\n\n## 알아둘 점\n\n- **상태: Draft**(카테고리: Interface). 테스트 케이스와 레퍼런스 구현은 아직 \"추가 예정\"으로 표시되어 있으며, 구체적인 해시 함수(예: KoalaBear 위의 Poseidon)는 아직 평가 중입니다.\n- v5는 설계상 v4 도구에서 읽을 수 없습니다. v5를 인식하는 클라이언트는 소모형 키를 재사용 가능한 키로 취급해서는 안 됩니다.\n- 운영상 가장 큰 위험은 오래된 백업을 복원하고 서명하는 것입니다. 시드는 백업해 두되, 서명을 재개하기 전에 항상 최신 상태와 대조하세요.\n- 키의 용량은 유한합니다(이 매개변수에서는 예를 들어 2^32 리프). 남은 리프를 모니터링하세요.\n"},"zh":{"lang":"zh","tldr":"适用于后量子 XMSS 验证者密钥的 keystore 格式（版本 5），这类密钥每个叶子只能签名一次，并对签名状态存放在何处、密钥如何备份和恢复作出严格规定。","tags":["post-quantum","keystore","xmss","validators","staking"],"related":[2335,3076],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8310/","markdown":"## 它解决什么问题？\n\n如今的验证者把 BLS 密钥存放在 [ERC-2335](/eip-2335/) keystore 中。这些密钥是**可重复使用的**：文件永远不变，可以复制到另一台机器，也可以从任何备份中恢复。\n\nLean Ethereum 计划用 **XMSS** 取代 BLS，这是一种基于哈希的后量子签名方案。XMSS 密钥是**消耗型的**：每次签名都使用一个一次性叶子，用同一个叶子对两条不同的消息签名，攻击者就能伪造签名，从而毁掉该密钥，而且链上可能没有任何可见的惩罚。把密钥复制到两台机器，或者恢复旧备份，都会变得危险。EIP-8310 保留了 2335 的容器，但增加了消耗型密钥所需的状态管理规则。\n\n## 它如何运作\n\n- **版本 5 keystore。** 加密算法必须是 AES-256 级别（推荐 `aes-256-gcm`；禁止 `aes-128-ctr`），允许使用 `argon2id` 作为 KDF。被加密的负载是 XMSS **种子**，而不是实时的签名状态。\n- **`scheme` 对象。** 重新生成公钥和验证签名所需的不可变参数：方案名称（`leanxmss`）、哈希标识符、树高、编码、Winternitz 基数、维度、目标和、`index_mode` 以及生命周期。读取方必须拒绝未知的方案。\n- **`state` 快照。** 为运营者显示容量和高水位线，但必须始终写明 `\"authoritative\": false`。签名时永远不会使用它。\n- **真正的状态存放在哪里。** 在*同步*模式下，叶子由 epoch 或 slot 推导，因此 [EIP-3076](/eip-3076/) 的罚没保护数据库是权威的：“永不对同一 slot 双重签名”等同于“永不重用叶子”，密钥和历史必须一起迁移。在*计数器*模式（协议外的签名，如构建者出价）下，由一个以 keystore UUID 为键的专用原子存储保存计数器。\n- **先提交再签名。** 推进后的高水位线必须在签名发出之前被持久写入（刷盘并原子提交），这样崩溃永远不会导致重用。\n- **预留范围。** 叶子空间可以拆分成互不相交的范围，每个范围由一个签名者实例拥有，以支持并发签名者。用尽某个范围意味着拒绝签名。\n- **恢复与继续。** 从种子恢复密钥始终是安全的；继续签名则需要最新的权威状态。用空状态导入是硬性错误，检测到高水位线回退则会阻止签名。\n\n## 示例代码\n\nv5 keystore 的结构（省略 `crypto`、`pubkey`、`uuid` 等其他 ERC-2335 字段）：\n\n```json\n{\n  \"version\": 5,\n  \"scheme\": {\n    \"name\": \"leanxmss\",\n    \"params\": {\n      \"hash\": \"\u003chash identifier\u003e\",\n      \"tree_height\": 32, \"hypertree_layers\": 1,\n      \"encoding\": \"target_sum\", \"winternitz_w\": 8, \"dimension\": 46, \"target_sum\": 200,\n      \"index_mode\": \"synchronized\", \"activation_epoch\": 0, \"lifetime_leaves\": 4294967296\n    }\n  },\n  \"state\": {\n    \"authoritative\": false,\n    \"authority\": \"slashing-protection\",\n    \"high_water\": 12345,\n    \"reserved_ranges\": []\n  }\n}\n```\n\n先提交再签名的顺序：\n\n```python\ndef sign(msg, leaf):\n    hw = store.high_water()            # authoritative store, never the file\n    if leaf \u003c= hw:\n        raise RefuseToSign(\"leaf reuse\")\n    store.write_and_fsync(leaf)        # durable before release\n    sig = xmss_sign(seed, leaf, msg)\n    return sig\n```\n\n## 需要注意\n\n- **状态：Draft**（类别：Interface）。测试用例和参考实现仍标记为“待添加”，具体的哈希函数（例如 KoalaBear 上的 Poseidon）仍在评估中。\n- v5 按设计不能被 v4 工具读取：支持 v5 的客户端绝不能把消耗型密钥当作可重复使用的密钥。\n- 最大的运维风险是恢复了过期的备份并进行签名。请备份种子，但在继续签名之前务必与最新状态核对。\n- 密钥的容量有限（例如这些参数下为 2^32 个叶子）；请监控剩余的叶子数。\n"}}}
