Skip to content

new calculation method: arbitrary EIP-712 messags. #52

@PatrickAlphaC

Description

@PatrickAlphaC

Abstract

Many users often have to sign typed EIP-712 data, but they don't understand what they are signing, this goes for Safe Wallets as well. It would. be great to have a new input method called EIP-712 or Typed Data where they can drop in their JSON of their EIP-712 data and get back the message hashes they are actually signing.

This makes verifying on their hardware wallets MUCH easier, as they can just compare the hashes as opposed to having to scroll through 100 pages on something like a Trezor or Ledger device.

Example

Example JSON:

{
  "domain": {
    "name": "SecurityCouncil",
    "version": "1",
    "chainId": 1,
    "verifyingContract": "0x66E4431266DC7E04E7d8b7FE9d2181253df7F410"
  },
  "primaryType": "ApproveUpgradeSecurityCouncil",
  "types": {
    "EIP712Domain": [
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "version",
        "type": "string"
      },
      {
        "name": "chainId",
        "type": "uint256"
      },
      {
        "name": "verifyingContract",
        "type": "address"
      }
    ],
    "ApproveUpgradeSecurityCouncil": [
      {
        "name": "id",
        "type": "bytes32"
      }
    ]
  },
  "message": {
    "id": "0x2d3883b5d936c6a3c8b4170c4735bbf437de601b3f5afaceeee27b6b52907574"
  }
}

Should result in:

+--------------+--------------------------------------------------------------------+
| EIP 712 Hash | 0x1be8e5ff60e3a11c229dd65f64fcead922ed2e56991362d76f5df5a8e7d4c1c0 |
+--------------+--------------------------------------------------------------------+
| Domain Hash  | 0x4b060214423f60c76da4f8d80253b7c6b565786aaae7afef3be4ae257c66761b |
+--------------+--------------------------------------------------------------------+
| Message Hash | 0x90f31eb2908ee603c92ad37c726548296cf52ed6c4edd39876c3b5dd09447ae5 |
+--------------+--------------------------------------------------------------------+

You can get this from the safe-hash tool by running:

safe-hash typed --file file.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions