Defines a new JSON-RPC method wallet_sign which enables apps to ask a wallet to sign EIP-191 messages.
Applications can use this JSON-RPC method to request a signature over any version of signed_data as defined by EIP-191. The new JSON-RPC method allows for support of future EIP-191signed_data versions.
The new JSON-RPC method also supports EIP-5792-style capabilities, and support for signing capabilities can be discovered using wallet_getCapabilities as defined in EIP-5792.
Motivation
Wallets and developer tools currently support multiple JSON-RPC methods for handling offchain signature requests. This proposal simplifies wallet & tooling implementations by consolidating these requests under a single wallet_sign JSON-RPC method. This also leaves room for new EIP-191signed_data versions without needing to introduce a new corresponding JSON-RPC method.
Furthermore, this new wallet_sign method introduces new functionalities via EIP-5792-style capabilities.
Specification
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.
One new JSON-RPC method is introduced.
wallet_sign
Requests a signature over EIP-191signed_data from a wallet.
The top-level version parameter is for specifying the version of wallet_sign should the top-level interface change.
The request.type parameter is for specifying the EIP-191signed_dataversion (e.g. 0x01 for structured data, 0x45 for personal_sign messaged). The request.data parameter is the corresponding data according to the signed_dataversion.
The optional address parameter is for requesting a signature from a specified address. If included, the wallet MUST respect it and only respond with a signature from that address.
The capabilities field is how an app can communicate with a wallet about capabilities that a wallet supports.
This proposal defines request schemas for the three signed_data versions currently in EIP-191 (0x00, 0x01, 0x45). Any future signed_data versions can be supported by wallet_sign, and their request interfaces are left to future ERCs.
wallet_sign RPC Specification
typeCapability={[key:string]:unknown;optional?:boolean;}typeSignParams={version:string;address?:`0x${string}`;request:{type:`0x${string}`;// 1-byte EIP-191 versiondata:any;// data corresponding to the above version};capabilities?:Record<string,Capability>;};typeSignResult={signature:`0x${string}`;capabilities?:Record<string,any>;};
Request Interfaces
Below are request interfaces for the signed_dataversions specified in EIP-191 at time of writing. These include:
Any new request interfaces corresponding to new signed_dataversions SHOULD be defined in their own ERCs.
typeValidatorRequest={type:'0x00';data:{validator:`0x${string}`;// Intended validator addressdata:`0x${string}`;// Data to sign};}typeTypedDataRequest={type:'0x01';data:{...TypedData// TypedData as defined by EIP-712}}typePersonalSignRequest={type:'0x45';data:{message:string;// UTF-8 message string}}