Documentation ¶
Index ¶
- Constants
- Variables
- func GetChainCap(ChainID *big.Int) *big.Int
- func IsHexAddress(s string) bool
- func ParseAddress(s string) (common.Address, error)
- func Sizeof(t reflect.Type) int
- func ValidateSignaturesMajority(chainID *big.Int, signedHash hash.Hash256, sigs []Signature, ...) error
- func VerifySignature(pubkey PublicKey, h hash.Hash256, sig Signature) error
- type Address
- type Causer
- type PacketHeader
- type PublicKey
- type Signature
- type SyncChan
Constants ¶
const ( // AddressLength is the expected length of the address AddressLength = common.AddressLength )
Lengths of hashes and addresses in bytes.
const MinSignatureSize = 65
SignatureSize is 67 bytes r 32 s 32 v 1 => v 3 const SignatureSize = 67
const PublicKeySize = 65
PublicKeySize 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") ErrInvalidPublicKey = errors.New("invalid public key") ErrInvalidPublicKeyFormat = errors.New("invalid public key format") ErrInsufficientSignature = errors.New("insufficient signature") ErrDuplicatedSignature = errors.New("duplicated signature") )
common errors
var ZeroAddr = Address{}
Functions ¶
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
func ParseAddress ¶
ParseAddress is parse address
Types ¶
type Address ¶
func BigToAddress ¶
BigToAddress returns Address with byte values of b. If b is larger than len(h), b will be cropped from the left.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
type PacketHeader ¶
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 []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