iotxaddress

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidVersion is returned when invalid version has been detected.
	ErrInvalidVersion = errors.New("invalid version")
	// ErrInvalidChainID is returned when invalid chain ID has been detected.
	ErrInvalidChainID = errors.New("invalid chain ID")
	// ErrInvalidHRP is returned when invalid human readable prefix has been detected.
	ErrInvalidHRP = errors.New("invalid human readable prefix")
	// IsTestnet is used to get address
	IsTestnet = false
)

Functions

func AddressToPKHash added in v0.4.0

func AddressToPKHash(addr string) (hash.PKHash, error)

AddressToPKHash returns public key hash from account address

func CreateContractAddress added in v0.3.0

func CreateContractAddress(ownerAddr string, chainID []byte, nonce uint64) (string, error)

CreateContractAddress returns the contract address given owner address and nonce

func CreateID added in v0.4.0

func CreateID(rawAddress string) []uint8

CreateID creates a DKG Address ID given a node's raw address

func GetPubkeyHash

func GetPubkeyHash(address string) ([]byte, error)

GetPubkeyHash extracts public key hash from address

func IsValidHrp added in v0.4.0

func IsValidHrp(hrp string) bool

IsValidHrp returns if hrp is valid or not

func IsValidVersion added in v0.4.0

func IsValidVersion(version byte) bool

IsValidVersion returns if version is valid or not

Types

type Address

type Address struct {
	PrivateKey keypair.PrivateKey
	PublicKey  keypair.PublicKey
	RawAddress string
}

Address contains a pair of key and a string address

func GetAddressByHash added in v0.3.0

func GetAddressByHash(isTestnet bool, chainID, hash []byte) (*Address, error)

GetAddressByHash returns the address given a 20-byte hash

func GetAddressByPubkey added in v0.3.0

func GetAddressByPubkey(isTestnet bool, chainID []byte, pub keypair.PublicKey) (*Address, error)

GetAddressByPubkey returns the address given a public key and necessary params.

func NewAddress

func NewAddress(isTestnet bool, chainID []byte) (*Address, error)

NewAddress returns a newly created public/private key pair together with the address derived.

type DKGAddress added in v0.3.0

type DKGAddress struct {
	PrivateKey []uint32
	PublicKey  []byte
	ID         []uint8
}

DKGAddress contains a pair of DKGkey and a DKGID

Jump to

Keyboard shortcuts

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