iotex-address: Index | Files | Directories

package address

import ""


Package Files

address.go address_v1.go


const (
    // MainnetPrefix is the prefix added to the human readable address of mainnet
    MainnetPrefix = "io"
    // TestnetPrefix is the prefix added to the human readable address of testnet
    TestnetPrefix = "it"

    // ZeroAddress is the IoTeX address whose hash160 is all zero
    ZeroAddress = "io1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqd39ym7"

    // StakingBucketPoolAddr is the staking bucket pool address
    StakingBucketPoolAddr = "io000000000000000000000000stakingprotocol"

    // RewardingPoolAddr is the rewarding pool address
    RewardingPoolAddr = "io0000000000000000000000rewardingprotocol"


var (
    StakingProtocolAddrHash   = hash.Hash160b([]byte("staking"))
    RewardingProtocolAddrHash = hash.Hash160b([]byte("rewarding"))

20-byte protocol address hash

var ErrInvalidAddr = errors.New("invalid address")

ErrInvalidAddr indicates the invalid address error

func Equal Uses

func Equal(addr1 Address, addr2 Address) bool

Equal determine if two addresses are equal

type AddrV1 Uses

type AddrV1 struct {
    // contains filtered or unexported fields

AddrV1 is V1 address format to be used on IoTeX blockchain and subchains. It is composed of 20 bytes: hash derived from the the public key:

func (*AddrV1) Bytes Uses

func (addr *AddrV1) Bytes() []byte

Bytes converts an address struct into a byte array

func (*AddrV1) String Uses

func (addr *AddrV1) String() string

String encodes an address struct into a a String encoded address string The encoded address string will start with "io" for mainnet, and with "it" for testnet

type Address Uses

type Address interface {
    // String encodes the whole address into an address string encoded in string format
    String() string
    // Bytes serializes the whole address struct into a byte slice, which is composed of the payload to identify an
    // address within one blockchain
    Bytes() []byte

Address defines the interface of the blockchain address

func FromBytes Uses

func FromBytes(bytes []byte) (Address, error)

FromBytes converts a byte array into an address struct

func FromString Uses

func FromString(encodedAddr string) (Address, error)

FromString decodes an encoded address string into an address struct


bech32Package bech32 includes a Bech32 string which is at most 90 characters long and consists of: The human-readable part, which is intended to convey the type of data, or anything else that is relevant to the reader.

Package address imports 8 packages (graph) and is imported by 35 packages. Updated 2020-09-27. Refresh now. Tools for package owners.