---
eip: 634
label: ERC-634
title: Storage of text records in ENS
status: Stagnant
type: Standards Track
category: ERC
created: 2017-05-17
requires: 137, 165
official: https://eips.ethereum.org/EIPS/eip-634
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-634.md
canonical: https://eips.huatuo.xyz/ko/eip-634/
lang: ko
tldr: ENS 리졸버 프로필 text(node, key). 이름에 아바타, 웹사이트, 이메일, 트위터 핸들 같은 임의의 키/값 텍스트를 저장할 수 있게 해, ENS 이름을 간단한 공개 프로필로 만든다.
tags: [ens, naming, profile, resolver, metadata]
---

# ERC-634: Storage of text records in ENS

> Profiles for ENS resolvers to store arbitrary text key/value pairs.

**TL;DR:** ENS 리졸버 프로필 text(node, key). 이름에 아바타, 웹사이트, 이메일, 트위터 핸들 같은 임의의 키/값 텍스트를 저장할 수 있게 해, ENS 이름을 간단한 공개 프로필로 만든다.

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

[ENS](/eip-137/)는 `alice.eth` 같은 사람이 읽을 수 있는 이름을 주소, 콘텐츠 해시 같은 기계용 데이터에 매핑합니다. 사람들은 이름에 웹사이트, 이메일 주소, 아바타, 소셜 계정 같은 사람이 읽을 수 있는 정보도 붙이고 싶어 했습니다. 데이터 종류마다 리졸버 함수를 따로 추가하면 새로운 요구를 결코 따라잡을 수 없습니다.

EIP-634는 DNS `TXT` 레코드의 아이디어를 빌려 옵니다. 임의의 키에 대해 텍스트 값을 반환하는 범용 함수 하나를 추가하므로, 새로운 종류의 데이터에는 새 키만 있으면 되고 새 컨트랙트 인터페이스는 필요하지 않습니다.

## 어떻게 동작하나요?

이 프로필을 지원하는 리졸버는 다음을 구현합니다.

```solidity
function text(bytes32 node, string calldata key) external view returns (string memory);
```

- `node`는 이름의 ENS namehash입니다.
- 값은 임의의 UTF-8 문자열입니다. 키가 설정되지 않았다면 리졸버는 `""`를 반환해야 합니다.
- [EIP-165](/eip-165/) 인터페이스 ID는 `0x59d1d43c`이므로, 클라이언트가 먼저 지원 여부를 확인할 수 있습니다.

키는 세 그룹으로 나뉩니다.

- **전역 키**는 소문자, 숫자, 하이픈을 사용합니다. `avatar`, `description`, `display`, `email`, `keywords`, `mail`, `notice`, `location`, `phone`(E.164 형식), `url`입니다. `display`를 설정하는 경우 대소문자를 무시하고 이름과 일치해야 합니다. 예를 들어 `ricmoo.eth`라면 `RicMoo.eth`입니다. 그렇지 않으면 클라이언트는 이를 무시해야 합니다.
- **서비스 키**는 서비스가 소유한 네임스페이스를 역방향 DNS 표기로 나타내며 점을 하나 이상 포함합니다. `com.github`, `com.twitter`, `com.linkedin`, `io.keybase`, `org.telegram` 등이 있습니다. 서비스는 `com.example.users` 같은 계층 구조를 정의할 수도 있습니다.
- **레거시 키**(`vnd.github`, `vnd.twitter`, `vnd.peepeth`)는 이전 초안에서 온 것입니다. 클라이언트는 폴백으로 조회할 수 있습니다.

## 샘플 코드

ethers v6로 텍스트 레코드 읽기:

```ts
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const resolver = await provider.getResolver("vitalik.eth");
if (resolver) {
  const url = await resolver.getText("url");
  const twitter = await resolver.getText("com.twitter");
  console.log({ url, twitter }); // empty or null when the key is unset
}
```

이름별로 레코드를 저장하는 최소한의 리졸버(접근 제어 없음, 설명용):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract TextResolver {
    event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);
    mapping(bytes32 => mapping(string => string)) private texts;

    function setText(bytes32 node, string calldata key, string calldata value) external {
        texts[node][key] = value; // real resolvers check the caller owns `node`
        emit TextChanged(node, key, key);
    }

    function text(bytes32 node, string calldata key) external view returns (string memory) {
        return texts[node][key];
    }

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == 0x59d1d43c || id == 0x01ffc9a7;
    }
}
```

## 알아둘 점

- **이 EIP의 상태는 Stagnant입니다.** 그럼에도 텍스트 레코드 인터페이스는 ENS 리졸버에 구현되어 있고 지갑과 앱이 읽습니다. 현재 ENS는 이를 ENSIP-5로 관리합니다.
- 텍스트 레코드는 온체인 공개 데이터입니다. 개인 이메일이나 전화번호처럼 공개하고 싶지 않은 내용은 저장하지 마세요.
- 값은 검증되지 않습니다. `com.twitter` 레코드는 이름 소유자의 주장만 보여 줄 뿐, 그 계정을 실제로 제어한다는 증거는 아닙니다.
- `avatar` 값은 보통 URL이지만 클라이언트마다 해석할 수 있는 형식이 다르므로, 대상 지갑에서 테스트하세요.


---

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