Bech32
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:
export type Bech32Address = `fuel${string}`;
A complete Bech32
address will resemble the following:
const address = Address.fromRandom();
console.log(address.bech32Address);
// fuel1d5cfwekq78r0zq73g7eg0747etkaxxltrqx5tncm7lvg89awe3hswhqjhs
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.