{"eip":7871,"title":"Wallet Signing API","description":"Adds a JSON-RPC method for requesting a signature from a wallet","authors":["Lukas Rosario (@lukasrosario)","Jake Moxey (@jxom)","Cody Crozier (@wcrozier12)","Conner Swenberg (@ilikesymmetry)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-01-29","requires":[191,712,5792],"discussionsTo":"https://ethereum-magicians.org/t/new-erc-wallet-signing-api/22718","repo":"ERCs","label":"ERC-7871","officialUrl":"https://eips.ethereum.org/EIPS/eip-7871","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7871.md","url":"https://eips.huatuo.xyz/eip-7871/","tldr":{"en":"Proposes a single wallet_sign JSON-RPC method that covers every EIP-191 signature type (personal_sign, EIP-712 typed data, validator data) with EIP-5792-style capabilities.","ja":"EIP-191 のすべての署名タイプ（personal_sign、EIP-712 の型付きデータ、バリデーターデータ）を、EIP-5792 形式の capabilities で扱う、単一の wallet_sign JSON-RPC メソッドを提案する。","ko":"EIP-191의 모든 서명 유형(personal_sign, EIP-712 타입 데이터, validator 데이터)을 EIP-5792 방식의 capabilities로 다루는 단일 wallet_sign JSON-RPC 메서드를 제안한다.","zh":"提议一个统一的 wallet_sign JSON-RPC 方法，用 EIP-5792 风格的 capabilities 涵盖所有 EIP-191 签名类型（personal_sign、EIP-712 类型化数据、validator 数据）。"},"tags":["wallet","json-rpc","signatures","eip-712","draft"],"explainers":{"en":{"lang":"en","tldr":"Proposes a single wallet_sign JSON-RPC method that covers every EIP-191 signature type (personal_sign, EIP-712 typed data, validator data) with EIP-5792-style capabilities.","tags":["wallet","json-rpc","signatures","eip-712","draft"],"related":[191,712,5792,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7871/","markdown":"## What problem does it solve?\n\nToday a dapp asking for an off-chain signature has to choose between several RPC methods: `personal_sign`, `eth_sign`, `eth_signTypedData_v4` and variants. Each wallet and library supports a slightly different set, and every new signing format would need yet another method.\n\nERC-7871 consolidates them into one method, `wallet_sign`. The type of data being signed is a parameter rather than a method name, so future [EIP-191](/eip-191/) `signed_data` versions can be added without new RPC methods. It also borrows the `capabilities` mechanism from [EIP-5792](/eip-5792/), so wallets can advertise and accept extra signing features.\n\n## How it works\n\n`wallet_sign` takes:\n\n- `version`: version of the `wallet_sign` interface itself (e.g. `\"1.0\"`).\n- `address` (optional): if given, the wallet must sign with exactly that address.\n- `request.type`: the one-byte EIP-191 version.\n- `request.data`: the payload for that version.\n- `capabilities` (optional): EIP-5792-style feature flags, discoverable via `wallet_getCapabilities`.\n\nRequest shapes defined for the existing EIP-191 versions:\n\n| `type` | Meaning | `data` |\n| --- | --- | --- |\n| `0x00` | Data with intended validator | `{ validator, data }` |\n| `0x01` | [EIP-712](/eip-712/) typed data | the full typed-data object |\n| `0x45` | Personal sign | `{ message }` (UTF-8 string) |\n\nThe result is `{ signature, capabilities? }`. New `signed_data` versions are expected to define their request shapes in their own ERCs.\n\n## Sample code\n\nCalling `wallet_sign` through an [EIP-1193](/eip-1193/) provider (TypeScript):\n\n```ts\nconst provider = (window as any).ethereum;\n\n// Personal-sign style message\nconst { signature } = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    request: { type: \"0x45\", data: { message: \"Hello world\" } },\n  }],\n});\n\n// EIP-712 typed data from a specific account\nconst typed = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    address: account,\n    request: {\n      type: \"0x01\",\n      data: {\n        domain: { name: \"Example\", version: \"1\", chainId: 1 },\n        types: { Mail: [{ name: \"contents\", type: \"string\" }] },\n        primaryType: \"Mail\",\n        message: { contents: \"hi\" },\n      },\n    },\n  }],\n});\n```\n\n## Things to know\n\n- **Status: Draft.** The Rationale, Backwards Compatibility and Security Considerations sections are still empty, and the interface may change.\n- Not a replacement you can rely on yet: check wallet support (for example via `wallet_getCapabilities`) and fall back to `personal_sign` / `eth_signTypedData_v4`.\n- The spec does not wrap the params in an array explicitly; the array form above follows the usual JSON-RPC convention and may differ by wallet.\n- Signatures are still standard EIP-191 / EIP-712 signatures; verification on-chain or off-chain is unchanged.\n"},"ja":{"lang":"ja","tldr":"EIP-191 のすべての署名タイプ（personal_sign、EIP-712 の型付きデータ、バリデーターデータ）を、EIP-5792 形式の capabilities で扱う、単一の wallet_sign JSON-RPC メソッドを提案する。","tags":["wallet","json-rpc","signatures","eip-712","draft"],"related":[191,712,5792,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7871/","markdown":"## 何を解決するのか\n\n現在、オフチェーン署名を求める dapp は、`personal_sign`、`eth_sign`、`eth_signTypedData_v4` やそのバリエーションなど、複数の RPC メソッドから選ばなければなりません。ウォレットやライブラリごとに対応するセットが少しずつ異なり、新しい署名形式が出るたびに、さらに別のメソッドが必要になります。\n\nERC-7871 はそれらを 1 つのメソッド `wallet_sign` に統合します。署名対象のデータの種類はメソッド名ではなくパラメータになるため、将来の [EIP-191](/eip-191/) の `signed_data` バージョンを、新しい RPC メソッドなしで追加できます。また、[EIP-5792](/eip-5792/) の `capabilities` の仕組みを借りているため、ウォレットは追加の署名機能を公開して受け付けられます。\n\n## 仕組み\n\n`wallet_sign` は次を受け取ります。\n\n- `version`: `wallet_sign` インターフェース自体のバージョン（例: `\"1.0\"`）。\n- `address`（任意）: 指定された場合、ウォレットはまさにそのアドレスで署名しなければなりません。\n- `request.type`: 1 バイトの EIP-191 バージョン。\n- `request.data`: そのバージョン用のペイロード。\n- `capabilities`（任意）: EIP-5792 形式の機能フラグ。`wallet_getCapabilities` で確認できます。\n\n既存の EIP-191 バージョン向けに定義されたリクエストの形:\n\n| `type` | 意味 | `data` |\n| --- | --- | --- |\n| `0x00` | 意図されたバリデーター付きのデータ | `{ validator, data }` |\n| `0x01` | [EIP-712](/eip-712/) の型付きデータ | 型付きデータのオブジェクト全体 |\n| `0x45` | Personal sign | `{ message }`（UTF-8 文字列） |\n\n結果は `{ signature, capabilities? }` です。新しい `signed_data` バージョンは、リクエストの形をそれぞれの ERC で定義することが想定されています。\n\n## サンプルコード\n\n[EIP-1193](/eip-1193/) プロバイダー経由で `wallet_sign` を呼び出す（TypeScript）:\n\n```ts\nconst provider = (window as any).ethereum;\n\n// Personal-sign style message\nconst { signature } = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    request: { type: \"0x45\", data: { message: \"Hello world\" } },\n  }],\n});\n\n// EIP-712 typed data from a specific account\nconst typed = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    address: account,\n    request: {\n      type: \"0x01\",\n      data: {\n        domain: { name: \"Example\", version: \"1\", chainId: 1 },\n        types: { Mail: [{ name: \"contents\", type: \"string\" }] },\n        primaryType: \"Mail\",\n        message: { contents: \"hi\" },\n      },\n    },\n  }],\n});\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** Rationale、Backwards Compatibility、Security Considerations の各節はまだ空で、インターフェースは変わる可能性があります。\n- まだ頼れる代替手段ではありません。ウォレットの対応状況を（たとえば `wallet_getCapabilities` で）確認し、`personal_sign` / `eth_signTypedData_v4` にフォールバックしてください。\n- 仕様は params を配列で包むことを明示していません。上の配列形式は一般的な JSON-RPC の慣例に従ったもので、ウォレットによって異なる場合があります。\n- 署名は引き続き標準的な EIP-191 / EIP-712 の署名であり、オンチェーンでもオフチェーンでも検証方法は変わりません。\n"},"ko":{"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"],"related":[191,712,5792,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7871/","markdown":"## 어떤 문제를 해결하나요?\n\n오늘날 오프체인 서명을 요청하는 dapp은 `personal_sign`, `eth_sign`, `eth_signTypedData_v4`와 그 변형 같은 여러 RPC 메서드 중에서 골라야 합니다. 지갑과 라이브러리마다 지원하는 집합이 조금씩 다르고, 새로운 서명 형식이 나올 때마다 또 다른 메서드가 필요해집니다.\n\nERC-7871은 이를 `wallet_sign`이라는 하나의 메서드로 통합합니다. 서명할 데이터의 유형은 메서드 이름이 아니라 파라미터이므로, 앞으로의 [EIP-191](/eip-191/) `signed_data` 버전을 새로운 RPC 메서드 없이 추가할 수 있습니다. 또한 [EIP-5792](/eip-5792/)의 `capabilities` 메커니즘을 가져와, 지갑이 추가 서명 기능을 알리고 받아들일 수 있게 합니다.\n\n## 어떻게 동작하나요?\n\n`wallet_sign`은 다음을 받습니다.\n\n- `version`: `wallet_sign` 인터페이스 자체의 버전(예: `\"1.0\"`).\n- `address`(선택): 주어지면 지갑은 정확히 그 주소로 서명해야 합니다.\n- `request.type`: 1바이트 EIP-191 버전.\n- `request.data`: 해당 버전의 페이로드.\n- `capabilities`(선택): EIP-5792 방식의 기능 플래그로, `wallet_getCapabilities`로 확인할 수 있습니다.\n\n기존 EIP-191 버전에 대해 정의된 요청 형태:\n\n| `type` | 의미 | `data` |\n| --- | --- | --- |\n| `0x00` | 지정된 검증자가 있는 데이터 | `{ validator, data }` |\n| `0x01` | [EIP-712](/eip-712/) 타입 데이터 | 전체 타입 데이터 객체 |\n| `0x45` | Personal sign | `{ message }`(UTF-8 문자열) |\n\n결과는 `{ signature, capabilities? }`입니다. 새로운 `signed_data` 버전은 요청 형태를 각자의 ERC에서 정의할 것으로 기대됩니다.\n\n## 샘플 코드\n\n[EIP-1193](/eip-1193/) provider로 `wallet_sign` 호출하기(TypeScript):\n\n```ts\nconst provider = (window as any).ethereum;\n\n// Personal-sign style message\nconst { signature } = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    request: { type: \"0x45\", data: { message: \"Hello world\" } },\n  }],\n});\n\n// EIP-712 typed data from a specific account\nconst typed = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    address: account,\n    request: {\n      type: \"0x01\",\n      data: {\n        domain: { name: \"Example\", version: \"1\", chainId: 1 },\n        types: { Mail: [{ name: \"contents\", type: \"string\" }] },\n        primaryType: \"Mail\",\n        message: { contents: \"hi\" },\n      },\n    },\n  }],\n});\n```\n\n## 알아둘 점\n\n- **상태: Draft.** Rationale, Backwards Compatibility, Security Considerations 절은 아직 비어 있으며 인터페이스가 바뀔 수 있습니다.\n- 아직은 믿고 의존할 수 있는 대체재가 아닙니다. 지갑 지원 여부를(예: `wallet_getCapabilities`로) 확인하고 `personal_sign` / `eth_signTypedData_v4`로 폴백하세요.\n- 명세는 params를 배열로 감싸는 것을 명시하지 않습니다. 위의 배열 형태는 일반적인 JSON-RPC 관례를 따른 것이며 지갑에 따라 다를 수 있습니다.\n- 서명은 여전히 표준 EIP-191 / EIP-712 서명이며, 온체인이든 오프체인이든 검증 방식은 바뀌지 않습니다.\n"},"zh":{"lang":"zh","tldr":"提议一个统一的 wallet_sign JSON-RPC 方法，用 EIP-5792 风格的 capabilities 涵盖所有 EIP-191 签名类型（personal_sign、EIP-712 类型化数据、validator 数据）。","tags":["wallet","json-rpc","signatures","eip-712","draft"],"related":[191,712,5792,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7871/","markdown":"## 它解决什么问题？\n\n如今，dapp 请求链下签名时必须在多个 RPC 方法之间选择：`personal_sign`、`eth_sign`、`eth_signTypedData_v4` 及其变体。每个钱包和库支持的集合都略有不同，每出现一种新的签名格式，就又需要一个新方法。\n\nERC-7871 把它们整合成一个方法 `wallet_sign`。被签署数据的类型是一个参数，而不是方法名，所以未来的 [EIP-191](/eip-191/) `signed_data` 版本可以在不增加新 RPC 方法的情况下加入。它还借用了 [EIP-5792](/eip-5792/) 的 `capabilities` 机制，让钱包可以声明并接受额外的签名功能。\n\n## 它如何运作\n\n`wallet_sign` 接受：\n\n- `version`：`wallet_sign` 接口本身的版本（例如 `\"1.0\"`）。\n- `address`（可选）：如果提供，钱包必须恰好用该地址签名。\n- `request.type`：一字节的 EIP-191 版本。\n- `request.data`：该版本对应的载荷。\n- `capabilities`（可选）：EIP-5792 风格的功能标志，可通过 `wallet_getCapabilities` 发现。\n\n为现有 EIP-191 版本定义的请求结构：\n\n| `type` | 含义 | `data` |\n| --- | --- | --- |\n| `0x00` | 带指定验证者的数据 | `{ validator, data }` |\n| `0x01` | [EIP-712](/eip-712/) 类型化数据 | 完整的类型化数据对象 |\n| `0x45` | Personal sign | `{ message }`（UTF-8 字符串） |\n\n返回结果是 `{ signature, capabilities? }`。新的 `signed_data` 版本预计会在各自的 ERC 中定义其请求结构。\n\n## 示例代码\n\n通过 [EIP-1193](/eip-1193/) provider 调用 `wallet_sign`（TypeScript）：\n\n```ts\nconst provider = (window as any).ethereum;\n\n// Personal-sign style message\nconst { signature } = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    request: { type: \"0x45\", data: { message: \"Hello world\" } },\n  }],\n});\n\n// EIP-712 typed data from a specific account\nconst typed = await provider.request({\n  method: \"wallet_sign\",\n  params: [{\n    version: \"1.0\",\n    address: account,\n    request: {\n      type: \"0x01\",\n      data: {\n        domain: { name: \"Example\", version: \"1\", chainId: 1 },\n        types: { Mail: [{ name: \"contents\", type: \"string\" }] },\n        primaryType: \"Mail\",\n        message: { contents: \"hi\" },\n      },\n    },\n  }],\n});\n```\n\n## 需要注意\n\n- **状态：Draft。** Rationale、Backwards Compatibility 和 Security Considerations 部分仍然是空的，接口也可能变化。\n- 目前还不是可以依赖的替代方案：请检查钱包的支持情况（例如通过 `wallet_getCapabilities`），并回退到 `personal_sign` / `eth_signTypedData_v4`。\n- 规范没有明确把参数包在数组里；上面的数组形式遵循通常的 JSON-RPC 惯例，不同钱包可能有所差异。\n- 签名仍是标准的 EIP-191 / EIP-712 签名；链上或链下的验证方式不变。\n"}}}
