Describe Your Structs

Prepare the data structure for signatures

We need some data structure to store the information that will be signed by the user.

Below we can see two structs EIP712Domain and MetaTransaction.

struct EIP712Domain {
    string name;
    string version;
    uint256 chainId;
    address verifyingContract;
}

struct MetaTransaction {
		uint256 nonce;
		address from;
}

MetaTransaction

It will store the data related to transaction.

nonce : It is a unique value chosen by an entity in a protocol which is used to protect the entity against replay attacks

from : Public key of the user signing the message.

EIP712Domain

It will store information related to domain to make the the data values unique across DApps and Blockchains.

name: the dApp name, e.g. β€œQuote”

version: The current version number of your dApp or platform. It prevents signatures from one dApp version from working with those of others.

chainId: Network Id e.g. Kovan Testnet = 42; Main Network = 1

verifyingContract: The contract address that will verify the resulting signature.

Last updated