Addressing Type
To represent addresses, Move uses a special type called address
. It is a 32 byte value that can be used to represent any address on the blockchain. Addresses are used in two syntax forms: hexadecimal addresses prefixed with 0x
and named addresses.
An address literal starts with the @
symbol followed by a hexadecimal number or an identifier. The hexadecimal number is interpreted as a 32 byte value. The identifier is looked up in the Move.toml file and replaced with the corresponding address by the compiler. If the identifier is not found in the Move.toml file, the compiler will throw an error.
Conversion
Umi Network Framework offers a set of helper functions to work with addresses. Given that the address type is a 32 byte value, it can be converted to a u256
type and vice versa. It can also be converted to and from a vector<u8>
type.
Example: Convert an address to a u256
type and back.
Example: Convert an address to a vector<u8>
type and back.
Example: Convert an address into a string.