import GoDocLink from '../../components/godoc'
The wallet
package is an implementation of the Signer interface for an ECDSA private key and it represents an Ethereum account. It supports loading the private key from different mediums.
Create a random key:
key, err := wallet.GenerateKey()
Create the key from a mnemonic phrase:
mnemonic := ""
key, err := wallet.NewWalletFromMnemonic(mnemonic)
Create the key from a private key (in bytes):
key, err := wallet.NewWalletFromPrivKey([]byte{})
Create the key from an encrypted JSON wallet following the keystore format.
key, err := wallet.NewJSONWalletFromFile("./file.json")