Documentation
¶
Index ¶
- Variables
- func Base64Encode(b []byte) string
- func BytesToECDSAPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
- func BytesToEd25519PrivateKey(input []byte) (ed25519.PrivateKey, error)
- func CFBDecrypt(text, MySecret string) (string, error)
- func CFBEncrypt(text, MySecret string) (string, error)
- func CreateAddress(addr types.Address, nonce uint64) types.Address
- func CreateAddress2(addr types.Address, salt [32]byte, inithash []byte) types.Address
- func Decode(s string) []byte
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func GenerateAndEncodeECDSAPrivateKey() (*ecdsa.PrivateKey, []byte, error)
- func GenerateAndEncodeICPIdentitySecretKey() (ed25519.PrivateKey, []byte, error)
- func GenerateECDSAKey() (*ecdsa.PrivateKey, error)
- func GenerateOrReadPrivateKey(path string) (*ecdsa.PrivateKey, error)
- func GetAddressFromKey(key goCrypto.PrivateKey) (types.Address, error)
- func Keccak256(v ...[]byte) []byte
- func Keccak256Hash(v ...[]byte) (hash types.Hash)
- func MarshalECDSAPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPublicKey(pub *ecdsa.PublicKey) []byte
- func ParseECDSAPrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
- func ParsePublicKey(buf []byte) (*ecdsa.PublicKey, error)
- func PubKeyToAddress(pub *ecdsa.PublicKey) types.Address
- func ReadConsensusKey(manager secrets.SecretsManager) (*ecdsa.PrivateKey, error)
- func RecoverPubkey(signature, hash []byte) (*ecdsa.PublicKey, error)
- func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
- func Sign(priv *ecdsa.PrivateKey, hash []byte) ([]byte, error)
- func ValidateSignatureValues(v, r, s *big.Int, isHomestead bool) bool
- type Fork
- type Forks
- func (f *Forks) At(block uint64) ForksInTime
- func (f *Forks) IsByzantium(block uint64) bool
- func (f *Forks) IsConstantinople(block uint64) bool
- func (f *Forks) IsEIP150(block uint64) bool
- func (f *Forks) IsEIP155(block uint64) bool
- func (f *Forks) IsEIP158(block uint64) bool
- func (f *Forks) IsHomestead(block uint64) bool
- func (f *Forks) IsLondon(block uint64) bool
- func (f *Forks) IsPetersburg(block uint64) bool
- type ForksInTime
- type KeccakState
- type KeyType
Constants ¶
This section is empty.
Variables ¶
var AllForksEnabled = &Forks{ Homestead: NewFork(0), EIP150: NewFork(0), EIP155: NewFork(0), EIP158: NewFork(0), Byzantium: NewFork(0), Constantinople: NewFork(0), Petersburg: NewFork(0), Istanbul: NewFork(0), London: NewFork(0), }
var (
ErrInvalidBLSSignature = errors.New("invalid BLS Signature")
)
var S256 = btcec.S256()
S256 is the secp256k1 elliptic curve
Functions ¶
func BytesToECDSAPrivateKey ¶
func BytesToECDSAPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
BytesToECDSAPrivateKey reads the input byte array and constructs a private key if possible
func BytesToEd25519PrivateKey ¶
func BytesToEd25519PrivateKey(input []byte) (ed25519.PrivateKey, error)
BytesToECDSAPrivateKey reads the input byte array and constructs a private key if possible
func CreateAddress ¶
CreateAddress creates an Ethereum address.
func CreateAddress2 ¶
CreateAddress2 creates an Ethereum address following the CREATE2 Opcode.
func GenerateAndEncodeECDSAPrivateKey ¶
func GenerateAndEncodeECDSAPrivateKey() (*ecdsa.PrivateKey, []byte, error)
GenerateAndEncodeECDSAPrivateKey returns a newly generated private key and the Base64 encoding of that private key
func GenerateAndEncodeICPIdentitySecretKey ¶
func GenerateAndEncodeICPIdentitySecretKey() (ed25519.PrivateKey, []byte, error)
func GenerateECDSAKey ¶
func GenerateECDSAKey() (*ecdsa.PrivateKey, error)
GenerateECDSAKey generates a new key based on the secp256k1 elliptic curve.
func GenerateOrReadPrivateKey ¶
func GenerateOrReadPrivateKey(path string) (*ecdsa.PrivateKey, error)
GenerateOrReadPrivateKey generates a private key at the specified path, or reads it if a key file is present
func GetAddressFromKey ¶
func GetAddressFromKey(key goCrypto.PrivateKey) (types.Address, error)
GetAddressFromKey extracts an address from the private key
func Keccak256Hash ¶
Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.
func MarshalECDSAPrivateKey ¶
func MarshalECDSAPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
MarshalECDSAPrivateKey serializes the private key's D value to a []byte
func MarshalPublicKey ¶
MarshalPublicKey marshals a public key on the secp256k1 elliptic curve.
func ParseECDSAPrivateKey ¶
func ParseECDSAPrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
func ParsePublicKey ¶
ParsePublicKey parses bytes into a public key on the secp256k1 elliptic curve.
func PubKeyToAddress ¶
PubKeyToAddress returns the Ethereum address of a public key
func ReadConsensusKey ¶
func ReadConsensusKey(manager secrets.SecretsManager) (*ecdsa.PrivateKey, error)
func RecoverPubkey ¶
RecoverPubkey verifies the compact signature "signature" of "hash" for the secp256k1 curve.
Types ¶
type Forks ¶
type Forks struct { Homestead *Fork `json:"homestead,omitempty"` Byzantium *Fork `json:"byzantium,omitempty"` Constantinople *Fork `json:"constantinople,omitempty"` Petersburg *Fork `json:"petersburg,omitempty"` Istanbul *Fork `json:"istanbul,omitempty"` London *Fork `json:"london,omitempty"` EIP150 *Fork `json:"EIP150,omitempty"` EIP158 *Fork `json:"EIP158,omitempty"` EIP155 *Fork `json:"EIP155,omitempty"` }
Forks specifies when each fork is activated
func (*Forks) At ¶
func (f *Forks) At(block uint64) ForksInTime
func (*Forks) IsByzantium ¶
func (*Forks) IsConstantinople ¶
func (*Forks) IsHomestead ¶
func (*Forks) IsPetersburg ¶
type ForksInTime ¶
type ForksInTime struct { Homestead, Byzantium, Constantinople, Petersburg, Istanbul, London, EIP150, EIP158, EIP155 bool }
type KeccakState ¶
KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.