wallet

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2022 License: MPL-2.0 Imports: 14 Imported by: 45 modules, 136 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 Ecrecover

func Ecrecover(hash, signature []byte) (ethgo.Address, error)

func EcrecoverMsg

func EcrecoverMsg(msg, signature []byte) (ethgo.Address, error)

func ParsePrivateKey

func ParsePrivateKey(buf []byte) (*ecdsa.PrivateKey, error)

func RecoverPubkey

func RecoverPubkey(signature, hash []byte) (*ecdsa.PublicKey, 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 *ethgo.Transaction) (ethgo.Address, error)

func (*EIP1155Signer) SignTx

func (e *EIP1155Signer) SignTx(tx *ethgo.Transaction, key ethgo.Key) (*ethgo.Transaction, error)

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key is an implementation of the Key interface with a private key

func GenerateKey

func GenerateKey() (*Key, error)

GenerateKey generates a new key based on the secp256k1 elliptic curve.

func NewJSONWalletFromContent

func NewJSONWalletFromContent(content []byte, password string) (*Key, error)

func NewJSONWalletFromFile

func NewJSONWalletFromFile(path string, password string) (*Key, error)

func NewKey

func NewKey(priv *ecdsa.PrivateKey) *Key

NewKey creates a new key with a private key

func NewWalletFromMnemonic

func NewWalletFromMnemonic(mnemonic string) (*Key, error)

func NewWalletFromPrivKey

func NewWalletFromPrivKey(p []byte) (*Key, error)

func (*Key) Address

func (k *Key) Address() ethgo.Address

func (*Key) MarshallPrivateKey

func (k *Key) MarshallPrivateKey() ([]byte, error)

func (*Key) Sign

func (k *Key) Sign(hash []byte) ([]byte, error)

func (*Key) SignMsg

func (k *Key) SignMsg(msg []byte) ([]byte, error)

type Signer

type Signer interface {
	// RecoverSender returns the sender to the transaction
	RecoverSender(tx *ethgo.Transaction) (ethgo.Address, error)

	// SignTx signs a transaction
	SignTx(tx *ethgo.Transaction, key ethgo.Key) (*ethgo.Transaction, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL