Addresses on the X-Chain and P-Chain follow the Bech32 standard outlined in BIP 0173. There are four parts to this addressing scheme, in order of appearance:

  1. A Human-Readable Part (HRP).
  2. The number “1” as a separator (the last digit 1 seen is considered the separator).
  3. Base-32 encoded string for the data-part of the address (the 20 byte address itself).
  4. A 6-character base-32 encoded error correction code using the BCH algorithm.

This produces an address such as this:

/* X-Chain address */
X-avax1kj06lhgx84h39snsljcey3tpc046ze68mek3g5

/* P-Chain address */
P-avax1kj06lhgx84h39snsljcey3tpc046ze68mek3g5

In this case, the Bech32 breakdown is as follows:

  1. An HRP of “avax”.
  2. The separator “1”.
  3. The base32 address part of “kj06lhgx84h39snsljcey3tpc046ze68”.
  4. A correction code of “mek3g5”.

Note: the chainid is not considered part of the HRP of the Bech32 address. Both of these addresses represent the same private key, but on different chains.

The error correction code can be used to detect up to 4 errors with certainty in the entire address. While it can automatically correct these errors, because it’s is uncertain how many errors may exist in the address when typed, it is inadvisable to correct them simply make suggestions where the errors MAY occur to the users. Automatic correct can result in assets being sent to the wrong place.

Chat with Ava Labs | Validate on Avalanche | Build on Avalanche

Did this answer your question?