{"eip":1900,"title":"dType - Decentralized Type System for EVM","description":"The EVM and related languages such as Solidity need consensus on an extensible Type System in order to further evolve into the Singleton Operating System (The World Computer).","authors":["Loredana Cirstea (@loredanacirstea)","Christian Tzurcanu (@ctzurcanu)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2019-03-28","discussionsTo":"https://github.com/ethereum/EIPs/issues/1882","repo":"ERCs","label":"ERC-1900","officialUrl":"https://eips.ethereum.org/EIPS/eip-1900","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1900.md","url":"https://eips.huatuo.xyz/eip-1900/","tldr":{"en":"dType proposes an on-chain registry of Solidity types (structs and their libraries) so projects can share data definitions and tools can decode data consistently.","ja":"dType は、Solidity の型（構造体とそのライブラリ）のオンチェーンレジストリを提案する。プロジェクト間でデータ定義を共有でき、ツールがデータを一貫してデコードできる。","ko":"dType은 Solidity 타입(구조체와 그 라이브러리)의 온체인 레지스트리를 제안한다. 프로젝트들이 데이터 정의를 공유하고 도구가 데이터를 일관되게 디코딩할 수 있게 한다.","zh":"dType 提出一个 Solidity 类型（结构体及其库）的链上注册表，让项目可以共享数据定义，工具也能一致地解码数据。"},"tags":["types","registry","abi","solidity","interoperability"],"explainers":{"en":{"lang":"en","tldr":"dType proposes an on-chain registry of Solidity types (structs and their libraries) so projects can share data definitions and tools can decode data consistently.","tags":["types","registry","abi","solidity","interoperability"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1900/","markdown":"## What problem does it solve?\n\nEvery project on Ethereum defines its own structs, even when they describe the same thing. Two protocols that both have a \"balance\" or \"token amount\" type cannot pass data to each other without custom glue, and block explorers have to be told each contract's ABI separately to decode it.\n\ndType (\"decentralized type system\") proposes a shared, on-chain **Type Registry**. A type is registered once with enough metadata to rebuild its ABI, and anyone can reuse it, compose it into bigger types, or decode data that uses it.\n\n## How it works\n\n**Type library.** Each type is defined by a Solidity library containing the `struct` plus helpers such as `isInstanceOf` (validation), `structureBytes` / `destructureBytes` (encode and decode), and higher-order functions like `map`, `filter` and `reduce`. Types can contain other types, always forming a directed acyclic graph.\n\n**Registry record.** For each type, the registry stores:\n\n- `name`: the Solidity type name, optionally with a version\n- `typeChoice`: `BaseType`, `PayableFunction`, `StateFunction`, `ViewFunction`, `PureFunction` or `Event`\n- `contractAddress`: the type library's address\n- `source`: a Swarm hash of the source code\n- `types`: the direct sub-fields, each with `name`, `label` and array `dimensions` (`[\"\"]` means `T[]`, `[\"2\",\"3\"]` means `T[2][3]`)\n\nA record's identifier is `keccak256(abi.encodePacked(name))`. The interface offers `insert`, `remove`, `count`, `get`, `getByIdentifier`, `getTypeIdentifier` and `isRegistered`, with `LogNew` / `LogUpdate` / `LogRemove` events.\n\n**Composition example from the spec.** `myBalance = (string accountName, uint256 amount)` and `myToken = (address token, myBalance balance)` give `myToken` the ABI tuple `(address,(string,uint256))`.\n\n## Sample code\n\nThe registry metadata for the composed type (JSON):\n\n```json\n{\n  \"typeChoice\": 0,\n  \"contractAddress\": \"0x...\",\n  \"source\": \"0x...\",\n  \"name\": \"myToken\",\n  \"types\": [\n    { \"name\": \"address\",   \"label\": \"token\",   \"dimensions\": [] },\n    { \"name\": \"myBalance\", \"label\": \"balance\", \"dimensions\": [] }\n  ]\n}\n```\n\nA trimmed version of the registry interface:\n\n```solidity\ninterface IDType {\n    enum TypeChoices { BaseType, PayableFunction, StateFunction, ViewFunction, PureFunction, Event }\n    struct dTypes { string name; string label; string[] dimensions; }\n    struct dType  { TypeChoices typeChoice; address contractAddress; bytes32 source;\n                    string name; dTypes[] types; }\n\n    event LogNew(bytes32 indexed identifier, uint256 indexed index);\n\n    function insert(dType calldata data) external returns (bytes32 identifier);\n    function get(string memory name) external view returns (dType memory);\n    function isRegistered(bytes32 identifier) external view returns (bool);\n}\n```\n\n## Things to know\n\n- **Status: Stagnant.** It was written against Solidity 0.5 with the then-experimental ABIEncoderV2, and test cases were never added.\n- Governance (who may add or remove types) and permissions are explicitly out of scope; the authors suggest not supporting updates, and note that `remove` is risky.\n- Using a plain name as the key invites name squatting; the spec only suggests disallowing single English words at first.\n- It was designed as the first step of a larger vision (typed storage, function registries) described in follow-up proposals outside the current EIP index.\n"},"ja":{"lang":"ja","tldr":"dType は、Solidity の型（構造体とそのライブラリ）のオンチェーンレジストリを提案する。プロジェクト間でデータ定義を共有でき、ツールがデータを一貫してデコードできる。","tags":["types","registry","abi","solidity","interoperability"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1900/","markdown":"## 何を解決するのか\n\nEthereum のあらゆるプロジェクトは、同じものを表す場合でも、それぞれ独自の構造体を定義します。どちらも「残高」や「トークン量」の型を持つ 2 つのプロトコルは、独自の接着コードなしにはデータを渡し合えず、ブロックエクスプローラーはデコードのために各コントラクトの ABI を個別に教えてもらう必要があります。\n\ndType（「分散型の型システム」）は、共有されるオンチェーンの**型レジストリ**を提案します。型は、ABI を再構築できるだけのメタデータとともに一度登録され、誰でもそれを再利用したり、より大きな型に組み合わせたり、それを使うデータをデコードしたりできます。\n\n## 仕組み\n\n**型ライブラリ。** 各型は、`struct` と、`isInstanceOf`（検証）、`structureBytes` / `destructureBytes`（エンコードとデコード）、`map`、`filter`、`reduce` などの高階関数といった補助関数を含む、Solidity のライブラリで定義されます。型は他の型を含むことができ、常に有向非巡回グラフを形成します。\n\n**レジストリのレコード。** 各型について、レジストリは次を保存します。\n\n- `name`: Solidity の型名。必要に応じてバージョンを付けます\n- `typeChoice`: `BaseType`、`PayableFunction`、`StateFunction`、`ViewFunction`、`PureFunction`、`Event` のいずれか\n- `contractAddress`: 型ライブラリのアドレス\n- `source`: ソースコードの Swarm ハッシュ\n- `types`: 直接のサブフィールド。それぞれ `name`、`label`、配列の `dimensions` を持ちます（`[\"\"]` は `T[]`、`[\"2\",\"3\"]` は `T[2][3]` を意味します）\n\nレコードの識別子は `keccak256(abi.encodePacked(name))` です。インターフェースは `insert`、`remove`、`count`、`get`、`getByIdentifier`、`getTypeIdentifier`、`isRegistered` を提供し、`LogNew` / `LogUpdate` / `LogRemove` イベントがあります。\n\n**仕様にある合成の例。** `myBalance = (string accountName, uint256 amount)` と `myToken = (address token, myBalance balance)` から、`myToken` の ABI タプル `(address,(string,uint256))` が得られます。\n\n## サンプルコード\n\n合成された型のレジストリメタデータ（JSON）:\n\n```json\n{\n  \"typeChoice\": 0,\n  \"contractAddress\": \"0x...\",\n  \"source\": \"0x...\",\n  \"name\": \"myToken\",\n  \"types\": [\n    { \"name\": \"address\",   \"label\": \"token\",   \"dimensions\": [] },\n    { \"name\": \"myBalance\", \"label\": \"balance\", \"dimensions\": [] }\n  ]\n}\n```\n\nレジストリインターフェースの抜粋版:\n\n```solidity\ninterface IDType {\n    enum TypeChoices { BaseType, PayableFunction, StateFunction, ViewFunction, PureFunction, Event }\n    struct dTypes { string name; string label; string[] dimensions; }\n    struct dType  { TypeChoices typeChoice; address contractAddress; bytes32 source;\n                    string name; dTypes[] types; }\n\n    event LogNew(bytes32 indexed identifier, uint256 indexed index);\n\n    function insert(dType calldata data) external returns (bytes32 identifier);\n    function get(string memory name) external view returns (dType memory);\n    function isRegistered(bytes32 identifier) external view returns (bool);\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** 当時まだ実験的だった ABIEncoderV2 を使い、Solidity 0.5 向けに書かれたもので、テストケースは追加されませんでした。\n- ガバナンス（誰が型を追加・削除できるか）と権限は明示的にスコープ外です。著者らは更新をサポートしないことを提案し、`remove` は危険だと述べています。\n- 単純な名前をキーにすると、名前の買い占め（ネームスクワッティング）を招きます。仕様は、当初は英単語 1 語の名前を禁止することを提案しているだけです。\n- これは、現在の EIP 一覧の外にあるフォローアップの提案で説明されている、より大きな構想（型付きストレージ、関数レジストリ）の第一歩として設計されました。\n"},"ko":{"lang":"ko","tldr":"dType은 Solidity 타입(구조체와 그 라이브러리)의 온체인 레지스트리를 제안한다. 프로젝트들이 데이터 정의를 공유하고 도구가 데이터를 일관되게 디코딩할 수 있게 한다.","tags":["types","registry","abi","solidity","interoperability"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1900/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움의 모든 프로젝트는 같은 것을 나타내더라도 각자 자기 구조체를 정의합니다. \"잔액\"이나 \"토큰 수량\" 타입을 모두 가진 두 프로토콜은 맞춤 연결 코드 없이는 서로 데이터를 주고받을 수 없고, 블록 탐색기는 디코딩하려면 각 컨트랙트의 ABI를 따로 알려 줘야 합니다.\n\ndType(\"탈중앙 타입 시스템\")은 공유되는 온체인 **타입 레지스트리**를 제안합니다. 타입은 ABI를 재구성할 수 있을 만큼의 메타데이터와 함께 한 번 등록되고, 누구나 이를 재사용하거나, 더 큰 타입으로 조합하거나, 이를 쓰는 데이터를 디코딩할 수 있습니다.\n\n## 어떻게 동작하나요?\n\n**타입 라이브러리.** 각 타입은 `struct`와, `isInstanceOf`(검증), `structureBytes` / `destructureBytes`(인코딩과 디코딩) 같은 헬퍼, 그리고 `map`, `filter`, `reduce` 같은 고차 함수를 담은 Solidity 라이브러리로 정의됩니다. 타입은 다른 타입을 포함할 수 있으며 항상 방향성 비순환 그래프를 이룹니다.\n\n**레지스트리 레코드.** 각 타입마다 레지스트리는 다음을 저장합니다.\n\n- `name`: Solidity 타입 이름. 선택적으로 버전을 붙입니다\n- `typeChoice`: `BaseType`, `PayableFunction`, `StateFunction`, `ViewFunction`, `PureFunction`, `Event` 중 하나\n- `contractAddress`: 타입 라이브러리의 주소\n- `source`: 소스 코드의 Swarm 해시\n- `types`: 직접 하위 필드. 각각 `name`, `label`, 배열 `dimensions`를 가집니다(`[\"\"]`는 `T[]`, `[\"2\",\"3\"]`은 `T[2][3]`을 뜻합니다)\n\n레코드의 식별자는 `keccak256(abi.encodePacked(name))`입니다. 인터페이스는 `insert`, `remove`, `count`, `get`, `getByIdentifier`, `getTypeIdentifier`, `isRegistered`를 제공하며 `LogNew` / `LogUpdate` / `LogRemove` 이벤트가 있습니다.\n\n**명세의 조합 예시.** `myBalance = (string accountName, uint256 amount)`와 `myToken = (address token, myBalance balance)`로부터 `myToken`의 ABI 튜플 `(address,(string,uint256))`가 나옵니다.\n\n## 샘플 코드\n\n조합된 타입의 레지스트리 메타데이터(JSON):\n\n```json\n{\n  \"typeChoice\": 0,\n  \"contractAddress\": \"0x...\",\n  \"source\": \"0x...\",\n  \"name\": \"myToken\",\n  \"types\": [\n    { \"name\": \"address\",   \"label\": \"token\",   \"dimensions\": [] },\n    { \"name\": \"myBalance\", \"label\": \"balance\", \"dimensions\": [] }\n  ]\n}\n```\n\n레지스트리 인터페이스의 축약본:\n\n```solidity\ninterface IDType {\n    enum TypeChoices { BaseType, PayableFunction, StateFunction, ViewFunction, PureFunction, Event }\n    struct dTypes { string name; string label; string[] dimensions; }\n    struct dType  { TypeChoices typeChoice; address contractAddress; bytes32 source;\n                    string name; dTypes[] types; }\n\n    event LogNew(bytes32 indexed identifier, uint256 indexed index);\n\n    function insert(dType calldata data) external returns (bytes32 identifier);\n    function get(string memory name) external view returns (dType memory);\n    function isRegistered(bytes32 identifier) external view returns (bool);\n}\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 당시 실험적이던 ABIEncoderV2를 사용해 Solidity 0.5 기준으로 작성되었으며, 테스트 케이스는 추가되지 않았습니다.\n- 거버넌스(누가 타입을 추가하거나 제거할 수 있는가)와 권한은 명시적으로 범위 밖입니다. 저자들은 업데이트를 지원하지 않기를 제안하며 `remove`는 위험하다고 밝힙니다.\n- 단순한 이름을 키로 쓰면 이름 선점(name squatting)을 부릅니다. 명세는 처음에는 영어 단어 하나짜리 이름을 금지하자고만 제안합니다.\n- 이는 현재 EIP 목록 밖의 후속 제안에서 설명하는 더 큰 구상(타입이 있는 스토리지, 함수 레지스트리)의 첫 단계로 설계되었습니다.\n"},"zh":{"lang":"zh","tldr":"dType 提出一个 Solidity 类型（结构体及其库）的链上注册表，让项目可以共享数据定义，工具也能一致地解码数据。","tags":["types","registry","abi","solidity","interoperability"],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1900/","markdown":"## 它解决什么问题？\n\n以太坊上的每个项目都定义自己的结构体，即使它们描述的是同一样东西。两个都有“余额”或“代币数量”类型的协议，没有定制的粘合代码就无法互相传递数据，区块浏览器也必须被分别告知每个合约的 ABI 才能解码。\n\ndType（“去中心化类型系统”）提出一个共享的链上**类型注册表**。一个类型只需连同足以重建其 ABI 的元数据注册一次，任何人都可以复用它、把它组合成更大的类型，或解码使用它的数据。\n\n## 它如何运作\n\n**类型库。** 每个类型由一个 Solidity 库定义，其中包含 `struct`，以及 `isInstanceOf`（验证）、`structureBytes` / `destructureBytes`（编码与解码）等辅助函数，还有 `map`、`filter` 和 `reduce` 这样的高阶函数。类型可以包含其他类型，始终构成一个有向无环图。\n\n**注册表记录。** 对于每个类型，注册表存储：\n\n- `name`：Solidity 类型名，可选带版本\n- `typeChoice`：`BaseType`、`PayableFunction`、`StateFunction`、`ViewFunction`、`PureFunction` 或 `Event`\n- `contractAddress`：类型库的地址\n- `source`：源代码的 Swarm 哈希\n- `types`：直接的子字段，每个都有 `name`、`label` 和数组 `dimensions`（`[\"\"]` 表示 `T[]`，`[\"2\",\"3\"]` 表示 `T[2][3]`）\n\n记录的标识符是 `keccak256(abi.encodePacked(name))`。接口提供 `insert`、`remove`、`count`、`get`、`getByIdentifier`、`getTypeIdentifier` 和 `isRegistered`，并带有 `LogNew` / `LogUpdate` / `LogRemove` 事件。\n\n**规范中的组合示例。** `myBalance = (string accountName, uint256 amount)` 和 `myToken = (address token, myBalance balance)` 使 `myToken` 的 ABI 元组为 `(address,(string,uint256))`。\n\n## 示例代码\n\n组合类型的注册表元数据（JSON）：\n\n```json\n{\n  \"typeChoice\": 0,\n  \"contractAddress\": \"0x...\",\n  \"source\": \"0x...\",\n  \"name\": \"myToken\",\n  \"types\": [\n    { \"name\": \"address\",   \"label\": \"token\",   \"dimensions\": [] },\n    { \"name\": \"myBalance\", \"label\": \"balance\", \"dimensions\": [] }\n  ]\n}\n```\n\n注册表接口的精简版：\n\n```solidity\ninterface IDType {\n    enum TypeChoices { BaseType, PayableFunction, StateFunction, ViewFunction, PureFunction, Event }\n    struct dTypes { string name; string label; string[] dimensions; }\n    struct dType  { TypeChoices typeChoice; address contractAddress; bytes32 source;\n                    string name; dTypes[] types; }\n\n    event LogNew(bytes32 indexed identifier, uint256 indexed index);\n\n    function insert(dType calldata data) external returns (bytes32 identifier);\n    function get(string memory name) external view returns (dType memory);\n    function isRegistered(bytes32 identifier) external view returns (bool);\n}\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 它是针对 Solidity 0.5 以及当时仍属实验性的 ABIEncoderV2 编写的，测试用例从未添加。\n- 治理（谁可以添加或删除类型）和权限被明确排除在范围之外；作者建议不支持更新，并指出 `remove` 有风险。\n- 用普通名称作为键会招致抢注；规范只建议起初禁止单个英文单词。\n- 它被设计为一个更大构想（类型化存储、函数注册表）的第一步，后续提案对此有所描述，这些提案不在当前 EIP 索引中。\n"}},"requiredBy":[1921,2157,2193]}
