Skip to content

Bech32

Note

Bech32 addresses like fuel1.. are now deprecated; please switch to hexadecimals like 0x...

The SDK uses the Bech32 type as the core property of the Address class, specifically through the bech32Address property.

Originally designed for Bitcoin, the Bech32 format offers numerous advantages such as enhanced error detection, simplified integrations, and improved compatibility with future upgrades. Given these benefits, the Address class is constructed around the Bech32 type.

You can read more about the Bech32 type here.

Default Human-Readable Part (HRP)

A Bech32 address consists of an HRP (Human-Readable Part) followed by the number 1, which acts as a separator:

ts
/**
 * @deprecated
 * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward.
 */
export type Bech32Address = `fuel${string}`;
See code in context

A complete Bech32 address will resemble the following:

ts
const address = Address.fromRandom();

console.log(address.bech32Address);

// fuel1d5cfwekq78r0zq73g7eg0747etkaxxltrqx5tncm7lvg89awe3hswhqjhs
See code in context

The HRP in the example above is fuel. This human-readable prefix is included to provide better readability and prevent users from accidentally using addresses on the wrong network.