Documentation ¶
Overview ¶
Package address provides primitives for generating and validating addresses (with and without checksum).
Index ¶
- Constants
- func Checksum(address Hash) (Trytes, error)
- func GenerateAddress(seed Trytes, index uint64, secLvl SecurityLevel, addChecksum ...bool) (Hash, error)
- func GenerateAddresses(seed Trytes, start uint64, count uint64, secLvl SecurityLevel, ...) (Hashes, error)
- func GenerateMigrationAddress(ed25519Addr [32]byte, addChecksum ...bool) (Hash, error)
- func ParseMigrationAddress(address Hash) ([32]byte, error)
- func ValidAddress(address Hash) error
- func ValidChecksum(address Hash, checksum Trytes) error
Constants ¶
const (
// The prefix of migration addresses.
MigrationAddressPrefix = "TRANSFER"
)
Variables ¶
This section is empty.
Functions ¶
func Checksum ¶
func Checksum(address Hash) (Trytes, error)
Checksum returns the checksum of the given address.
func GenerateAddress ¶
func GenerateAddress(seed Trytes, index uint64, secLvl SecurityLevel, addChecksum ...bool) (Hash, error)
GenerateAddress generates an address deterministically, according to the given seed, index and security level.
func GenerateAddresses ¶
func GenerateAddresses(seed Trytes, start uint64, count uint64, secLvl SecurityLevel, addChecksum ...bool) (Hashes, error)
GenerateAddresses generates N new addresses from the given seed, indices and security level.
func GenerateMigrationAddress ¶
GenerateMigrationAddress generates a migration address from the given Ed25519 address bytes (Ed25519 address being the Blake2b-256 hash of the Ed25519 public key).
func ParseMigrationAddress ¶
ParseMigrationAddress parses the given migration address. It returns the corresponding Ed25519 raw bytes or an error if address is not a valid migration address. A valid migration address has the following properties:
- it starts with the prefix 'TRANSFER'
- it ends with '9'
- the 72 trytes after 'TRANSFER' converted with B1T6 resulting in 36 bytes resolves to:
- the 32 bytes being the Ed25519 address
- the last 4 bytes of the 36 bytes being the Blake2b-256 hash of the Ed25519 address
func ValidAddress ¶
func ValidAddress(address Hash) error
ValidAddress checks whether the given address is valid.
func ValidChecksum ¶
func ValidChecksum(address Hash, checksum Trytes) error
ValidChecksum checks whether the given checksum corresponds to the given address.
Types ¶
This section is empty.