bittensor_wallet.wallet#
|
Display the mnemonic and a warning message to keep the mnemonic safe. |
|
Module Contents#
Functions Details
- bittensor_wallet.wallet.display_mnemonic_msg(mnemonic, key_type)
Display the mnemonic and a warning message to keep the mnemonic safe.
Classes Details
- class bittensor_wallet.wallet.Wallet(name=None, hotkey=None, path=None, config=None)
Bases:
object- classmethod add_args(parser, prefix=None)
Accept specific arguments from parser.
- coldkey
- coldkey_file
Returns the coldkey file.
- coldkeypub
- coldkeypub_file
Returns the coldkeypub file.
- create(coldkey_use_password=True, hotkey_use_password=False, save_coldkey_to_env=False, save_hotkey_to_env=False, coldkey_password=None, hotkey_password=None, overwrite=False, suppress=False)
Checks for existing coldkeypub and hotkeys, and creates them if non-existent. :param coldkey_use_password: Whether to use a password for coldkey. Defaults to
True. :type coldkey_use_password: bool :param hotkey_use_password: Whether to use a password for hotkey. Defaults toFalse. :type hotkey_use_password: bool :param save_coldkey_to_env: Whether to save a coldkey password to local env. Defaults toFalse. :type save_coldkey_to_env: bool :param save_hotkey_to_env: Whether to save a hotkey password to local env. Defaults toFalse. :type save_hotkey_to_env: bool :param coldkey_password: Coldkey password for encryption. Defaults toNone. If coldkey_password is passed, then coldkey_use_password is automaticallyTrue. :type coldkey_password: Optional[str] :param hotkey_password: Hotkey password for encryption. Defaults toNone. If hotkey_password is passed, then hotkey_use_password is automaticallyTrue. :type hotkey_password: Optional[str] :param overwrite: Whether to overwrite an existing keys. Defaults toFalse. :type overwrite: bool :param suppress: IfTrue, suppresses the display of the keys mnemonic message. Defaults toFalse. :type suppress: bool- Returns:
Wallet instance with created keys.
- create_coldkey_from_uri(uri, use_password=False, overwrite=False, suppress=True, save_coldkey_to_env=False, coldkey_password=None)
Creates coldkey from uri string, optionally encrypts it with the user-provided password.
- create_hotkey_from_uri(uri, use_password=False, overwrite=False, suppress=True, save_hotkey_to_env=False, hotkey_password=None)
Creates hotkey from uri string, optionally encrypts it with the user-provided password.
- create_if_non_existent(coldkey_use_password=Ellipsis, hotkey_use_password=Ellipsis, save_coldkey_to_env=Ellipsis, save_hotkey_to_env=Ellipsis, coldkey_password=None, hotkey_password=None, overwrite=Ellipsis, suppress=Ellipsis)
Checks for existing coldkeypub, hotkeypub, hotkeys, and creates them if non-existent.
- create_new_coldkey(n_words=Ellipsis, use_password=None, overwrite=None, suppress=None, save_coldkey_to_env=None, coldkey_password=None)
- create_new_hotkey(n_words=Ellipsis, use_password=None, overwrite=None, suppress=None, save_hotkey_to_env=None, hotkey_password=None)
Creates a new hotkey, optionally encrypts it with the user-provided password and saves to disk.
- debug_string()
- get_coldkey(password=None)
Gets the coldkey from the wallet.
- get_coldkeypub(password=None)
Gets the coldkeypub from the wallet.
- get_hotkey(password=None)
Gets the hotkey from the wallet.
- get_hotkeypub(password=None)
Gets the hotkeypub from the wallet.
- hotkey
- hotkey_file
Returns the hotkey file.
- hotkey_str
- hotkeypub
- hotkeypub_file
- name
- path
- recreate(coldkey_use_password=Ellipsis, hotkey_use_password=Ellipsis, save_coldkey_to_env=Ellipsis, save_hotkey_to_env=Ellipsis, coldkey_password=None, hotkey_password=None, overwrite=Ellipsis, suppress=Ellipsis)
Checks for existing coldkeypub and hotkeys, and recreates them if non-existent.
- Parameters:
coldkey_use_password – Whether to use a password for coldkey. Defaults to true.
hotkey_use_password – Whether to use a password for hotkey. Defaults to false.
save_coldkey_to_env – Whether to save a coldkey password to local env. Defaults to false.
save_hotkey_to_env – Whether to save a hotkey password to local env. Defaults to false.
coldkey_password – Optional coldkey password for encryption. If provided, forces password use.
hotkey_password – Optional hotkey password for encryption. If provided, forces password use.
overwrite – Whether to overwrite existing keys. Defaults to false.
suppress – Whether to suppress mnemonic display. Defaults to false.
- Returns:
Result<Self, WalletError> - Wallet instance with created keys or error
- regenerate_coldkey(mnemonic=None, seed=None, json=None, use_password=True, overwrite=False, suppress=False, save_coldkey_to_env=False, coldkey_password=None)
Regenerates the coldkey from the passed mnemonic or seed, or JSON encrypts it with the user’s password and saves the file.
- regenerate_coldkeypub(ss58_address=None, public_key=None, overwrite=None)
Regenerates the coldkeypub from the passed ss58_address or public_key and saves the file. Requires either ss58_address or public_key to be passed.
- regenerate_hotkey(mnemonic=None, seed=None, json=None, use_password=False, overwrite=False, suppress=False, save_hotkey_to_env=False, hotkey_password=None)
Regenerates the hotkey from passed mnemonic or seed, encrypts it with the user’s password and saves the file.
- regenerate_hotkeypub(ss58_address=None, public_key=None, overwrite=None)
Regenerates the hotkeypub from the passed ss58_address or public_key and saves the file. Requires either ss58_address or public_key to be passed.
- set_coldkey(keypair, encrypt=True, overwrite=False, save_coldkey_to_env=False, coldkey_password=None)
Sets the coldkey for the wallet.
- Parameters:
keypair – The keypair to set as coldkey
encrypt – Whether to encrypt the key. Defaults to true
overwrite – Whether to overwrite if key exists. Defaults to false
save_coldkey_to_env – Whether to save password to env. Defaults to false
coldkey_password – Optional password for encryption
- Returns:
Result<(), KeyFileError> - Success or error
- set_coldkeypub(keypair, encrypt=False, overwrite=False)
Sets the coldkeypub for the wallet.
- set_hotkey(keypair, encrypt=False, overwrite=False, save_hotkey_to_env=False, hotkey_password=None)
Sets the hotkey for the wallet.
- set_hotkeypub(keypair, encrypt=False, overwrite=False)
Sets the hotkeypub for the wallet.
- to_string()
- unlock_coldkey()
Unlocks the coldkey.
- unlock_coldkeypub()
Unlocks the coldkeypub.
- unlock_hotkey()
Unlocks the hotkey.
- unlock_hotkeypub()
Unlocks the hotkeypub.