Documentation ¶
Index ¶
- func AddressFromHex(hex string) (string, error)
- func AddressFromPrivateKey(key *ecdsa.PrivateKey) string
- func PrivateKeyFromFile(file string) (string, *ecdsa.PrivateKey, error)
- func PrivateKeyFromHex(hex string) (string, *ecdsa.PrivateKey, error)
- func PrivateKeyFromKeystore(file string, password string) (string, *ecdsa.PrivateKey, error)
- func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)
- func RandomPrivateKeyFile(seed string, dir string) (string, *ecdsa.PrivateKey, error)
- func SeedToPrivateKey(seed string) (string, *ecdsa.PrivateKey)
- func SeedToPrivateKeyFile(seed string, dir string) (filepath string, privkey *ecdsa.PrivateKey, err error)
- type Account
- type KeySigner
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressFromHex ¶
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 RandomPrivateKey ¶
func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)
func RandomPrivateKeyFile ¶
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 NewPrivateKeyAccount ¶ added in v0.0.32
func (*Account) AddressHex ¶ added in v0.0.30
type KeySigner ¶
type KeySigner struct {
// contains filtered or unexported fields
}
func NewKeySigner ¶
func NewKeySigner(key *ecdsa.PrivateKey) *KeySigner
Click to show internal directories.
Click to hide internal directories.