bittensor.commands.wallets#

Module Contents#

Classes#

RegenColdkeyCommand

Executes the 'regen_coldkey' command to regenerate a coldkey for a wallet on the Bittensor network.

RegenColdkeypubCommand

Executes the 'regen_coldkeypub' command to regenerate the public part of a coldkey (coldkeypub) for a wallet on the Bittensor network.

RegenHotkeyCommand

Executes the 'regen_hotkey' command to regenerate a hotkey for a wallet on the Bittensor network.

NewHotkeyCommand

Executes the 'new_hotkey' command to create a new hotkey under a wallet on the Bittensor network.

NewColdkeyCommand

Executes the 'new_coldkey' command to create a new coldkey under a wallet on the Bittensor network.

WalletCreateCommand

Executes the 'create' command to generate both a new coldkey and hotkey under a specified wallet on the Bittensor network.

UpdateWalletCommand

Executes the 'update' command to check and potentially update the security of the wallets in the Bittensor network.

WalletBalanceCommand

Executes the 'balance' command to check the balance of the wallet on the Bittensor network.

Functions#

_get_coldkey_wallets_for_path(path)

Get all coldkey wallet names from path.

_get_coldkey_ss58_addresses_for_path(path)

Get all coldkey ss58 addresses from path.

class bittensor.commands.wallets.RegenColdkeyCommand#

Executes the ‘regen_coldkey’ command to regenerate a coldkey for a wallet on the Bittensor network. This command is used to create a new coldkey from an existing mnemonic, seed, or JSON file.

Usage: Users can specify a mnemonic, a seed string, or a JSON file path to regenerate a coldkey. The command supports optional password protection for the generated key and can overwrite an existing coldkey.

Optional arguments: - –mnemonic (str): A mnemonic phrase used to regenerate the key. - –seed (str): A seed hex string used for key regeneration. - –json (str): Path to a JSON file containing an encrypted key backup. - –json_password (str): Password to decrypt the JSON file. - –use_password (bool): Enables password protection for the generated key. - –overwrite_coldkey (bool): Overwrites the existing coldkey with the new one.

Example usage: >>> btcli wallet regen_coldkey –mnemonic “word1 word2 … word12”

Note: This command is critical for users who need to regenerate their coldkey, possibly for recovery or security reasons. It should be used with caution to avoid overwriting existing keys unintentionally.

run()#

Creates a new coldkey under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

class bittensor.commands.wallets.RegenColdkeypubCommand#

Executes the ‘regen_coldkeypub’ command to regenerate the public part of a coldkey (coldkeypub) for a wallet on the Bittensor network. This command is used when a user needs to recreate their coldkeypub from an existing public key or SS58 address.

Usage: The command requires either a public key in hexadecimal format or an SS58 address to regenerate the coldkeypub. It optionally allows overwriting an existing coldkeypub file.

Optional arguments: - –public_key_hex (str): The public key in hex format. - –ss58_address (str): The SS58 address of the coldkey. - –overwrite_coldkeypub (bool): Overwrites the existing coldkeypub file with the new one.

Example usage: >>> btcli wallet regen_coldkeypub –ss58_address 5DkQ4…

Note: This command is particularly useful for users who need to regenerate their coldkeypub, perhaps due to file corruption or loss. It is a recovery-focused utility that ensures continued access to wallet functionalities.

run()#

Creates a new coldkeypub under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

class bittensor.commands.wallets.RegenHotkeyCommand#

Executes the ‘regen_hotkey’ command to regenerate a hotkey for a wallet on the Bittensor network. Similar to regenerating a coldkey, this command creates a new hotkey from a mnemonic, seed, or JSON file.

Usage: Users can provide a mnemonic, seed string, or a JSON file to regenerate the hotkey. The command supports optional password protection and can overwrite an existing hotkey.

Optional arguments: - –mnemonic (str): A mnemonic phrase used to regenerate the key. - –seed (str): A seed hex string used for key regeneration. - –json (str): Path to a JSON file containing an encrypted key backup. - –json_password (str): Password to decrypt the JSON file. - –use_password (bool): Enables password protection for the generated key. - –overwrite_hotkey (bool): Overwrites the existing hotkey with the new one.

Example usage: >>> btcli wallet regen_hotkey >>> btcli wallet regen_hotkey –seed 0x1234…

Note: This command is essential for users who need to regenerate their hotkey, possibly for security upgrades or key recovery. It should be used cautiously to avoid accidental overwrites of existing keys.

run()#

Creates a new coldkey under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

class bittensor.commands.wallets.NewHotkeyCommand#

Executes the ‘new_hotkey’ command to create a new hotkey under a wallet on the Bittensor network. This command is used to generate a new hotkey for managing a neuron or participating in the network.

Usage: The command creates a new hotkey with an optional word count for the mnemonic and supports password protection. It also allows overwriting an existing hotkey.

Optional arguments: - –n_words (int): The number of words in the mnemonic phrase. - –use_password (bool): Enables password protection for the generated key. - –overwrite_hotkey (bool): Overwrites the existing hotkey with the new one.

Example usage: >>> btcli wallet new_hotkey –n_words 24

Note: This command is useful for users who wish to create additional hotkeys for different purposes, such as running multiple miners or separating operational roles within the network.

run()#

Creates a new hotke under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

class bittensor.commands.wallets.NewColdkeyCommand#

Executes the ‘new_coldkey’ command to create a new coldkey under a wallet on the Bittensor network. This command generates a coldkey, which is essential for holding balances and performing high-value transactions.

Usage: The command creates a new coldkey with an optional word count for the mnemonic and supports password protection. It also allows overwriting an existing coldkey.

Optional arguments: - –n_words (int): The number of words in the mnemonic phrase. - –use_password (bool): Enables password protection for the generated key. - –overwrite_coldkey (bool): Overwrites the existing coldkey with the new one.

Example usage: >>> btcli wallet new_coldkey –n_words 15

Note: This command is crucial for users who need to create a new coldkey for enhanced security or as part of setting up a new wallet. It’s a foundational step in establishing a secure presence on the Bittensor network.

run()#

Creates a new coldkey under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

class bittensor.commands.wallets.WalletCreateCommand#

Executes the ‘create’ command to generate both a new coldkey and hotkey under a specified wallet on the Bittensor network. This command is a comprehensive utility for creating a complete wallet setup with both cold and hotkeys.

Usage: The command facilitates the creation of a new coldkey and hotkey with an optional word count for the mnemonics. It supports password protection for the coldkey and allows overwriting of existing keys.

Optional arguments: - –n_words (int): The number of words in the mnemonic phrase for both keys. - –use_password (bool): Enables password protection for the coldkey. - –overwrite_coldkey (bool): Overwrites the existing coldkey with the new one. - –overwrite_hotkey (bool): Overwrites the existing hotkey with the new one.

Example usage: >>> btcli wallet create –n_words 21

Note: This command is ideal for new users setting up their wallet for the first time or for those who wish to completely renew their wallet keys. It ensures a fresh start with new keys for secure and effective participation in the network.

run()#

Creates a new coldkey and hotkey under this wallet.

static check_config(config)#
Parameters:

config (bittensor.config) –

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

bittensor.commands.wallets._get_coldkey_wallets_for_path(path)#

Get all coldkey wallet names from path.

Parameters:

path (str) –

Return type:

List[bittensor.wallet]

class bittensor.commands.wallets.UpdateWalletCommand#

Executes the ‘update’ command to check and potentially update the security of the wallets in the Bittensor network. This command is used to enhance wallet security using modern encryption standards.

Usage: The command checks if any of the wallets need an update in their security protocols. It supports updating all legacy wallets or a specific one based on the user’s choice.

Optional arguments: - –all (bool): When set, updates all legacy wallets. - –no_prompt (bool): Disables user prompting during the update process.

Example usage: >>> btcli wallet update –all

Note: This command is important for maintaining the highest security standards for users’ wallets. It is recommended to run this command periodically to ensure wallets are up-to-date with the latest security practices.

static run(cli)#

Check if any of the wallets needs an update.

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

static check_config(config)#
Parameters:

config (bittensor.Config) –

bittensor.commands.wallets._get_coldkey_ss58_addresses_for_path(path)#

Get all coldkey ss58 addresses from path.

Parameters:

path (str) –

Return type:

List[str]

class bittensor.commands.wallets.WalletBalanceCommand#

Executes the ‘balance’ command to check the balance of the wallet on the Bittensor network. This command provides a detailed view of the wallet’s coldkey balances, including free and staked balances.

Usage: The command lists the balances of all wallets in the user’s configuration directory, showing the wallet name, coldkey address, and the respective free and staked balances.

Optional arguments: None. The command uses the wallet and subtensor configurations to fetch balance data.

Example usage: >>> btcli wallet balance

Note: This command is essential for users to monitor their financial status on the Bittensor network. It helps in keeping track of assets and ensuring the wallet’s financial health.

static run(cli)#

Check the balance of the wallet.

static add_args(parser)#
Parameters:

parser (argparse.ArgumentParser) –

static check_config(config)#
Parameters:

config (bittensor.config) –