Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateSignaturesMajority(signedHash hash.Hash256, sigs []Signature, KeyMap map[PublicHash]bool) error
- func VerifySignature(pubkey PublicKey, h hash.Hash256, sig Signature) error
- type Address
- func (addr Address) Checksum() byte
- func (addr Address) Clone() Address
- func (addr Address) Height() uint32
- func (addr Address) Index() uint16
- func (addr Address) MarshalJSON() ([]byte, error)
- func (addr Address) Nonce() uint64
- func (addr Address) String() string
- func (addr *Address) UnmarshalJSON(bs []byte) error
- type PublicHash
- type PublicKey
- type Signature
Constants ¶
const AddressSize = 14
AddressSize is 14 bytes
const PublicHashSize = 31
PublicHashSize is 31 bytes
const PublicKeySize = 33
PublicKeySize is 33 bytes
const SignatureSize = 65
SignatureSize is 65 bytes
Variables ¶
var ( ErrInvalidAddressFormat = errors.New("invalid address format") ErrInvalidAddressCheckSum = errors.New("invalid address checksum") ErrInvalidSignatureFormat = errors.New("invalid signature format") ErrInvalidSignature = errors.New("invalid signature") ErrInvalidPublicKeyFormat = errors.New("invalid public key format") ErrInvalidPublicHash = errors.New("invalid public hash") ErrInvalidPublicHashFormat = errors.New("invalid public hash format") ErrInsufficientSignature = errors.New("insufficient signature") ErrDuplicatedSignature = errors.New("duplicated signature") )
common errors
Functions ¶
func ValidateSignaturesMajority ¶
func ValidateSignaturesMajority(signedHash hash.Hash256, sigs []Signature, KeyMap map[PublicHash]bool) error
ValidateSignaturesMajority validates signatures with the signed hash and checks majority
Types ¶
type Address ¶
type Address [AddressSize]byte
Address is the [AddressSize]byte with methods
func MustParseAddress ¶
MustParseAddress panic when error occurred
func NewAddress ¶
NewAddress returns a Address by the AccountCoordinate and the magic
func ParseAddress ¶
ParseAddress parse the address from the string
func (Address) MarshalJSON ¶
MarshalJSON is a marshaler function
func (*Address) UnmarshalJSON ¶
UnmarshalJSON is a unmarshaler function
type PublicHash ¶
type PublicHash [PublicHashSize]byte
PublicHash is the [PublicHashSize]byte with methods
func MustParsePublicHash ¶
func MustParsePublicHash(str string) PublicHash
MustParsePublicHash panic when error occurred
func NewPublicHash ¶
func NewPublicHash(pubkey PublicKey) PublicHash
NewPublicHash returns the PublicHash of the pubkey
func ParsePublicHash ¶
func ParsePublicHash(str string) (PublicHash, error)
ParsePublicHash parse the public hash from the string
func (PublicHash) Clone ¶
func (pubhash PublicHash) Clone() PublicHash
Clone returns the clonend value of it
func (PublicHash) Less ¶
func (pubhash PublicHash) Less(b PublicHash) bool
Less returns the value is less or not
func (PublicHash) MarshalJSON ¶
func (pubhash PublicHash) MarshalJSON() ([]byte, error)
MarshalJSON is a marshaler function
func (PublicHash) String ¶
func (pubhash PublicHash) String() string
String returns a base58 value of the public hash
func (*PublicHash) UnmarshalJSON ¶
func (pubhash *PublicHash) UnmarshalJSON(bs []byte) error
UnmarshalJSON is a unmarshaler function
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey is the [PublicKeySize]byte with methods
func MustParsePublicKey ¶
MustParsePublicKey panic when error occurred
func ParsePublicKey ¶
ParsePublicKey parse the public hash from the string
func RecoverPubkey ¶
RecoverPubkey recover the public key using the hash value and the signature
func (PublicKey) MarshalJSON ¶
MarshalJSON is a marshaler function
func (*PublicKey) UnmarshalJSON ¶
UnmarshalJSON is a unmarshaler function
type Signature ¶
type Signature [SignatureSize]byte
Signature is the [SignatureSize]byte with methods
func MustParseSignature ¶
MustParseSignature panic when error occurred
func ParseSignature ¶
ParseSignature parse the public hash from the string
func (Signature) MarshalJSON ¶
MarshalJSON is a marshaler function
func (*Signature) UnmarshalJSON ¶
UnmarshalJSON is a unmarshaler function