Bech32
[!NOTE] Note
Bech32
addresses likefuel1..
are now deprecated. UseB256
addresses instead. (help )
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 .
A Bech32
address consists of an HRP (Human-Readable Part) followed by the number 1
, which acts as a separator:
/**
* @deprecated
* Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256))
*/
export type Bech32Address = `fuel${string}`;
A complete Bech32
address will resemble the following:
import { Address } from 'fuels';
const address = Address.fromRandom();
console.log('Bech32', 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.