EIP-712: How to Verify Typed Data On Chain

Leon Do
Published in
2 min readDec 24, 2022


Implementing EIP-712: Typed structured data hashing and signing


The idea of EIP-712 is to standardize hashing and signing of typed structured data as instead to just byte strings. Below are the different ways of signing

Signing typed data allows the user to view human readable data before confirming instead of an arbitrary hexadecimal string.

Copy trading bots from the top traders. Try it for FREE.




The message params are divided into:

Domain: The below values are hashed to prevent others dapp from using the same signature.

  • name: Name of the dapp
  • version: Version of the dapp
  • chainId: To prevent replay attacks
  • verifyingContract: Address of the contract that will verify the signature

Message: The typed data (JSON) to sign. In the above example, the data is { "myValue": 123 }

Primary Type: Represents the top-level type of the object

Types: Defines all of the types


The smart contract function is divided into:

Defining types to match the signing (javascript) code.

Hashing the domain separator and the values.

Splitting the signature to r , s , v

ECRecover to verify the signature

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read