Design Your Domain Separator

To make your signature unique across DApps and Blockchains

While designing the data structure of our data which needs to be signed, we need to ensure that the signature will be unique across multiple DApps and across Blockchains.

Domain Separator is a mandatory field

This helps to prevent a signature meant for one dApp from working in another. As EIP712 explains:

It is possible that two DApps come up with an identical structure like Transfer(address from,address to,uint256 amount) that should not be compatible. By introducing a domain separator the dApp developers are guaranteed that there can be no signature collision.

Our domain separator would look like this:

let domainData = {
  name: "Quote",
  version: "1",
  chainId : "42" // Kovan
  verifyingContract: "0x97b1Efe0BA9730d6C0d9fb75F53173F07521A0d3"
};

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.

The domain separator requires careful thought and effort. Developers must decide which of the following fields to include or exclude based on what makes sense for their use case.

Last updated