Documentation
¶
Index ¶
- Variables
- func CreateAddress(addr types.Address, nonce uint64) types.Address
- func CreateAddress2(addr types.Address, salt [32]byte, inithash []byte) types.Address
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)
- func Keccak256(v ...[]byte) []byte
- func MarshallPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
- func MarshallPublicKey(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 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) (*ecdsa.PrivateKey, error)
- func ValidateSignatureValues(v byte, r, s []byte) bool
- type EIP155Signer
- type FrontierSigner
- type TxSigner
Constants ¶
This section is empty.
Variables ¶
var S256 = btcec.S256()
S256 is the secp256k1 elliptic curve
Functions ¶
func CreateAddress ¶
CreateAddress creates an Ethereum address.
func CreateAddress2 ¶
CreateAddress2 creates an Ethereum address following the CREATE2 Opcode.
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey generates a new key based on the secp256k1 elliptic curve.
func HexToECDSA ¶
func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)
HexToECDSA parses a secp256k1 private key.
func MarshallPrivateKey ¶
func MarshallPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
func MarshallPublicKey ¶
MarshallPublicKey marshalls 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 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.
func ToECDSA ¶
func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)
ToECDSA creates a private key with the given D value.
func ValidateSignatureValues ¶
ValidateSignatureValues checks if the signature values are correct
Types ¶
type EIP155Signer ¶
type EIP155Signer struct {
// contains filtered or unexported fields
}
func NewEIP155Signer ¶
func NewEIP155Signer(chainID uint64) *EIP155Signer
func (*EIP155Signer) Hash ¶
func (e *EIP155Signer) Hash(tx *types.Transaction) types.Hash
func (*EIP155Signer) Sender ¶
func (e *EIP155Signer) Sender(tx *types.Transaction) (types.Address, error)
func (*EIP155Signer) SignTx ¶
func (e *EIP155Signer) SignTx(tx *types.Transaction, priv *ecdsa.PrivateKey) (*types.Transaction, error)
type FrontierSigner ¶
type FrontierSigner struct { }
func (*FrontierSigner) Hash ¶
func (f *FrontierSigner) Hash(tx *types.Transaction) types.Hash
func (*FrontierSigner) Sender ¶
func (f *FrontierSigner) Sender(tx *types.Transaction) (types.Address, error)
func (*FrontierSigner) SignTx ¶
func (f *FrontierSigner) SignTx(tx *types.Transaction, priv *ecdsa.PrivateKey) (*types.Transaction, error)
type TxSigner ¶
type TxSigner interface { // Hash returns the hash of the transaction Hash(tx *types.Transaction) types.Hash // Sender returns the sender to the transaction Sender(tx *types.Transaction) (types.Address, error) // SignTx signs a transaction SignTx(tx *types.Transaction, priv *ecdsa.PrivateKey) (*types.Transaction, error) }
TxSigner recovers data from a transaction