account

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressFromHex

func AddressFromHex(hex string) (string, error)

func AddressFromPrivateKey

func AddressFromPrivateKey(key *ecdsa.PrivateKey) string

func PrivateKeyFromFile

func PrivateKeyFromFile(file string) (string, *ecdsa.PrivateKey, error)

func PrivateKeyFromHex

func PrivateKeyFromHex(hex string) (string, *ecdsa.PrivateKey, error)

works with both 0x prefix form and naked form

func PrivateKeyFromKeystore

func PrivateKeyFromKeystore(file string, password string) (string, *ecdsa.PrivateKey, error)

func RandomPrivateKey

func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)

func RandomPrivateKeyFile

func RandomPrivateKeyFile(seed string, dir string) (string, *ecdsa.PrivateKey, error)

func SeedToPrivateKey

func SeedToPrivateKey(seed string) (string, *ecdsa.PrivateKey)

func SeedToPrivateKeyFile

func SeedToPrivateKeyFile(seed string, dir string) (filepath string, privkey *ecdsa.PrivateKey, err error)

Generate a private key from a seed using keccak256 and store the private key in hex format to a file with generated address as its name. The file is saved to current working directory if `dir` is "", otherwise it will be saved to `dir`.

Types

type Account

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

func NewKeystoreAccount added in v0.0.30

func NewKeystoreAccount(file string, password string) (*Account, error)

func NewLedgerAccount

func NewLedgerAccount(path string, address string) (*Account, error)

func NewTrezorAccount

func NewTrezorAccount(path string, address string) (*Account, error)

func (*Account) Address

func (self *Account) Address() common.Address

func (*Account) AddressHex added in v0.0.30

func (self *Account) AddressHex() string

func (*Account) SignTx

func (self *Account) SignTx(tx *types.Transaction, chainId *big.Int) (*types.Transaction, error)

type KeySigner

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

func NewKeySigner

func NewKeySigner(key *ecdsa.PrivateKey) *KeySigner

func (*KeySigner) SignTx

func (self *KeySigner) SignTx(tx *types.Transaction, chainId *big.Int) (*types.Transaction, error)

type Signer

type Signer interface {
	SignTx(tx *types.Transaction, chainId *big.Int) (*types.Transaction, error)
}

Directories

Path Synopsis
trezor
Package trezor contains the wire protocol.
Package trezor contains the wire protocol.
Package usb provide interfaces for generic USB devices.
Package usb provide interfaces for generic USB devices.

Jump to

Keyboard shortcuts

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