{"eip":8110,"title":"Domain Architecture for Diamonds","description":"An architectural pattern that organizes Diamond storage by domain using ERC-8042 identifiers.","authors":["Hoang (@0x76agabond)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-12-20","requires":[2535,8042],"discussionsTo":"https://ethereum-magicians.org/t/erc-8110-domain-centric-architecture-for-diamonds/27250","repo":"ERCs","label":"ERC-8110","officialUrl":"https://eips.ethereum.org/EIPS/eip-8110","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8110.md","url":"https://eips.huatuo.xyz/eip-8110/","tldr":{"en":"A draft convention for Diamond contracts that groups storage by business domain, with a fixed naming scheme for ERC-8042 storage identifiers, versioning and sub-domains, to cut storage-collision and upgrade mistakes.","ja":"ストレージをビジネスドメイン単位でグループ化する Diamond コントラクト向けの規約のドラフト。ERC-8042 のストレージ識別子、バージョニング、サブドメインの命名規則を固定し、ストレージ衝突やアップグレード時のミスを減らす。","ko":"스토리지를 비즈니스 도메인별로 묶는 Diamond 컨트랙트용 관례 초안. ERC-8042 스토리지 식별자, 버전 관리, 서브 도메인에 대한 고정된 명명 규칙으로 스토리지 충돌과 업그레이드 실수를 줄인다.","zh":"一种面向 Diamond 合约的草案约定，按业务领域对存储分组，并为 ERC-8042 存储标识符、版本管理和子领域制定固定的命名方案，以减少存储冲突和升级失误。"},"tags":["diamond","storage","upgradeability","architecture","solidity"],"explainers":{"en":{"lang":"en","tldr":"A draft convention for Diamond contracts that groups storage by business domain, with a fixed naming scheme for ERC-8042 storage identifiers, versioning and sub-domains, to cut storage-collision and upgrade mistakes.","tags":["diamond","storage","upgradeability","architecture","solidity"],"related":[2535,8042,7201],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8110/","markdown":"## What problem does it solve?\n\nA Diamond ([ERC-2535](/eip-2535/)) is one proxy that routes function selectors to many logic contracts (\"facets\"). All facets share the Diamond's storage, so each piece of state lives at a hashed position such as `keccak256(\"my.project.storage\")`. [ERC-8042](/eip-8042/) standardised human-readable identifiers for those positions, but not how to choose or organise them.\n\nIn big projects this leads to drift: teams tie storage to facets, reuse or mistype identifiers, and break layouts during upgrades, so one facet silently corrupts another's state. ERC-8110 is a pure convention, with no new interfaces, that says: **storage belongs to domains, not facets**.\n\n## How it works\n\n- **Domain** = one area of responsibility (for example `character`, `equipment`, `gamesettings`). Each domain has exactly one storage struct and one identifier. Many facets may read or write the same domain.\n- **Identifier format**: at minimum `{project}.{domain-name}.{version}`; extended form `{org}.{project}.{domain-type}.{domain-name}.{version}`, where `domain-type` is `diamond`, `system` or `business`. Omitting the version means `v1`.\n- **Append-only**: new fields go at the end of the struct. A layout-breaking change (for example reshaping nested structs) requires a new version identifier (`v2`, …) and explicit, project-handled migration.\n- **Sub-domains**: to add state to a domain without touching its struct, define `{…}.{version}.{sub-domain}` with its own struct and identifier.\n- **Annotation**: each domain struct must carry `@custom:storage-location erc8042:\u003cid\u003e` so tools can find it.\n- **Directories** should mirror domains (`contracts/character/storage/…`, `contracts/character/facets/…`).\n\nUpgrades are classified by their effect on storage: no new state (just add selectors), a new domain (horizontal), new fields in an existing domain (append or sub-domain), or a layout break (new version).\n\n## Sample code\n\nA business domain plus a sub-domain, following the spec's naming:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @custom:storage-location erc8042:acme.game.business.character.v1\nbytes32 constant CHARACTER_STORAGE_POSITION = keccak256(\"acme.game.business.character.v1\");\n\nstruct Character { uint32 level; uint256 hp; }\nstruct CharacterStorage { mapping(uint256 =\u003e Character) characters; }\n\nfunction characterStorage() pure returns (CharacterStorage storage s) {\n    bytes32 position = CHARACTER_STORAGE_POSITION;\n    assembly { s.slot := position }\n}\n\n/// Sub-domain: new state isolated from the original struct\n/// @custom:storage-location erc8042:acme.game.business.character.v1.mounted\nbytes32 constant CHARACTER_MOUNTED_POSITION = keccak256(\"acme.game.business.character.v1.mounted\");\n\nstruct CharacterMountedStorage { bool isMounted; }\n\nfunction characterMountedStorage() pure returns (CharacterMountedStorage storage s) {\n    bytes32 position = CHARACTER_MOUNTED_POSITION;\n    assembly { s.slot := position }\n}\n\n// Any facet can use the domain helpers\ncontract CharacterFacet {\n    function levelUp(uint256 id) external {\n        characterStorage().characters[id].level += 1;\n    }\n}\n```\n\n## Things to know\n\n- **Status: Draft.** Naming rules may still change.\n- It changes nothing in the Diamond execution model and adds no on-chain interface; it is compatible with existing ERC-2535 and ERC-8042 systems and can be adopted incrementally. Existing identifiers in shared libraries should be left alone.\n- Choosing between appending to a domain and adding a sub-domain is a team trade-off: appending keeps things together but demands layout discipline; sub-domains isolate risk.\n- Identifier uniqueness is the main hazard when adopting it in a live system: new identifiers must not clash with existing ones.\n- For non-Diamond upgradeable contracts, the comparable namespaced-storage convention is [ERC-7201](/eip-7201/).\n"},"ja":{"lang":"ja","tldr":"ストレージをビジネスドメイン単位でグループ化する Diamond コントラクト向けの規約のドラフト。ERC-8042 のストレージ識別子、バージョニング、サブドメインの命名規則を固定し、ストレージ衝突やアップグレード時のミスを減らす。","tags":["diamond","storage","upgradeability","architecture","solidity"],"related":[2535,8042,7201],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8110/","markdown":"## 何を解決するのか\n\nDiamond（[ERC-2535](/eip-2535/)）は、関数セレクターを多数のロジックコントラクト（「facet」）にルーティングする 1 つのプロキシです。すべての facet が Diamond のストレージを共有するため、状態の各部分は `keccak256(\"my.project.storage\")` のようなハッシュ化された位置に置かれます。[ERC-8042](/eip-8042/) はそうした位置に対する人間が読める識別子を標準化しましたが、それをどう選び、どう整理するかは標準化していません。\n\n大規模なプロジェクトではこれがずれの原因になります。チームがストレージを facet に結び付けたり、識別子を再利用・打ち間違えたり、アップグレード中にレイアウトを壊したりして、ある facet が別の facet の状態を気付かないうちに破壊してしまいます。ERC-8110 は純粋な規約であり、新しいインターフェースはありません。主張は次の 1 つです。**ストレージは facet ではなく、ドメインに属する**。\n\n## 仕組み\n\n- **ドメイン** = 1 つの責任領域（たとえば `character`、`equipment`、`gamesettings`）。各ドメインにはストレージ struct と識別子がちょうど 1 つずつあります。多くの facet が同じドメインを読み書きしてかまいません。\n- **識別子の形式**: 最小形は `{project}.{domain-name}.{version}`。拡張形は `{org}.{project}.{domain-type}.{domain-name}.{version}` で、`domain-type` は `diamond`、`system`、`business` のいずれかです。バージョンを省略すると `v1` を意味します。\n- **追記のみ**: 新しいフィールドは struct の末尾に追加します。レイアウトを壊す変更（たとえば入れ子の struct の形を変える）には、新しいバージョン識別子（`v2` など）と、プロジェクト側で明示的に行う移行が必要です。\n- **サブドメイン**: ドメインの struct に手を加えずに状態を追加するには、独自の struct と識別子を持つ `{…}.{version}.{sub-domain}` を定義します。\n- **アノテーション**: 各ドメインの struct には、ツールが見つけられるよう `@custom:storage-location erc8042:\u003cid\u003e` を付ける必要があります。\n- **ディレクトリ**はドメインを反映すべきです（`contracts/character/storage/…`、`contracts/character/facets/…`）。\n\nアップグレードは、ストレージへの影響によって分類されます。新しい状態なし（セレクターを追加するだけ）、新しいドメイン（水平方向）、既存ドメインへの新しいフィールド（追記またはサブドメイン）、レイアウトの破壊（新バージョン）です。\n\n## サンプルコード\n\n仕様の命名に従った、ビジネスドメインとサブドメイン:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @custom:storage-location erc8042:acme.game.business.character.v1\nbytes32 constant CHARACTER_STORAGE_POSITION = keccak256(\"acme.game.business.character.v1\");\n\nstruct Character { uint32 level; uint256 hp; }\nstruct CharacterStorage { mapping(uint256 =\u003e Character) characters; }\n\nfunction characterStorage() pure returns (CharacterStorage storage s) {\n    bytes32 position = CHARACTER_STORAGE_POSITION;\n    assembly { s.slot := position }\n}\n\n/// Sub-domain: new state isolated from the original struct\n/// @custom:storage-location erc8042:acme.game.business.character.v1.mounted\nbytes32 constant CHARACTER_MOUNTED_POSITION = keccak256(\"acme.game.business.character.v1.mounted\");\n\nstruct CharacterMountedStorage { bool isMounted; }\n\nfunction characterMountedStorage() pure returns (CharacterMountedStorage storage s) {\n    bytes32 position = CHARACTER_MOUNTED_POSITION;\n    assembly { s.slot := position }\n}\n\n// Any facet can use the domain helpers\ncontract CharacterFacet {\n    function levelUp(uint256 id) external {\n        characterStorage().characters[id].level += 1;\n    }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** 命名規則はまだ変わる可能性があります。\n- Diamond の実行モデルは何も変わらず、オンチェーンのインターフェースも追加されません。既存の ERC-2535 や ERC-8042 のシステムと互換性があり、段階的に採用できます。共有ライブラリ内の既存の識別子には手を付けないでください。\n- ドメインに追記するか、サブドメインを追加するかの選択は、チームごとのトレードオフです。追記は関連するものをまとめておけますがレイアウトの規律が求められ、サブドメインはリスクを分離します。\n- 稼働中のシステムに採用する際の主な危険は識別子の一意性です。新しい識別子は既存のものと衝突してはいけません。\n- Diamond ではないアップグレード可能なコントラクトの場合、同等の名前空間付きストレージの規約は [ERC-7201](/eip-7201/) です。\n"},"ko":{"lang":"ko","tldr":"스토리지를 비즈니스 도메인별로 묶는 Diamond 컨트랙트용 관례 초안. ERC-8042 스토리지 식별자, 버전 관리, 서브 도메인에 대한 고정된 명명 규칙으로 스토리지 충돌과 업그레이드 실수를 줄인다.","tags":["diamond","storage","upgradeability","architecture","solidity"],"related":[2535,8042,7201],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8110/","markdown":"## 어떤 문제를 해결하나요?\n\nDiamond([ERC-2535](/eip-2535/))는 함수 셀렉터를 여러 로직 컨트랙트(\"facet\")로 라우팅하는 하나의 프록시입니다. 모든 facet이 Diamond의 스토리지를 공유하므로 각 상태는 `keccak256(\"my.project.storage\")` 같은 해시된 위치에 놓입니다. [ERC-8042](/eip-8042/)는 이런 위치를 위한 사람이 읽을 수 있는 식별자를 표준화했지만, 그것을 어떻게 고르고 정리할지는 정하지 않았습니다.\n\n대규모 프로젝트에서는 이것이 드리프트로 이어집니다. 팀이 스토리지를 facet에 묶거나, 식별자를 재사용하거나 오타를 내거나, 업그레이드 중에 레이아웃을 깨뜨려서 한 facet이 다른 facet의 상태를 조용히 망가뜨립니다. ERC-8110은 새 인터페이스가 없는 순수한 관례이며, 핵심은 이것입니다. **스토리지는 facet이 아니라 도메인에 속한다**.\n\n## 어떻게 동작하나요?\n\n- **도메인** = 하나의 책임 영역(예: `character`, `equipment`, `gamesettings`). 각 도메인에는 스토리지 struct와 식별자가 정확히 하나씩 있습니다. 여러 facet이 같은 도메인을 읽고 쓸 수 있습니다.\n- **식별자 형식**: 최소 `{project}.{domain-name}.{version}`, 확장 형식은 `{org}.{project}.{domain-type}.{domain-name}.{version}`이며 `domain-type`은 `diamond`, `system`, `business` 중 하나입니다. 버전을 생략하면 `v1`을 뜻합니다.\n- **추가만 허용**: 새 필드는 struct의 끝에 넣습니다. 레이아웃을 깨는 변경(예: 중첩 struct의 모양 변경)에는 새 버전 식별자(`v2` 등)와 프로젝트가 직접 처리하는 명시적인 마이그레이션이 필요합니다.\n- **서브 도메인**: 도메인의 struct를 건드리지 않고 상태를 추가하려면 자체 struct와 식별자를 가진 `{…}.{version}.{sub-domain}`을 정의합니다.\n- **주석**: 각 도메인 struct에는 도구가 찾을 수 있도록 `@custom:storage-location erc8042:\u003cid\u003e`가 있어야 합니다.\n- **디렉터리**는 도메인을 반영해야 합니다(`contracts/character/storage/…`, `contracts/character/facets/…`).\n\n업그레이드는 스토리지에 미치는 영향으로 분류됩니다. 새 상태 없음(셀렉터만 추가), 새 도메인(수평 확장), 기존 도메인에 새 필드(추가 또는 서브 도메인), 레이아웃 파괴(새 버전)입니다.\n\n## 샘플 코드\n\n명세의 명명 규칙을 따른 비즈니스 도메인과 서브 도메인:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @custom:storage-location erc8042:acme.game.business.character.v1\nbytes32 constant CHARACTER_STORAGE_POSITION = keccak256(\"acme.game.business.character.v1\");\n\nstruct Character { uint32 level; uint256 hp; }\nstruct CharacterStorage { mapping(uint256 =\u003e Character) characters; }\n\nfunction characterStorage() pure returns (CharacterStorage storage s) {\n    bytes32 position = CHARACTER_STORAGE_POSITION;\n    assembly { s.slot := position }\n}\n\n/// Sub-domain: new state isolated from the original struct\n/// @custom:storage-location erc8042:acme.game.business.character.v1.mounted\nbytes32 constant CHARACTER_MOUNTED_POSITION = keccak256(\"acme.game.business.character.v1.mounted\");\n\nstruct CharacterMountedStorage { bool isMounted; }\n\nfunction characterMountedStorage() pure returns (CharacterMountedStorage storage s) {\n    bytes32 position = CHARACTER_MOUNTED_POSITION;\n    assembly { s.slot := position }\n}\n\n// Any facet can use the domain helpers\ncontract CharacterFacet {\n    function levelUp(uint256 id) external {\n        characterStorage().characters[id].level += 1;\n    }\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 명명 규칙은 아직 바뀔 수 있습니다.\n- Diamond 실행 모델은 아무것도 바꾸지 않고 온체인 인터페이스도 추가하지 않습니다. 기존 ERC-2535 및 ERC-8042 시스템과 호환되며 점진적으로 도입할 수 있습니다. 공유 라이브러리에 있는 기존 식별자는 건드리지 않는 것이 좋습니다.\n- 도메인에 필드를 추가할지 서브 도메인을 추가할지의 선택은 팀의 트레이드오프입니다. 추가는 관련된 것을 한곳에 모으지만 레이아웃에 대한 규율이 필요하고, 서브 도메인은 위험을 격리합니다.\n- 운영 중인 시스템에 도입할 때 가장 큰 위험은 식별자의 고유성입니다. 새 식별자는 기존 식별자와 충돌하면 안 됩니다.\n- Diamond가 아닌 업그레이드 가능한 컨트랙트에서 이에 해당하는 네임스페이스 스토리지 관례는 [ERC-7201](/eip-7201/)입니다.\n"},"zh":{"lang":"zh","tldr":"一种面向 Diamond 合约的草案约定，按业务领域对存储分组，并为 ERC-8042 存储标识符、版本管理和子领域制定固定的命名方案，以减少存储冲突和升级失误。","tags":["diamond","storage","upgradeability","architecture","solidity"],"related":[2535,8042,7201],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8110/","markdown":"## 它解决什么问题？\n\nDiamond（[ERC-2535](/eip-2535/)）是一个代理，把函数选择器路由到许多逻辑合约（\"facet\"）。所有 facet 共享 Diamond 的存储，因此每一块状态都位于一个经过哈希的位置，例如 `keccak256(\"my.project.storage\")`。[ERC-8042](/eip-8042/) 为这些位置标准化了人类可读的标识符，但没有规定如何选择或组织它们。\n\n在大型项目中，这会导致漂移：团队把存储绑定到 facet、重用或写错标识符，并在升级时破坏布局，使某个 facet 悄悄损坏另一个 facet 的状态。ERC-8110 是一项纯粹的约定，不引入新接口，它的主张是：**存储属于领域，而不是 facet**。\n\n## 它如何运作\n\n- **领域（Domain）** = 一个职责范围（例如 `character`、`equipment`、`gamesettings`）。每个领域恰好有一个存储 struct 和一个标识符。多个 facet 可以读写同一个领域。\n- **标识符格式**：最少为 `{project}.{domain-name}.{version}`；扩展形式为 `{org}.{project}.{domain-type}.{domain-name}.{version}`，其中 `domain-type` 是 `diamond`、`system` 或 `business`。省略版本表示 `v1`。\n- **仅追加**：新字段加在 struct 末尾。破坏布局的变更（例如重塑嵌套 struct）需要新的版本标识符（`v2` 等）以及由项目自行处理的明确迁移。\n- **子领域（Sub-domain）**：若要在不改动领域 struct 的情况下为其添加状态，可定义 `{…}.{version}.{sub-domain}`，并配以独立的 struct 和标识符。\n- **注解**：每个领域 struct 必须带有 `@custom:storage-location erc8042:\u003cid\u003e`，以便工具找到它。\n- **目录**应与领域对应（`contracts/character/storage/…`、`contracts/character/facets/…`）。\n\n升级按其对存储的影响分类：没有新状态（只需添加选择器）、新领域（横向扩展）、现有领域中的新字段（追加或子领域），或布局破坏（新版本）。\n\n## 示例代码\n\n遵循规范命名的业务领域加子领域：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @custom:storage-location erc8042:acme.game.business.character.v1\nbytes32 constant CHARACTER_STORAGE_POSITION = keccak256(\"acme.game.business.character.v1\");\n\nstruct Character { uint32 level; uint256 hp; }\nstruct CharacterStorage { mapping(uint256 =\u003e Character) characters; }\n\nfunction characterStorage() pure returns (CharacterStorage storage s) {\n    bytes32 position = CHARACTER_STORAGE_POSITION;\n    assembly { s.slot := position }\n}\n\n/// Sub-domain: new state isolated from the original struct\n/// @custom:storage-location erc8042:acme.game.business.character.v1.mounted\nbytes32 constant CHARACTER_MOUNTED_POSITION = keccak256(\"acme.game.business.character.v1.mounted\");\n\nstruct CharacterMountedStorage { bool isMounted; }\n\nfunction characterMountedStorage() pure returns (CharacterMountedStorage storage s) {\n    bytes32 position = CHARACTER_MOUNTED_POSITION;\n    assembly { s.slot := position }\n}\n\n// Any facet can use the domain helpers\ncontract CharacterFacet {\n    function levelUp(uint256 id) external {\n        characterStorage().characters[id].level += 1;\n    }\n}\n```\n\n## 需要注意\n\n- **状态：Draft。** 命名规则仍可能变化。\n- 它不改变 Diamond 执行模型中的任何内容，也不增加链上接口；它与现有的 ERC-2535 和 ERC-8042 系统兼容，可以逐步采用。共享库中已有的标识符应保持不动。\n- 在向领域追加字段和添加子领域之间做选择，是团队的权衡：追加能让相关内容聚在一起，但需要对布局保持纪律；子领域则能隔离风险。\n- 在线上系统中采用它时，标识符的唯一性是主要隐患：新标识符不得与现有标识符冲突。\n- 对于非 Diamond 的可升级合约，类似的命名空间存储约定是 [ERC-7201](/eip-7201/)。\n"}}}
