0

I have added EIP-712 signing to my site but can't get Safe Wallets to properly sign the request. I have narrowed it down to Safe not generating the correct Hash that is being signed.

All other wallets (metamask, rabby, ledger via wallet connect) sign the message correctly.

EIP-712 data being signed:

{
  "types": {
    "Challenge": [
      {
        "name": "address",
        "type": "address"
      },
      {
        "name": "nonce",
        "type": "string"
      },
      {
        "name": "timestamp",
        "type": "string"
      },
      {
        "name": "endTime",
        "type": "string"
      }
    ],
    "EIP712Domain": [
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "chainId",
        "type": "uint256"
      },
      {
        "name": "version",
        "type": "string"
      },
      {
        "name": "salt",
        "type": "string"
      },
      {
        "name": "verifyingContract",
        "type": "address"
      }
    ]
  },
  "primaryType": "Challenge",
  "domain": {
    "name": "ETHChallenger",
    "version": "1",
    "chainId": 137,
    "verifyingContract": "0xE1bDaAEd869bB9938247629B95700a8dCF7F3208",
    "salt": "0x00000000000000000000000073616c742d646566696e69746976652d73616c74"
  },
  "message": {
    "address": "0xc95695162E47B6C237a0Bd90f500398EFc214896",
    "endTime": "1707281356",
    "nonce": "a5aa13774fdbdc71d2f783116a99e6c8d92b387713ed7626418c5da0a08a9edf",
    "timestamp": "1707277756"
  }
}

Hash expected: 0x56295dbaac48d76c378812d4690b2a5dd427088e8e33c95009682bebe89b48cd

Safe transaction API hashes it as (SafeMessage): 0xb967e4a828282e847cb8bcadb0b5c0756185a5083aea905776f11f0b21fe160a

If I use the safe CLI and the command sign_message --eip712_path test2.json, it produces the expected hash (modified it to print it).

I have verified that other wallets produce the corrected hash of the data. I have also tried using my safe wallet for other data types and they seem to work. Maybe I'm doing something on my end to generate the has, but since other wallets are validating I'm not sure I am. Any help would be appreciated.

1 Answer 1

1

I was able to solve this by removing the salt and version from the domain. Seems like the SAFE API doesn't properly handle these in the domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.