Help with how EIP712 works?

I read ERC20permit.sol which uses EIP712.sol on Openzeppelin.

In ERC20permit.sol, it uses the below typehash to calculate the hash to be signed.

        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

From the EIP712 proposal (, they seemed to want MetaMask etc to recognize the massage to be signed. But how does MetaMask do it? Some typehash related info would surely needed to be passed to MetaMask, but what else, and in what format? Can someone give some help or link to some working examples of how this is done? Thank you!

You may find this page useful:

MetaMask receives a request from the front end that includes all of the type information.

1 Like