Sign Typed Data V4

Like signTypedData_v3 with added support for arrays

Introduction

The method signTypedData_v4 currently represents the latest version of the EIP-712 spec, with added support for arrays and with a breaking fix for the way structs are encoded.

About

EIP712 offers strong improvements in usability and security. When an EIP712-enabled dApp requests a signature, the user’s wallet shows them the pre-hashed raw data which they may then choose to sign. This makes it much easier for a user to verify it..

Implementing EIP712

This method allows off-chain signatures that that smart contracts can verify on-chain. Key points to check for when implementing EIP712:

  • Design your data structures.
  • Design your domain separator.
  • Code for Signing off-chain messages.
  • Authentication code for the verifying contract.