Skip to main content
Cosmos uses Bech32 encoding for all addresses. A Bech32 address has two parts: a human-readable prefix (HRP) that identifies the chain, and a data section containing the raw address bytes with a checksum.

Common Prefixes

Encoding and Decoding

@cosmjs/encoding provides three functions:
fromBech32 validates the checksum and throws on invalid input. normalizeBech32 round-trips through decode/encode, which is safer than calling toLowerCase() directly.

How Addresses Are Derived from Public Keys

The raw 20-byte address inside a Bech32 string is derived from the public key through hashing. The algorithm depends on the key type: The @cosmjs/amino package provides pubkeyToAddress for this:
This means the same key pair produces different addresses on different chains — only the Bech32 prefix changes, but the raw bytes are identical: