Documentation ¶
Index ¶
- func GetDefaultAddrShard(mtvAddr string) int
- type Address
- func (addr Address) GetPublicKeyHash(addrType AddressType) (*PublicKeyHash, error)
- func (addr Address) IsEqual(target Address) bool
- func (addr Address) String() string
- func (addr Address) VerifyAddressType(addrType AddressType) error
- func (addr Address) VerifyPublicKey(pk signature.PublicKey, addrType AddressType) error
- type AddressType
- type PublicKeyHash
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultAddrShard ¶
GetDefaultAddrShard returns the default shard of address.
Types ¶
type Address ¶
type Address []byte
Address defines the data structure of multivac address.
func GenerateAddress ¶
func GenerateAddress(pk signature.PublicKey, addrType AddressType) Address
GenerateAddress generates the MTV address based on the public key and address type
func GenerateAddressByPublicKeyHash ¶
func GenerateAddressByPublicKeyHash(pubKey PublicKeyHash, addrType AddressType) Address
GenerateAddressByPublicKeyHash accept after sha256 and ripemd hash length of 20 byte array, and the address type as a parameter to generate the MTV address.
func StringToUserAddress ¶
StringToUserAddress converts pk string to multivac user address
func (Address) GetPublicKeyHash ¶
func (addr Address) GetPublicKeyHash(addrType AddressType) (*PublicKeyHash, error)
GetPublicKeyHash returns the hash array of public key.
func (Address) VerifyAddressType ¶
func (addr Address) VerifyAddressType(addrType AddressType) error
VerifyAddressType determines whether it is legal by address type. This method only verifies that the address is formatted correctly.
func (Address) VerifyPublicKey ¶
func (addr Address) VerifyPublicKey(pk signature.PublicKey, addrType AddressType) error
VerifyPublicKey verifies that the address format is valid before verifying that the address and public key match
type AddressType ¶
type AddressType byte
AddressType define the multivac address type.
const ( // UserAddress defines the address type for user.Base58Check encoding, it is prefixed with 1 UserAddress AddressType = 0x00 // SystemContractAddress defines the address type for system contract address. SystemContractAddress AddressType = 0x01 // SmartContractAddress defines the address type for smart contract address. // Base58Check encoding, it is prefixed with 3. SmartContractAddress AddressType = 0x05 )
type PublicKeyHash ¶
type PublicKeyHash [publicKeyHashSize]byte
PublicKeyHash is an array used to store the hasn of public key.