Typed data hashing and signing

Common structure

The whole idea is heavily inspired by EIP-712arrow-up-right. To get a signature needed to calculate hash(hash(domain), hash(aci), hash(data)).

hash function is blake2b.

domain is a record containing not required properties:

  • name as string,

  • version as integer,

  • networkId as string,

  • contractAddress as ct-encoded string.

aci is part of a complete contract ACI. It defines a type of data to sign. For example, the ACI

{
  "record": [
    { "name": "foo", "type": "string" },
    { "name": "bar", "type": "int" }
  ]
}

corresponds to the data

{ "foo": "test", "bar": 42 }

domain and data are fate-encoded before hashing. aci is prepared for hashing according to RFC8785arrow-up-right.

Implementation

Examples

Last updated

Was this helpful?