Documentation
¶
Overview ¶
Package crypto contains types and functions for creating Ethereum private keys and accounts, and creating/recovering signatures made with such keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrivateKeyAndAddress ¶
GeneratePrivateKeyAndAddress generates a pseudo-random ECDSA secret key and its corresponding Ethereum address.
func GetAddressFromSecretKeyBytes ¶
GetAddressFromSecretKeyBytes computes the Ethereum address corresponding to the supplied private key.
func RecoverEthereumMessageSigner ¶
RecoverEthereumMessageSigner accepts a message (bytestring) and signature generated by SignEthereumMessage. It reconstructs the appropriate digest and recovers an address via secp256k1 public key recovery
Types ¶
type Signature ¶
Signature is an ECDSA signature
func SignEthereumMessage ¶
SignEthereumMessage accepts an arbitrary message, prepends a known message, hashes the result using keccak256 and calculates the secp256k1 signature of the hash using the provided secret key. The known message added to the input before hashing is "\x19Ethereum Signed Message:\n" + len(message). See https://github.com/ethereum/go-ethereum/pull/2940 and EIPs 191, 721.
func SplitSignature ¶
splitSignature takes a 65 bytes signature in the [R||S||V] format and returns the individual components
func (Signature) MarshalJSON ¶
func (Signature) ToHexString ¶
ToHexString returns the signature as a hex string