address

package
v0.0.0-...-7bd1b19 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AddressLength = PubKeyLength + PubKeyHashLength
View Source
const MainnetIdentifier = "addr"
View Source
const PubKeyHashLength = blake2b224.Size224

PubKeyHashLength is the length of Cardano public key hashes using blake2b-224.

View Source
const PubKeyLength = 32

PubKeyLength is the length of the public verification key part of a Cardano `ed25519` keypair in bytes.

View Source
const TestnetIdentifier = "addr_test"

Variables

This section is empty.

Functions

func CalculatePubKeyHash

func CalculatePubKeyHash(pubKey [PubKeyLength]byte) ([PubKeyHashLength]byte, error)

Types

type Address

type Address struct {
	// contains filtered or unexported fields
}

Address carries a public key that represents the public verification key part of a Cardano `ed25519` keypair.

func MakeAddressFromPubKeyByteArray

func MakeAddressFromPubKeyByteArray(pubKey [PubKeyLength]byte) Address

MakeAddressFromPubKeyByteArray returns a new Address for the given public key bytes. Note: This does not set the public key hash!

func MakeAddressFromPubKeyByteSlice

func MakeAddressFromPubKeyByteSlice(pubKey []byte) (Address, error)

MakeAddressFromPubKeyByteSlice returns a new Address for the given public key bytes. Note: This does not set the public key hash!

func MakeAddressFromSinglePubKey

func MakeAddressFromSinglePubKey(pubKey []byte) (Address, error)

MakeAddressFromSinglePubKey creates an Address from a single public key. This means the payment and signing public keys are the same. The (payment) public key hash is the blake2b-224 hash of the given public key.

func (Address) Equal

func (a Address) Equal(other wallet.Address) bool

Equal returns true, iff the given address is of type Address and their public keys are equal.

func (Address) GetMainnetAddressOfPubKey

func (a Address) GetMainnetAddressOfPubKey() (string, error)

GetMainnetAddressOfPubKey returns the mainnet address string representation of this addresses' public key (i.e. `addr1...`).

func (Address) GetMainnetAddressOfPubKeyHash

func (a Address) GetMainnetAddressOfPubKeyHash() (string, error)

GetMainnetAddressOfPubKeyHash returns the mainnet address string representation of this addresses' payment public key hash (i.e. `addr1...`).

func (Address) GetPubKey

func (a Address) GetPubKey() [PubKeyLength]byte

GetPubKey returns the public key of this address.

func (Address) GetPubKeyHash

func (a Address) GetPubKeyHash() [PubKeyHashLength]byte

GetPubKeyHash returns the public key hash associated with payments to this address.

func (Address) GetPubKeyHashSlice

func (a Address) GetPubKeyHashSlice() []byte

func (Address) GetPubKeySlice

func (a Address) GetPubKeySlice() []byte

GetPubKeySlice returns the public key of this address. The returned slice is of length PubKeyLength.

func (Address) GetTestnetAddressOfPubKey

func (a Address) GetTestnetAddressOfPubKey() (string, error)

GetTestnetAddressOfPubKey returns the testnet address string representation of this addresses' public key (i.e. `addr_test1...`).

func (Address) GetTestnetAddressOfPubKeyHash

func (a Address) GetTestnetAddressOfPubKeyHash() (string, error)

GetTestnetAddressOfPubKeyHash returns the testnet address string representation of this addresses' payment public key hash (i.e. `addr1...`).

func (Address) MarshalBinary

func (a Address) MarshalBinary() ([]byte, error)

MarshalBinary decodes this address into its byte representation. The returned byte slice has length PubKeyLength + PubKeyHashLength.

func (*Address) SetPaymentPubKeyHash

func (a *Address) SetPaymentPubKeyHash(paymentPubKeyHash [PubKeyHashLength]byte)

func (*Address) SetPaymentPubKeyHashFromHexString

func (a *Address) SetPaymentPubKeyHashFromHexString(paymentPubKeyHash string) error

func (*Address) SetPaymentPubKeyHashFromSlice

func (a *Address) SetPaymentPubKeyHashFromSlice(paymentPubKeyHash []byte) error

func (Address) String

func (a Address) String() string

String returns the public key as hex string.

func (*Address) UnmarshalBinary

func (a *Address) UnmarshalBinary(data []byte) error

UnmarshalBinary expects a byte slice of length PubKeyLength + PubKeyHashLength and decodes it into the receiver Address.

Jump to

Keyboard shortcuts

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