Encoding scheme for API identifiers and byte arrays
The æternity node usesbase58Check
encoding for identifiers such as account and contract public
keys. Base58c is not well suited for encoding big byte arrays, so for
general byte arrays base64 is used.
The base64 encoded data is treated in the same way as the base58Check
encoded data, i.e., a checksum is postfixed to the binary data before
encoding. The checksum is the first four bytes of the sha256 hash of
the sha256 hash of the original byte array.
The following erlang snippet shows how the checksum can be computed,
and how it is added to the byte array that is to be encoded.
Both identifiers and general byte arrays are prefixed with a two
letter tag and a separator (_), describing the type of data that is
encoded. For example an account pubkey could look asak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi.
The tags are described below, together with the encoding method of the
tag.