---
eip: 1900
label: ERC-1900
title: dType - Decentralized Type System for EVM
status: Stagnant
type: Standards Track
category: ERC
created: 2019-03-28
official: https://eips.ethereum.org/EIPS/eip-1900
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1900.md
canonical: https://eips.huatuo.xyz/ko/eip-1900/
lang: ko
tldr: dType은 Solidity 타입(구조체와 그 라이브러리)의 온체인 레지스트리를 제안한다. 프로젝트들이 데이터 정의를 공유하고 도구가 데이터를 일관되게 디코딩할 수 있게 한다.
tags: [types, registry, abi, solidity, interoperability]
---

# ERC-1900: dType - Decentralized Type System for EVM

> 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).

**TL;DR:** dType은 Solidity 타입(구조체와 그 라이브러리)의 온체인 레지스트리를 제안한다. 프로젝트들이 데이터 정의를 공유하고 도구가 데이터를 일관되게 디코딩할 수 있게 한다.

## 어떤 문제를 해결하나요?

이더리움의 모든 프로젝트는 같은 것을 나타내더라도 각자 자기 구조체를 정의합니다. "잔액"이나 "토큰 수량" 타입을 모두 가진 두 프로토콜은 맞춤 연결 코드 없이는 서로 데이터를 주고받을 수 없고, 블록 탐색기는 디코딩하려면 각 컨트랙트의 ABI를 따로 알려 줘야 합니다.

dType("탈중앙 타입 시스템")은 공유되는 온체인 **타입 레지스트리**를 제안합니다. 타입은 ABI를 재구성할 수 있을 만큼의 메타데이터와 함께 한 번 등록되고, 누구나 이를 재사용하거나, 더 큰 타입으로 조합하거나, 이를 쓰는 데이터를 디코딩할 수 있습니다.

## 어떻게 동작하나요?

**타입 라이브러리.** 각 타입은 `struct`와, `isInstanceOf`(검증), `structureBytes` / `destructureBytes`(인코딩과 디코딩) 같은 헬퍼, 그리고 `map`, `filter`, `reduce` 같은 고차 함수를 담은 Solidity 라이브러리로 정의됩니다. 타입은 다른 타입을 포함할 수 있으며 항상 방향성 비순환 그래프를 이룹니다.

**레지스트리 레코드.** 각 타입마다 레지스트리는 다음을 저장합니다.

- `name`: Solidity 타입 이름. 선택적으로 버전을 붙입니다
- `typeChoice`: `BaseType`, `PayableFunction`, `StateFunction`, `ViewFunction`, `PureFunction`, `Event` 중 하나
- `contractAddress`: 타입 라이브러리의 주소
- `source`: 소스 코드의 Swarm 해시
- `types`: 직접 하위 필드. 각각 `name`, `label`, 배열 `dimensions`를 가집니다(`[""]`는 `T[]`, `["2","3"]`은 `T[2][3]`을 뜻합니다)

레코드의 식별자는 `keccak256(abi.encodePacked(name))`입니다. 인터페이스는 `insert`, `remove`, `count`, `get`, `getByIdentifier`, `getTypeIdentifier`, `isRegistered`를 제공하며 `LogNew` / `LogUpdate` / `LogRemove` 이벤트가 있습니다.

**명세의 조합 예시.** `myBalance = (string accountName, uint256 amount)`와 `myToken = (address token, myBalance balance)`로부터 `myToken`의 ABI 튜플 `(address,(string,uint256))`가 나옵니다.

## 샘플 코드

조합된 타입의 레지스트리 메타데이터(JSON):

```json
{
  "typeChoice": 0,
  "contractAddress": "0x...",
  "source": "0x...",
  "name": "myToken",
  "types": [
    { "name": "address",   "label": "token",   "dimensions": [] },
    { "name": "myBalance", "label": "balance", "dimensions": [] }
  ]
}
```

레지스트리 인터페이스의 축약본:

```solidity
interface IDType {
    enum TypeChoices { BaseType, PayableFunction, StateFunction, ViewFunction, PureFunction, Event }
    struct dTypes { string name; string label; string[] dimensions; }
    struct dType  { TypeChoices typeChoice; address contractAddress; bytes32 source;
                    string name; dTypes[] types; }

    event LogNew(bytes32 indexed identifier, uint256 indexed index);

    function insert(dType calldata data) external returns (bytes32 identifier);
    function get(string memory name) external view returns (dType memory);
    function isRegistered(bytes32 identifier) external view returns (bool);
}
```

## 알아둘 점

- **상태: Stagnant.** 당시 실험적이던 ABIEncoderV2를 사용해 Solidity 0.5 기준으로 작성되었으며, 테스트 케이스는 추가되지 않았습니다.
- 거버넌스(누가 타입을 추가하거나 제거할 수 있는가)와 권한은 명시적으로 범위 밖입니다. 저자들은 업데이트를 지원하지 않기를 제안하며 `remove`는 위험하다고 밝힙니다.
- 단순한 이름을 키로 쓰면 이름 선점(name squatting)을 부릅니다. 명세는 처음에는 영어 단어 하나짜리 이름을 금지하자고만 제안합니다.
- 이는 현재 EIP 목록 밖의 후속 제안에서 설명하는 더 큰 구상(타입이 있는 스토리지, 함수 레지스트리)의 첫 단계로 설계되었습니다.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1900
