{"eip":7908,"title":"HD wallet In Treasury Management","description":"Hierarchical deterministic (HD) wallets for treasury systems, isolating entities via cryptographic key paths.","authors":["Xiaoyu Liu (@elizabethxiaoyu) \u003cjiushi.lxy@antgroup.com\u003e","Yuxiang Fu (@tmac4096) \u003ckunfu.fyx@antgroup.com\u003e","Yanyi Liang \u003ceason.lyy@antgroup.com\u003e","Hao Zou (@BruceZH0915) \u003csitu.zh@antgroup.com\u003e","Siyuan Zheng (@andrewcoder666) \u003czhengsiyuan.zsy@antgroup.com\u003e","yuanshanhshan (@xunayuan) \u003cyuanshanshan.yss@antgroup.com\u003e"],"status":"Final","type":"Standards Track","category":"ERC","created":"2025-03-07","discussionsTo":"https://ethereum-magicians.org/t/new-erc-deterministic-account-hierarchy-in-treasury-management/23073","repo":"ERCs","label":"ERC-7908","officialUrl":"https://eips.ethereum.org/EIPS/eip-7908","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7908.md","url":"https://eips.huatuo.xyz/eip-7908/","tldr":{"en":"A BIP-44-style HD derivation path for institutional treasuries that gives each subsidiary and department its own hardened key branch, derived by hashing their names.","ja":"機関投資家のトレジャリー向けの BIP-44 スタイルの HD 導出パス。子会社と部門のそれぞれに、名前をハッシュして導出した専用の強化（hardened）鍵ブランチを与える。","ko":"기관 자금(트레저리)을 위한 BIP-44 스타일 HD 파생 경로. 각 자회사와 부서에 이름을 해싱해 파생한 전용 하드닝(hardened) 키 브랜치를 부여한다.","zh":"一种面向机构资金库、类似 BIP-44 的 HD 派生路径，为每个子公司和部门分配独立的强化（hardened）密钥分支，通过对名称做哈希来派生。"},"tags":["wallet","hd-wallet","bip-44","treasury","key-management"],"explainers":{"en":{"lang":"en","tldr":"A BIP-44-style HD derivation path for institutional treasuries that gives each subsidiary and department its own hardened key branch, derived by hashing their names.","tags":["wallet","hd-wallet","bip-44","treasury","key-management"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7908/","markdown":"## What problem does it solve?\n\nA company holding crypto usually needs many accounts: per subsidiary, per department, sometimes per role. Generating unrelated keys for each is hard to back up and audit, while sharing one key across teams removes all isolation.\n\nERC-7908 standardizes how an organization lays out a single hierarchical deterministic (HD) wallet so that:\n\n- the group administrator can derive every account from one master key,\n- a subsidiary or department can be handed its own branch without exposing others,\n- auditors can be given an extended **public** key and see all of a department's addresses without being able to spend.\n\n## How it works\n\nThe required path is:\n\n```text\nm / 44' / 60' / entity_id' / department_id' / account_index\n```\n\n- `44'` and `60'` are the usual BIP-44 purpose and Ethereum coin type.\n- `entity_id'` and `department_id'` are **hardened** indices computed by hashing names, so a leaked department key cannot be used to reach siblings or the parent.\n- `account_index` is **non-hardened**, so a department's xpub can derive all its addresses.\n- BIP-44's `change` level is dropped because Ethereum is account-based.\n\nIndex derivation uses SHA-256 and keeps the top bit set (range 2^31 to 2^32 − 1):\n\n- `entity_index = first4bytes(sha256(\"ENTITY:\" + entity)) | 0x80000000`\n- `dept_index = first4bytes(sha256(\"DEPT:\" + entity_hash + \":\" + department)) | 0x80000000`\n\nChaining the entity hash into the department hash means \"Finance\" in two subsidiaries gets two different indices.\n\nThe spec also describes an optional extra `role_id'` level and a simplified `m/44'/60'/department_id'/0/account_index` path for organizations without subsidiaries.\n\n## Sample code\n\nComputing the indices in Python, following the reference implementation (which hex-encodes the entity hash):\n\n```python\nimport hashlib\n\ndef treasury_path(entity: str, department: str, account: int = 0) -\u003e str:\n    entity_hash = hashlib.sha256(f\"ENTITY:{entity}\".encode()).digest()\n    e_idx = int.from_bytes(entity_hash[:4], \"big\") | 0x80000000\n\n    dept_hash = hashlib.sha256(f\"DEPT:{entity_hash.hex()}:{department}\".encode()).digest()\n    d_idx = int.from_bytes(dept_hash[:4], \"big\") | 0x80000000\n\n    # e_idx / d_idx already include the hardened bit\n    return f\"m/44'/60'/{e_idx - 0x80000000}'/{d_idx - 0x80000000}'/{account}\"\n\nprint(treasury_path(\"GroupA\", \"Finance\", 0))\n```\n\nFeed the resulting path to any BIP-32 library (secp256k1) to get the key and address.\n\n## Things to know\n\n- Status is **Final**.\n- The spec text writes the department input as `DEPT:{entity_hash}` while the reference code uses `entity_hash.hex()`. Pick one encoding and document it, or indices will not match between tools.\n- Hardened indices this large are valid BIP-32 but some wallet UIs do not let you type custom paths; the extended role path (which omits `44'`) is explicitly noted as incompatible with standard wallets.\n- Everything hangs off one master secret. The spec calls for extra protection of it, such as splitting the mnemonic or master key.\n- Handing out a department **xprv** gives full spending power over that branch; share the **xpub** for audit-only access.\n"},"ja":{"lang":"ja","tldr":"機関投資家のトレジャリー向けの BIP-44 スタイルの HD 導出パス。子会社と部門のそれぞれに、名前をハッシュして導出した専用の強化（hardened）鍵ブランチを与える。","tags":["wallet","hd-wallet","bip-44","treasury","key-management"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7908/","markdown":"## 何を解決するのか\n\n暗号資産を保有する企業は、通常、子会社ごと、部門ごと、ときには役割ごとに多数のアカウントを必要とします。それぞれに無関係な鍵を生成するとバックアップや監査が難しくなり、かといってチーム間で 1 つの鍵を共有すると分離が一切なくなります。\n\nERC-7908 は、組織が 1 つの階層的決定性（HD）ウォレットをどう構成するかを標準化し、次のことを可能にします。\n\n- グループの管理者は、1 つのマスター鍵からすべてのアカウントを導出できる。\n- 子会社や部門には、他に影響を与えずに専用のブランチを渡せる。\n- 監査人には拡張**公開**鍵を渡せば、部門のすべてのアドレスを、資金を動かす権限なしに確認できる。\n\n## 仕組み\n\n必須のパスは次のとおりです。\n\n```text\nm / 44' / 60' / entity_id' / department_id' / account_index\n```\n\n- `44'` と `60'` は、通常の BIP-44 の purpose と Ethereum の coin type です。\n- `entity_id'` と `department_id'` は、名前をハッシュして計算される**強化（hardened）**インデックスです。そのため、漏えいした部門の鍵を使って兄弟や親に到達することはできません。\n- `account_index` は**非強化（non-hardened）**なので、部門の xpub からそのすべてのアドレスを導出できます。\n- BIP-44 の `change` レベルは、Ethereum がアカウントベースであるため省かれています。\n\nインデックスの導出には SHA-256 を使い、最上位ビットを立てたままにします（範囲は 2^31 から 2^32 − 1）。\n\n- `entity_index = first4bytes(sha256(\"ENTITY:\" + entity)) | 0x80000000`\n- `dept_index = first4bytes(sha256(\"DEPT:\" + entity_hash + \":\" + department)) | 0x80000000`\n\nエンティティのハッシュを部門のハッシュに連鎖させているため、2 つの子会社にある「Finance」には、それぞれ異なるインデックスが割り当てられます。\n\n仕様は、任意の追加の `role_id'` レベルと、子会社を持たない組織向けの簡略化された `m/44'/60'/department_id'/0/account_index` パスについても説明しています。\n\n## サンプルコード\n\nリファレンス実装（エンティティのハッシュを 16 進エンコードする）に従って、Python でインデックスを計算する例:\n\n```python\nimport hashlib\n\ndef treasury_path(entity: str, department: str, account: int = 0) -\u003e str:\n    entity_hash = hashlib.sha256(f\"ENTITY:{entity}\".encode()).digest()\n    e_idx = int.from_bytes(entity_hash[:4], \"big\") | 0x80000000\n\n    dept_hash = hashlib.sha256(f\"DEPT:{entity_hash.hex()}:{department}\".encode()).digest()\n    d_idx = int.from_bytes(dept_hash[:4], \"big\") | 0x80000000\n\n    # e_idx / d_idx already include the hardened bit\n    return f\"m/44'/60'/{e_idx - 0x80000000}'/{d_idx - 0x80000000}'/{account}\"\n\nprint(treasury_path(\"GroupA\", \"Finance\", 0))\n```\n\n得られたパスを任意の BIP-32 ライブラリ（secp256k1）に渡せば、鍵とアドレスが得られます。\n\n## 知っておくべきこと\n\n- ステータスは **Final** です。\n- 仕様の文章では部門の入力を `DEPT:{entity_hash}` と書いていますが、リファレンスコードは `entity_hash.hex()` を使っています。エンコーディングを 1 つ選んで文書化しないと、ツール間でインデックスが一致しません。\n- これほど大きな強化インデックスは BIP-32 としては有効ですが、一部のウォレット UI ではカスタムパスを入力できません。拡張された役割のパス（`44'` を省略するもの）は、標準的なウォレットと互換性がないことが明記されています。\n- すべてが 1 つのマスターシークレットにぶら下がっています。仕様は、ニーモニックやマスター鍵の分割など、その追加の保護を求めています。\n- 部門の **xprv** を渡すと、そのブランチに対する完全な送金権限を与えることになります。監査のみのアクセスには **xpub** を共有してください。\n"},"ko":{"lang":"ko","tldr":"기관 자금(트레저리)을 위한 BIP-44 스타일 HD 파생 경로. 각 자회사와 부서에 이름을 해싱해 파생한 전용 하드닝(hardened) 키 브랜치를 부여한다.","tags":["wallet","hd-wallet","bip-44","treasury","key-management"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7908/","markdown":"## 어떤 문제를 해결하나요?\n\n암호화폐를 보유한 회사는 보통 자회사별, 부서별, 때로는 역할별로 많은 계정이 필요합니다. 계정마다 서로 무관한 키를 생성하면 백업과 감사가 어렵고, 팀 간에 키 하나를 공유하면 격리가 완전히 사라집니다.\n\nERC-7908은 조직이 하나의 계층적 결정론적(HD) 지갑을 어떻게 구성할지 표준화하여 다음을 가능하게 합니다.\n\n- 그룹 관리자는 마스터 키 하나로 모든 계정을 파생할 수 있다.\n- 다른 브랜치를 노출하지 않고 자회사나 부서에 전용 브랜치를 넘겨줄 수 있다.\n- 감사자에게 확장 **공개** 키를 주면, 자금을 쓸 수 없는 상태로 부서의 모든 주소를 볼 수 있다.\n\n## 어떻게 동작하나요?\n\n필수 경로는 다음과 같습니다.\n\n```text\nm / 44' / 60' / entity_id' / department_id' / account_index\n```\n\n- `44'`와 `60'`은 일반적인 BIP-44 purpose와 이더리움 coin type입니다.\n- `entity_id'`와 `department_id'`는 이름을 해싱해 계산한 **하드닝(hardened)** 인덱스이므로, 유출된 부서 키로는 형제나 상위에 접근할 수 없습니다.\n- `account_index`는 **논하드닝(non-hardened)**이므로 부서의 xpub으로 그 부서의 모든 주소를 파생할 수 있습니다.\n- BIP-44의 `change` 레벨은 이더리움이 계정 기반이므로 빠져 있습니다.\n\n인덱스 파생에는 SHA-256을 사용하며 최상위 비트를 켠 상태로 유지합니다(범위는 2^31부터 2^32 − 1).\n\n- `entity_index = first4bytes(sha256(\"ENTITY:\" + entity)) | 0x80000000`\n- `dept_index = first4bytes(sha256(\"DEPT:\" + entity_hash + \":\" + department)) | 0x80000000`\n\n엔티티 해시를 부서 해시에 연결하기 때문에, 두 자회사의 \"Finance\"는 서로 다른 인덱스를 받습니다.\n\n명세는 선택적인 추가 `role_id'` 레벨과, 자회사가 없는 조직을 위한 단순화된 `m/44'/60'/department_id'/0/account_index` 경로도 설명합니다.\n\n## 샘플 코드\n\n레퍼런스 구현(엔티티 해시를 16진 인코딩함)에 따라 Python으로 인덱스를 계산하기:\n\n```python\nimport hashlib\n\ndef treasury_path(entity: str, department: str, account: int = 0) -\u003e str:\n    entity_hash = hashlib.sha256(f\"ENTITY:{entity}\".encode()).digest()\n    e_idx = int.from_bytes(entity_hash[:4], \"big\") | 0x80000000\n\n    dept_hash = hashlib.sha256(f\"DEPT:{entity_hash.hex()}:{department}\".encode()).digest()\n    d_idx = int.from_bytes(dept_hash[:4], \"big\") | 0x80000000\n\n    # e_idx / d_idx already include the hardened bit\n    return f\"m/44'/60'/{e_idx - 0x80000000}'/{d_idx - 0x80000000}'/{account}\"\n\nprint(treasury_path(\"GroupA\", \"Finance\", 0))\n```\n\n나온 경로를 아무 BIP-32 라이브러리(secp256k1)에 넣으면 키와 주소를 얻을 수 있습니다.\n\n## 알아둘 점\n\n- 상태는 **Final**입니다.\n- 명세 본문은 부서 입력을 `DEPT:{entity_hash}`라고 쓰지만 레퍼런스 코드는 `entity_hash.hex()`를 씁니다. 인코딩 하나를 골라 문서화하지 않으면 도구 간에 인덱스가 일치하지 않습니다.\n- 이렇게 큰 하드닝 인덱스는 BIP-32에서는 유효하지만, 일부 지갑 UI는 사용자 지정 경로를 입력할 수 없습니다. 확장된 역할 경로(`44'`를 생략)는 표준 지갑과 호환되지 않는다고 명시되어 있습니다.\n- 모든 것이 하나의 마스터 시크릿에 달려 있습니다. 명세는 니모닉이나 마스터 키를 분할하는 등 이를 추가로 보호할 것을 요구합니다.\n- 부서의 **xprv**를 넘기면 그 브랜치에 대한 전체 지출 권한을 주는 것입니다. 감사 전용 접근에는 **xpub**을 공유하세요.\n"},"zh":{"lang":"zh","tldr":"一种面向机构资金库、类似 BIP-44 的 HD 派生路径，为每个子公司和部门分配独立的强化（hardened）密钥分支，通过对名称做哈希来派生。","tags":["wallet","hd-wallet","bip-44","treasury","key-management"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7908/","markdown":"## 它解决什么问题？\n\n持有加密资产的公司通常需要许多账户：每个子公司、每个部门，有时还有每个角色。为每个账户生成互不相关的密钥，既难备份又难审计；而让各团队共用一个密钥，则完全丧失隔离。\n\nERC-7908 标准化了组织如何布局一个分层确定性（HD）钱包，使得：\n\n- 集团管理员可以从一个主密钥派生所有账户，\n- 可以把独立的分支交给某个子公司或部门，而不暴露其他分支，\n- 可以向审计方提供扩展**公钥**，让他们看到某个部门的全部地址，却无法动用资金。\n\n## 它如何运作\n\n必需的路径是：\n\n```text\nm / 44' / 60' / entity_id' / department_id' / account_index\n```\n\n- `44'` 和 `60'` 是常见的 BIP-44 purpose 和以太坊 coin type。\n- `entity_id'` 和 `department_id'` 是通过对名称做哈希计算出的**强化（hardened）**索引，因此泄露的部门密钥无法用来触及同级或上级。\n- `account_index` 是**非强化（non-hardened）**的，因此部门的 xpub 可以派生其所有地址。\n- BIP-44 的 `change` 层级被去掉了，因为以太坊是基于账户的。\n\n索引派生使用 SHA-256，并保持最高位为 1（范围 2^31 到 2^32 − 1）：\n\n- `entity_index = first4bytes(sha256(\"ENTITY:\" + entity)) | 0x80000000`\n- `dept_index = first4bytes(sha256(\"DEPT:\" + entity_hash + \":\" + department)) | 0x80000000`\n\n把实体哈希串入部门哈希，意味着两个子公司中的\"Finance\"会得到两个不同的索引。\n\n规范还描述了可选的额外 `role_id'` 层级，以及面向没有子公司的组织的简化路径 `m/44'/60'/department_id'/0/account_index`。\n\n## 示例代码\n\n按参考实现（对实体哈希做十六进制编码）用 Python 计算索引：\n\n```python\nimport hashlib\n\ndef treasury_path(entity: str, department: str, account: int = 0) -\u003e str:\n    entity_hash = hashlib.sha256(f\"ENTITY:{entity}\".encode()).digest()\n    e_idx = int.from_bytes(entity_hash[:4], \"big\") | 0x80000000\n\n    dept_hash = hashlib.sha256(f\"DEPT:{entity_hash.hex()}:{department}\".encode()).digest()\n    d_idx = int.from_bytes(dept_hash[:4], \"big\") | 0x80000000\n\n    # e_idx / d_idx already include the hardened bit\n    return f\"m/44'/60'/{e_idx - 0x80000000}'/{d_idx - 0x80000000}'/{account}\"\n\nprint(treasury_path(\"GroupA\", \"Finance\", 0))\n```\n\n把得到的路径交给任何 BIP-32 库（secp256k1），即可得到密钥和地址。\n\n## 需要注意\n\n- 状态为 **Final**。\n- 规范文本把部门输入写作 `DEPT:{entity_hash}`，而参考代码使用的是 `entity_hash.hex()`。请选定一种编码并写入文档，否则各工具之间的索引将无法一致。\n- 这么大的强化索引在 BIP-32 中是合法的，但有些钱包界面不允许输入自定义路径；扩展的角色路径（省略了 `44'`）被明确说明与标准钱包不兼容。\n- 一切都依赖于同一个主密钥。规范要求对其加以额外保护，例如拆分助记词或主密钥。\n- 交出部门的 **xprv** 就等于交出该分支的完全花费权；如需仅限审计的访问，请共享 **xpub**。\n"}}}
