Serializations

Serialization is how the value should be stringified for signing and for transfer between systems. Most serializations use outside standards, but some requiring additional clarifications are provided here.

decimal

Used to represent integers. Strings are used to avoid issues with different implementations of numbers.

  • MUST use 0-9 representation
  • MUST NOT have spaces or separators
  • MUST be a string
InvalidWhyValid
0x123Must be decimal"291"
291Must be a string"291"
291nBigInt(291) serialization appends an n"291"

hexadecimal

Used to represent bytes.

  • MUST use 0-9 and a-f representation
  • MUST be lowercase
  • MUST be prefixed with a 0x
  • MUST NOT have spaces or separators
  • MUST have two characters per byte in addition to the 0x characters
BytesInvalidValid
20x1230x0123
2123h0x0123
20x0ABC0x0abc
80xabc0x0000000000000abc
320x3e34c4325f4461b9355027b314f3eb56d31af549f7da7bd9ef1ce951651e0x00003e34c4325f4461b9355027b314f3eb56d31af549f7da7bd9ef1ce951651e