---
eip: 6662
label: ERC-6662
title: AA Account Metadata For Authentication
status: Draft
type: Standards Track
category: ERC
created: 2023-03-09
requires: 4337, 4804
official: https://eips.ethereum.org/EIPS/eip-6662
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6662.md
canonical: https://eips.huatuo.xyz/ko/eip-6662/
lang: ko
tldr: ERC-4337 초안 확장. 스마트 계정이 인증기(authenticator)의 위치와 받아들이는 요청 형식을 온체인에 공개해, 미리 연결된 지갑 없이도 dApp이 서명을 요청할 수 있게 한다.
tags: [account-abstraction, authentication, erc4337, smart-account, metadata]
---

# ERC-6662: AA Account Metadata For Authentication

> An ERC-4337 extension to define a new authentication model

**TL;DR:** ERC-4337 초안 확장. 스마트 계정이 인증기(authenticator)의 위치와 받아들이는 요청 형식을 온체인에 공개해, 미리 연결된 지갑 없이도 dApp이 서명을 요청할 수 있게 한다.

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

오늘날 dApp은 "지갑 연결"을 한 뒤에야 내 계정을 알게 됩니다. 지갑이 사이트에 주소를 넘겨 주고, 모든 서명 요청은 그 연결을 통해 돌아옵니다. 스마트 컨트랙트 계정([ERC-4337](/eip-4337/))에서는 작업을 실제로 승인하는 주체가 무엇이든 될 수 있습니다. 휴대폰 앱, 클라우드 서명 서비스, 하드웨어 기기 등이 그 예입니다. dApp이 이를 찾아낼 표준 방법은 없습니다.

ERC-6662는 계정이 인증 정보를 온체인에 한 번만 공개하게 해 줍니다. 계정 주소만 있으면 dApp은 서명 요청을 어디로, 어떤 형식으로 보내야 하는지 조회할 수 있습니다.

## 어떻게 동작하나요?

역할은 세 가지입니다.

- **Authenticator(인증기)**: 사용자 오퍼레이션에 서명하는 키를 가진 주체(모바일 앱, 온라인 서비스 등).
- **Relay(릴레이)**: dApp의 요청을 인증기로 전달하는 온라인 서비스. 온라인 인증기는 스스로 릴레이가 될 수 있습니다.
- **dApp**: 계정의 메타데이터를 읽고 릴레이에 `AuthenticationRequest`를 보냅니다.

스마트 계정은 ERC-4337의 `IAccount`와 함께 `IAccountMetadata`를 구현합니다.

- `getAuthenticationInfo()`는 `AuthenticatorInfo { string[] relayURI; string schema; }`의 목록을 반환합니다.
- `relayURI`는 릴레이 엔드포인트 목록이며, dApp은 순서대로 시도해 처음으로 동작하는 것을 사용합니다.
- `schema`는 `AuthenticationRequest`를 설명하는 JSON Schema입니다(인라인이거나 URI이며, 온체인에 저장할 경우 [ERC-4804](/eip-4804/)의 `web3://`를 사용). 일반적인 요청에는 엔트리포인트 주소, 체인 ID, 서명되지 않은 `UserOperation`이 담깁니다.

`AuthenticatorInfo` 항목을 여러 개 두면 멀티시그가 가능합니다. 각 인증기가 독립적으로 서명하고 ERC-4337 어그리게이터가 서명을 합칩니다.

## 샘플 코드

인터페이스와 dApp 쪽 조회 코드(ethers v6):

```solidity
interface IAccountMetadata {
    struct AuthenticatorInfo {
        string[] relayURI; // where to send requests
        string schema;     // JSON schema or URI for AuthenticationRequest
    }
    function getAuthenticationInfo() external view returns (AuthenticatorInfo[] memory);
}
```

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

const account = new Contract(smartAccountAddr, [
  "function getAuthenticationInfo() view returns ((string[] relayURI, string schema)[])",
], provider);

const [first] = await account.getAuthenticationInfo();
const request = {
  entrypoint: ENTRYPOINT_ADDRESS,
  chainId: "0x1",
  userOp: unsignedUserOp, // ERC-4337 UserOperation without signature
};
for (const uri of first.relayURI) {
  const res = await fetch(uri, { method: "POST", body: JSON.stringify(request) });
  if (res.ok) break; // first working relay wins
}
```

## 알아둘 점

- **상태: Draft.** 릴레이 프로토콜, 전송 방식, dApp 자체의 인증은 표준화되어 있지 않으며 스키마는 계정이 정의합니다.
- 릴레이는 요청 내용을 볼 수 있습니다. 명세는 릴레이가 읽거나 프런트런하지 못하도록 JWE 같은 종단 간 암호화(콘텐츠 키를 서명자에게 암호화)를 권장합니다.
- 온체인 메타데이터는 공개됩니다. 릴레이 URI를 공개하면 어떤 서비스가 내 계정을 뒷받침하는지 드러납니다.
- 샘플의 요청 필드는 명세의 예시 스키마를 따른 것이며, 실제 계정은 다른 필드를 요구할 수 있습니다.


---

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