{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_signTypedData_v4",
  "params": [
    "0x3b7252d007059ffc82d16d022da3cbf9992d2f70",
    {
      "types": {
        "EIP712Domain": [
          { "name": "name", "type": "string" },
          { "name": "version", "type": "string" },
          { "name": "chainId", "type": "uint256" },
          { "name": "verifyingContract", "type": "address" }
        ],
        "Person": [
          { "name": "name", "type": "string" },
          { "name": "wallet", "type": "address" }
        ]
      },
      "primaryType": "Person",
      "domain": {
        "name": "Example App",
        "version": "1",
        "chainId": 1,
        "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
      },
      "message": {
        "name": "Alice",
        "wallet": "0x3b7252d007059ffc82d16d022da3cbf9992d2f70"
      }
    }
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
}

Defined in EIP-712

Signs structured data according to EIP-712, which provides a more secure way to sign data by providing context and structure to the data being signed.

Parameters

address
string
required

The address that should sign the data (20 bytes).

typedData
object
required

The typed structured data to be signed.

Returns

result
string

The signature as a hexadecimal string.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_signTypedData_v4",
  "params": [
    "0x3b7252d007059ffc82d16d022da3cbf9992d2f70",
    {
      "types": {
        "EIP712Domain": [
          { "name": "name", "type": "string" },
          { "name": "version", "type": "string" },
          { "name": "chainId", "type": "uint256" },
          { "name": "verifyingContract", "type": "address" }
        ],
        "Person": [
          { "name": "name", "type": "string" },
          { "name": "wallet", "type": "address" }
        ]
      },
      "primaryType": "Person",
      "domain": {
        "name": "Example App",
        "version": "1",
        "chainId": 1,
        "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
      },
      "message": {
        "name": "Alice",
        "wallet": "0x3b7252d007059ffc82d16d022da3cbf9992d2f70"
      }
    }
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
}

Error Handling

CodeMessageDescription
4001User rejected the requestUser denied the signing request
4100Requested method not supportedThe method is not supported by the wallet
-32602Invalid paramsInvalid typed data structure

Always validate the domain and verifying contract address to prevent signature replay attacks.

EIP-712 signatures provide better security than personal_sign by giving users context about what they’re signing.