Documentation
¶
Index ¶
- Variables
- func BytesToPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
- func CreateAddress(addr types.Address, nonce uint64) types.Address
- func CreateAddress2(addr types.Address, salt [32]byte, inithash []byte) types.Address
- func DecodePublicKey(data []byte, curve elliptic.Curve) (*ecdsa.PublicKey, error)
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func GenerateAndEncodePrivateKey() (*ecdsa.PrivateKey, []byte, error)
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func GenerateOrReadPrivateKey(path string) (*ecdsa.PrivateKey, error)
- func HexToPrvKey(hexkey string) (*ecdsa.PrivateKey, error)
- func Keccak256(v ...[]byte) []byte
- func MarshalPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPublicKey(pub *ecdsa.PublicKey) []byte
- func ParsePrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
- func ParsePublicKey(buf []byte) (*ecdsa.PublicKey, error)
- func PubKeyToAddress(pub *ecdsa.PublicKey) types.Address
- func ReadConsensusKey(manager nodekey.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 ToECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error)
- func ValidateSignatureValues(v byte, r, s *big.Int) bool
Constants ¶
This section is empty.
Variables ¶
var (
S256 = btcec.S256()
)
Functions ¶
func BytesToPrivateKey ¶
func BytesToPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
BytesToPrivateKey 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 DecodePublicKey ¶
func GenerateAndEncodePrivateKey ¶
func GenerateAndEncodePrivateKey() (*ecdsa.PrivateKey, []byte, error)
GenerateAndEncodePrivateKey returns a newly generated private key and the Base64 encoding of that private key
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey 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 HexToPrvKey ¶
func HexToPrvKey(hexkey string) (*ecdsa.PrivateKey, error)
HexToPrvKey hex to private key
func MarshalPrivateKey ¶
func MarshalPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
MarshalPrivateKey serializes the private key's D value to a []byte
func MarshalPublicKey ¶
MarshalPublicKey marshals a public key on the secp256k1 elliptic curve.
func ParsePrivateKey ¶
func ParsePrivateKey(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 nodekey.SecretsManager) (*ecdsa.PrivateKey, error)
func RecoverPubkey ¶
RecoverPubkey verifies the compact signature "signature" of "hash" for the secp256k1 curve.
func Sign ¶
func Sign(priv *ecdsa.PrivateKey, hash []byte) ([]byte, error)
Sign produces a compact signature of the data in hash with the given private key on the secp256k1 curve.
Types ¶
This section is empty.