Documentation ¶
Index ¶
- Variables
- func DecodeSignature(sig []byte, chainID uint64) (R, S, V []byte)
- func Ecrecover(hash, signature []byte) (web3.Address, error)
- func EcrecoverMsg(msg, signature []byte) (web3.Address, error)
- func EncodeSignature(R, S []byte, V byte) ([]byte, error)
- func Keccake256(buf []byte) []byte
- func ParsePrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
- func RecoverPubkey(signature, hash []byte) (*ecdsa.PublicKey, error)
- type DerivationPath
- type EIP1155Signer
- type Key
- type Signer
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0}
DefaultDerivationPath is the default derivation path for Ethereum addresses
View Source
var S256 = btcec.S256()
S256 is the secp256k1 elliptic curve
Functions ¶
func DecodeSignature ¶ added in v1.1.3
It takes a signature and a chainID and returns the R, S, and V values of the signature.
Args:
sig ([]byte): the signature chainID (uint64): The chain ID of the network you're signing for.
func EncodeSignature ¶ added in v1.1.3
It encodes the signature of a transaction.
Args:
R ([]byte): The X coordinate of a point R on the curve S ([]byte): the signature V (byte): The recovery ID.
func Keccake256 ¶ added in v1.1.3
func ParsePrivateKey ¶
func ParsePrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
Types ¶
type DerivationPath ¶
type DerivationPath []uint32
func (*DerivationPath) Derive ¶
func (d *DerivationPath) Derive(master *hdkeychain.ExtendedKey) (*ecdsa.PrivateKey, error)
type EIP1155Signer ¶
type EIP1155Signer struct {
// contains filtered or unexported fields
}
func NewEIP155Signer ¶
func NewEIP155Signer(chainID uint64) *EIP1155Signer
func (*EIP1155Signer) RecoverSender ¶
func (e *EIP1155Signer) RecoverSender(tx *web3.Transaction) (web3.Address, error)
func (*EIP1155Signer) SignTx ¶
func (e *EIP1155Signer) SignTx(tx *web3.Transaction, key *Key) (*web3.Transaction, error)
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func GenerateKey ¶
GenerateKey generates a new key based on the secp256k1 elliptic curve.
func NewWalletFromMnemonic ¶
func NewWalletFromPrivKey ¶
func (*Key) MarshallPrivateKey ¶
type Signer ¶
type Signer interface { // RecoverSender returns the sender to the transaction RecoverSender(tx *web3.Transaction) (web3.Address, error) // SignTx signs a transaction SignTx(tx *web3.Transaction, key *Key) (*web3.Transaction, error) }
Click to show internal directories.
Click to hide internal directories.