wallet

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntropyBits              = 256
	FileMode                 = 0600
	DefaultNodeKeyPath       = "m/44'/60'/0'/0/%d"
	LedgerLiveNodeKeyPath    = "m/44'/60'/%d/0/0"
	MyEtherWalletNodeKeyPath = "m/44'/60'/0'/%d"
)

Config

View Source
const (
	MaxValidatorKeyRecoverAttempts uint = 1000
)

Config

Variables

This section is empty.

Functions

This section is empty.

Types

type ValidatorKey

type ValidatorKey struct {
	PublicKey      types.ValidatorPubkey
	PrivateKey     *eth2types.BLSPrivateKey
	DerivationPath string
	WalletIndex    uint
}

A validator private/public key pair

type Wallet

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

Wallet

func NewWallet

func NewWallet(walletPath string, chainId uint, maxFee *big.Int, maxPriorityFee *big.Int, gasLimit uint64, passwordManager *passwords.PasswordManager) (*Wallet, error)

Create new wallet

func (*Wallet) AddKeystore

func (w *Wallet) AddKeystore(name string, ks keystore.Keystore)

Add a keystore to the wallet

func (*Wallet) CreateValidatorKey

func (w *Wallet) CreateValidatorKey() (*eth2types.BLSPrivateKey, error)

Create a new validator key

func (*Wallet) Delete

func (w *Wallet) Delete() error

Delete the wallet store from disk

func (*Wallet) DeleteValidatorStores

func (w *Wallet) DeleteValidatorStores() error

Deletes all of the keystore directories and persistent VC storage

func (*Wallet) GetChainID

func (w *Wallet) GetChainID() *big.Int

Gets the wallet's chain ID

func (*Wallet) GetInitialized

func (w *Wallet) GetInitialized() (bool, error)

Attempt to initialize the wallet if not initialized and return status

func (*Wallet) GetNextValidatorKey

func (w *Wallet) GetNextValidatorKey() (*eth2types.BLSPrivateKey, error)

Returns the next validator key that will be generated without saving it

func (*Wallet) GetNodeAccount

func (w *Wallet) GetNodeAccount() (accounts.Account, error)

Get the node account

func (*Wallet) GetNodeAccountTransactor

func (w *Wallet) GetNodeAccountTransactor() (*bind.TransactOpts, error)

Get a transactor for the node account

func (*Wallet) GetNodePrivateKeyBytes

func (w *Wallet) GetNodePrivateKeyBytes() ([]byte, error)

Get the node account private key bytes

func (*Wallet) GetValidatorKeyAt

func (w *Wallet) GetValidatorKeyAt(index uint) (*eth2types.BLSPrivateKey, error)

Get a validator key by index

func (*Wallet) GetValidatorKeyByPubkey

func (w *Wallet) GetValidatorKeyByPubkey(pubkey rptypes.ValidatorPubkey) (*eth2types.BLSPrivateKey, error)

Get a validator key by public key

func (*Wallet) GetValidatorKeyCount

func (w *Wallet) GetValidatorKeyCount() (uint, error)

Get the number of validator keys recorded in the wallet

func (*Wallet) GetValidatorKeys

func (w *Wallet) GetValidatorKeys(startIndex uint, length uint) ([]ValidatorKey, error)

Recover a set of validator keys by their public key

func (*Wallet) Initialize

func (w *Wallet) Initialize(derivationPath string, walletIndex uint) (string, error)

Initialize the wallet from a random seed

func (*Wallet) IsInitialized

func (w *Wallet) IsInitialized() bool

Check if the wallet has been initialized

func (*Wallet) LoadValidatorKey

func (w *Wallet) LoadValidatorKey(pubkey types.ValidatorPubkey) (*eth2types.BLSPrivateKey, error)

Loads a validator key from the wallet's keystores

func (*Wallet) Recover

func (w *Wallet) Recover(derivationPath string, walletIndex uint, mnemonic string) error

Recover a wallet from a mnemonic

func (*Wallet) RecoverValidatorKey

func (w *Wallet) RecoverValidatorKey(pubkey rptypes.ValidatorPubkey, startIndex uint) (uint, error)

Recover a validator key by public key

func (*Wallet) Reload

func (w *Wallet) Reload() error

Reloads wallet from disk

func (*Wallet) Save

func (w *Wallet) Save() error

Save the wallet store to disk

func (*Wallet) SaveValidatorKey

func (w *Wallet) SaveValidatorKey(key ValidatorKey) error

Save a validator key

func (*Wallet) Sign

func (w *Wallet) Sign(serializedTx []byte) ([]byte, error)

Signs a serialized TX using the wallet's private key

func (*Wallet) SignMessage

func (w *Wallet) SignMessage(message string) ([]byte, error)

Signs an arbitrary message using the wallet's private key

func (*Wallet) StoreValidatorKey

func (w *Wallet) StoreValidatorKey(key *eth2types.BLSPrivateKey, path string) error

Stores a validator key into all of the wallet's keystores

func (*Wallet) String

func (w *Wallet) String() (string, error)

Serialize the wallet to a JSON string

func (*Wallet) TestRecoverValidatorKey

func (w *Wallet) TestRecoverValidatorKey(pubkey rptypes.ValidatorPubkey, startIndex uint) (uint, error)

Test recovery of a validator key by public key

func (*Wallet) TestRecovery

func (w *Wallet) TestRecovery(derivationPath string, walletIndex uint, mnemonic string) error

Recover a wallet from a mnemonic - only used for testing mnemonics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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