Addresses

A Tier address is the text form of a 32-byte ID (see IDs), encoded with bech32m (BIP 350) under the human-readable prefix tier. It carries exactly the same bytes as the 64-character hexadecimal ID, adds a checksum that catches typos, and avoids characters that are easy to confuse.

Two printed forms

FormLengthExample
Elided (primary)58qh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38snd9pcx
Prefixed63tier1qh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38snd9pcx
Hex ID (for comparison)6405ca62c8eff20c96a64b37062000806ffa8cd06b185798db92b35fdff45d944f

The prefix tier is always folded into the checksum. In the elided form it is not printed, so the address looks like a random bech32 string. The prefixed form adds the visible tier and the bech32 separator 1. Both forms decode to the same ID and are accepted everywhere an address is accepted.

The elided form can never be mistaken for the prefixed one: its alphabet excludes i and 1, so it cannot begin with tier1.

Structure

PartSymbolsContent
Prefix0 or 5tier1 in the prefixed form only.
Data52The 256-bit ID regrouped into 5-bit symbols: 51 full symbols and 1 symbol carrying the last bit followed by 4 zero padding bits.
Checksum6bech32m checksum over the expanded prefix tier and the 52 data symbols.

Unlike Bitcoin segwit addresses there is no witness-version symbol: the data part is the ID and nothing else.

Alphabet

Each symbol is a 5-bit value written with the bech32 character set, indexed 0 to 31:

qpzry9x8gf2tvdw0s3jn54khce6mua7l

The set is lowercase letters and digits without 1, b, i, and o. Addresses are printed in lowercase. An all-uppercase address is accepted; a mixed-case one is rejected, as in BIP 173.

Encoding

  1. Regroup bits. Read the 32 ID bytes as a big-endian bit stream and cut it into 5-bit groups, padding the last group with zero bits. This gives 52 values.
  2. Expand the prefix. For each character c of tier, take ord(c) >> 5; then a single 0; then ord(c) & 31 for each character. For tier this is [3, 3, 3, 3, 0, 20, 9, 5, 18].
  3. Compute the checksum. Run the bech32 polynomial polymod over expanded prefix || data || [0, 0, 0, 0, 0, 0] and XOR the result with the bech32m constant 0x2bc830a3. The six checksum symbols are bits 25–29, 20–24, 15–19, 10–14, 5–9, and 0–4 of that value.
  4. Map to characters. Write the 52 data symbols and the 6 checksum symbols with the alphabet. That is the elided form; prepend tier1 for the prefixed form.

polymod is the BCH code from BIP 173. It starts from 1 and, for each 5-bit value, shifts in the value and conditionally XORs the generators 0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3. Only the final constant differs from bech32 (1); bech32m fixes bech32's weakness to inserted or deleted q characters before a final p.

Decoding and validation

A string is a valid address only if all of these hold:

  1. It is not mixed-case. It is then lowercased.
  2. A leading tier1, if present, is removed.
  3. Exactly 58 characters remain, all from the alphabet.
  4. polymod(expanded prefix || 58 values) equals 0x2bc830a3.
  5. Regrouping the 52 data symbols back to bytes leaves no extra full group, the 4 padding bits are zero, and the result is exactly 32 bytes.

Anything else is rejected: a typo, a wrong length, an out-of-alphabet character, non-zero padding, mixed case, or an address checksummed under another prefix.

What the checksum guarantees

  • Error detection. bech32m detects any error affecting up to 4 characters. A random corruption passes with probability about 2-30.
  • Prefix binding. A string checksummed under a different implicit prefix fails verification, even if its data part is identical.
  • Not authentication. A valid address only means "a well-formed Tier ID". It does not mean the identity exists, is online, or belongs to a particular person.
  • Network-agnostic. The same ID has the same address on every Tier network. Network separation is enforced by the handshake and by signatures, not by the address.

Where addresses appear

ProgramShowsAccepts
tier-messengerHex ID and elided address in :profile.:contacts/add takes a 64-hex ID or either address form and stores the hex ID.
tier-agentHex ID and elided address in its log on start; prefixed address in the bootstrap collector output.collector and accept_from in the config, --collector= in bootstrap: address in either form.
tier-vanitySeed, hex ID, elided and prefixed address of each match.--prefix and --suffix in the bech32 alphabet.
tierctlHex IDs only.Hex IDs only.

Vanity addresses

tier-vanity searches for an identity whose address starts and/or ends with chosen characters. Every attempt is a fresh, full-entropy key pair from the system CSPRNG, so a found identity is as strong as any other; the only cost is the discarded key pairs. Expected work is about 32n attempts for n chosen characters: 3 to 6 are practical, 7 or more needs real hardware. A suffix falls on the checksum, which is just as random as the data.

tier-vanity ace
tier-vanity --prefix ace --suffix xy --count 3 --threads 8

A vanity address controls only the characters that were searched for. Never verify an identity by a shared prefix or suffix; compare the full ID.

Test vector

From the tier-core test suite:

ID (hex)05ca62c8eff20c96a64b37062000806ffa8cd06b185798db92b35fdff45d944f
Elidedqh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38snd9pcx
Prefixedtier1qh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38snd9pcx
Must failqh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38sqk7gas: same data, checksummed under the prefix tiert.

Reference implementation

A self-contained Python version of the algorithm, checked against the test vector above. The canonical implementation is libs/core/src/address.cpp.

CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
BECH32M_CONST = 0x2BC830A3
HRP = "tier"


def polymod(values):
    gen = [0x3B6A57B2, 0x26508E6D, 0x1EA119FA, 0x3D4233DD, 0x2A1462B3]
    chk = 1
    for v in values:
        top = chk >> 25
        chk = ((chk & 0x1FFFFFF) << 5) ^ v
        for i in range(5):
            if (top >> i) & 1:
                chk ^= gen[i]
    return chk


def hrp_expand(hrp):
    return [ord(c) >> 5 for c in hrp] + [0] + [ord(c) & 31 for c in hrp]


def convertbits(data, frombits, tobits, pad):
    acc, bits, out = 0, 0, []
    maxv = (1 << tobits) - 1
    for value in data:
        acc = (acc << frombits) | value
        bits += frombits
        while bits >= tobits:
            bits -= tobits
            out.append((acc >> bits) & maxv)
    if pad:
        if bits:
            out.append((acc << (tobits - bits)) & maxv)
    elif bits >= frombits or ((acc << (tobits - bits)) & maxv):
        return None
    return out


def encode(id_bytes, prefixed=False):
    assert len(id_bytes) == 32
    data = convertbits(id_bytes, 8, 5, True)
    pm = polymod(hrp_expand(HRP) + data + [0] * 6) ^ BECH32M_CONST
    checksum = [(pm >> 5 * (5 - i)) & 31 for i in range(6)]
    body = "".join(CHARSET[d] for d in data + checksum)
    return HRP + "1" + body if prefixed else body


def decode(address):
    if address.lower() != address and address.upper() != address:
        return None
    s = address.lower()
    if s.startswith(HRP + "1"):
        s = s[len(HRP) + 1:]
    if len(s) != 58 or any(c not in CHARSET for c in s):
        return None
    values = [CHARSET.index(c) for c in s]
    if polymod(hrp_expand(HRP) + values) != BECH32M_CONST:
        return None
    data = convertbits(values[:-6], 5, 8, False)
    if data is None or len(data) != 32:
        return None
    return bytes(data)


vid = bytes.fromhex("05ca62c8eff20c96a64b37062000806ffa8cd06b185798db92b35fdff45d944f")
assert encode(vid) == "qh9x9j807gxfdfjtxurzqqyqdlage5rtrpte3kujkd0alazaj38snd9pcx"
assert decode("tier1" + encode(vid)) == vid