-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to use local variables to store hot/coldkey passwords #45
Comments
Brief :)In terms of manual use, the current implementation has not changed. The implementation contains the following updates
Property
|
This future is not completely implement yet at release v2.0.2 , right? |
This is implemented and included in version 2.0.2. Note that this feature (creating a key-linked environment variable) is not enabled by default. Only if you pass the required flag |
I used to export the password enviroment variable and the run the btcli command to do transfer. But after update bittensor to 8.0. It's not work. And I read the latest code of btwallet v2.0.2, I find the format of variable is changed, but I changed to new format, the btcli transfer also not work, just print "Decrypting...", and then exit. |
Could you please provide more context regarding your environment setup? OS, python version in virtual environment, versions of I ask this because I have tested this behavior on my side after your message here and it works correctly for me. Also, keep in mind, that when you export your password via terminal, you have to export encrypted password. We don't want to store your password anywhere without encryption. For example: You can store your password with the following code: from bittensor_wallet import Wallet
my_wallet = Wallet()
# the same approach you can use `for hotkey_file` if this is encrypted.
boolean_result = my_wallet.coldkey_file.save_password_to_env("mypassword") In from bittensor_wallet import Wallet
my_wallet = Wallet()
my_encrypted_password = my_wallet.coldkey_file.save_password_to_env("mypassword") This may seem like a bit of a complicated process. But we have a responsibility to protect user data, especially passwords. |
Thanks, I tried using your python code to save encrypted password to env. And doing stake remove, but I got exception below. (I have masked the coldkey & hotkey & password & encrypted password) (.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ python3 enable_keys.py
>>> key: BT_PW__HOME_UBUNTU__BITTENSOR_WALLETS_MYCOLDKEY_COLDKEY, value: mypassword, encrypted: /-/1$,(:!!
The password has been saved to environment variable 'BT_PW__HOME_UBUNTU__BITTENSOR_WALLETS_MYCOLDKEY_COLDKEY'.
(.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ btcli st remove --all --wallet.name mycoldkey --wallet.hotkey myhotkey
Unstake all staked TAO tokens? [y/n] (n): y
Using the wallet path from config: /home/ubuntu/.bittensor/wallets/
Do you want to unstake from the following keys to lmdcd02:
- myhotkey_address: 0.194905805 τ
[y/n]: y
Decrypting...
Task exception was never retrieved
future: <Task finished name='Task-14' coro=<Websocket._exit_with_timer() done, defined at /home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages/bittensor_cli/src/bittensor/async_substrate_interface.py:669> exception=AttributeError("'NoneType' object has no attribute 'close'")>
Traceback (most recent call last):
File "/home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages/bittensor_cli/src/bittensor/async_substrate_interface.py", line 676, in _exit_with_timer
await self.shutdown()
File "/home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages/bittensor_cli/src/bittensor/async_substrate_interface.py", line 687, in shutdown
await self.ws.close()
AttributeError: 'NoneType' object has no attribute 'close' And my python3 & bittensor_cli & bittensor_wallet version as below:
|
It looks like the password was read from environment successfully. Now you have an error in Let me clarify, your coldkey decryption password is "mypassword"? I'm clarifying, because now this error is raised when an incorrect password is provided for decrypting cold/hotkey-s. |
the enable_keys.py is like below: from bittensor_wallet import Wallet
coldkeys = ["mywallet"]
for ck in coldkeys:
_wallet = Wallet(name=ck)
result = _wallet.coldkey_file.save_password_to_env(ck) # assume the decryption password is same as wallet name Is there some problems in above codes? |
This code looks correct if the wallet name and password match. |
Variable for storing password: (
BT_PW_%WALLET_NAME%_%COLDKEY/HOTKEY%_{}
, keyname)Functional:
AC:
The text was updated successfully, but these errors were encountered: