Serialization Primitives
Dernière mise à jour
Cet article vous a-t-il été utile ?
Dernière mise à jour
Cet article vous a-t-il été utile ?
utilise une représentation simple, uniforme et élégante pour toutes les données internes. Ce document décrit comment les types de donnée primitifs sont encodés sur la plateforme Avalanche. Les transactions sont codées en fonction de ces types primitifs de base.
Bytes are packed as-is into the message payload.
Example:
Shorts are packed in BigEndian format into the message payload.
Example:
Integers are 32-bit values packed in BigEndian format into the message payload.
Example:
Long integers are 64-bit values packed in BigEndian format into the message payload.
Example:
IP addresses are represented as 16-byte IPv6 format, with the port appended into the message payload as a Short. IPv4 addresses are padded with 12 bytes of leading 0x00s.
IPv4 example:
IPv6 example:
Fixed-length arrays, whose length is known ahead of time and by context, are packed in order.
Byte array example:
Integer array example:
The length of the array is prefixed in Integer format, followed by the packing of the array contents in Fixed Length Array format.
Byte array example:
Int array example:
A String is packed similarly to a variable-length byte array. However, the length prefix is a short rather than an int. Strings are encoded in UTF-8 format.
Example: