address

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2021 License: MIT Imports: 11 Imported by: 17

Documentation

Overview

Package address provides primitives for generating and validating addresses (with and without checksum).

Index

Constants

View Source
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

func GenerateMigrationAddress(ed25519Addr [32]byte, addChecksum ...bool) (Hash, error)

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

func ParseMigrationAddress(address Hash) ([32]byte, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL