EIP-712 signatures

‚Äč

For EIP-712 domain separator information, see Deployments.

Kchannels relies on EIP-712 standard for the hashing and signing of structured data.

Inside Kchannels, the standard representation of an object is JSON; however, when creating or validating signatures, the object is represented with its values only as per EIP-712. The following are additional rules added to help simplify and standardize things:

  • Always use UTF-8 to represent both the JSON object and the ABI representation for EIP-712.

  • Fields within an object always appear in alphabetical order by field name.

  • All values are immutable once populated. Exception to this are lists, which can only be appended new values into, and always at the end.

  • Empty fields appear as empty fields.

  • Timestamps are always represented by an integer in UNIX format: number of milliseconds since 1970.

  • The standard unit for all currency and tokens is the smallest available denomination: wei for Ether and a decimal representation of the token balance. (i.e. store token balances as a fixed-point value and omit the decimal point).

  • Not all fields are being signed: the following fields are always excluded:

    • fields containing list of signatures

    • transaction summary, which are signed separately on transaction completion/failure.

  • Values in a list are always represented in the order they were inserted. Exception to this are fields representing token balances for channel state and tokens transfered within a transaction: these are always sorted ascending by the token smart contract address.