---
eip: 7871
label: ERC-7871
title: Wallet Signing API
status: Draft
type: Standards Track
category: ERC
created: 2024-01-29
requires: 191, 712, 5792
official: https://eips.ethereum.org/EIPS/eip-7871
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7871.md
canonical: https://eips.huatuo.xyz/ko/eip-7871/
lang: ko
tldr: EIP-191의 모든 서명 유형(personal_sign, EIP-712 타입 데이터, validator 데이터)을 EIP-5792 방식의 capabilities로 다루는 단일 wallet_sign JSON-RPC 메서드를 제안한다.
tags: [wallet, json-rpc, signatures, eip-712, draft]
---

# ERC-7871: Wallet Signing API

> Adds a JSON-RPC method for requesting a signature from a wallet

**TL;DR:** EIP-191의 모든 서명 유형(personal_sign, EIP-712 타입 데이터, validator 데이터)을 EIP-5792 방식의 capabilities로 다루는 단일 wallet_sign JSON-RPC 메서드를 제안한다.

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

오늘날 오프체인 서명을 요청하는 dapp은 `personal_sign`, `eth_sign`, `eth_signTypedData_v4`와 그 변형 같은 여러 RPC 메서드 중에서 골라야 합니다. 지갑과 라이브러리마다 지원하는 집합이 조금씩 다르고, 새로운 서명 형식이 나올 때마다 또 다른 메서드가 필요해집니다.

ERC-7871은 이를 `wallet_sign`이라는 하나의 메서드로 통합합니다. 서명할 데이터의 유형은 메서드 이름이 아니라 파라미터이므로, 앞으로의 [EIP-191](/eip-191/) `signed_data` 버전을 새로운 RPC 메서드 없이 추가할 수 있습니다. 또한 [EIP-5792](/eip-5792/)의 `capabilities` 메커니즘을 가져와, 지갑이 추가 서명 기능을 알리고 받아들일 수 있게 합니다.

## 어떻게 동작하나요?

`wallet_sign`은 다음을 받습니다.

- `version`: `wallet_sign` 인터페이스 자체의 버전(예: `"1.0"`).
- `address`(선택): 주어지면 지갑은 정확히 그 주소로 서명해야 합니다.
- `request.type`: 1바이트 EIP-191 버전.
- `request.data`: 해당 버전의 페이로드.
- `capabilities`(선택): EIP-5792 방식의 기능 플래그로, `wallet_getCapabilities`로 확인할 수 있습니다.

기존 EIP-191 버전에 대해 정의된 요청 형태:

| `type` | 의미 | `data` |
| --- | --- | --- |
| `0x00` | 지정된 검증자가 있는 데이터 | `{ validator, data }` |
| `0x01` | [EIP-712](/eip-712/) 타입 데이터 | 전체 타입 데이터 객체 |
| `0x45` | Personal sign | `{ message }`(UTF-8 문자열) |

결과는 `{ signature, capabilities? }`입니다. 새로운 `signed_data` 버전은 요청 형태를 각자의 ERC에서 정의할 것으로 기대됩니다.

## 샘플 코드

[EIP-1193](/eip-1193/) provider로 `wallet_sign` 호출하기(TypeScript):

```ts
const provider = (window as any).ethereum;

// Personal-sign style message
const { signature } = await provider.request({
  method: "wallet_sign",
  params: [{
    version: "1.0",
    request: { type: "0x45", data: { message: "Hello world" } },
  }],
});

// EIP-712 typed data from a specific account
const typed = await provider.request({
  method: "wallet_sign",
  params: [{
    version: "1.0",
    address: account,
    request: {
      type: "0x01",
      data: {
        domain: { name: "Example", version: "1", chainId: 1 },
        types: { Mail: [{ name: "contents", type: "string" }] },
        primaryType: "Mail",
        message: { contents: "hi" },
      },
    },
  }],
});
```

## 알아둘 점

- **상태: Draft.** Rationale, Backwards Compatibility, Security Considerations 절은 아직 비어 있으며 인터페이스가 바뀔 수 있습니다.
- 아직은 믿고 의존할 수 있는 대체재가 아닙니다. 지갑 지원 여부를(예: `wallet_getCapabilities`로) 확인하고 `personal_sign` / `eth_signTypedData_v4`로 폴백하세요.
- 명세는 params를 배열로 감싸는 것을 명시하지 않습니다. 위의 배열 형태는 일반적인 JSON-RPC 관례를 따른 것이며 지갑에 따라 다를 수 있습니다.
- 서명은 여전히 표준 EIP-191 / EIP-712 서명이며, 온체인이든 오프체인이든 검증 방식은 바뀌지 않습니다.


---

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