-
Notifications
You must be signed in to change notification settings - Fork 161
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
Feature Request: Interactive Account #47
Comments
I was actually looking for the same feature. Basically like My use case is, I want to play with "read-only" accounts without providing the password to decrypt the private key upfront. for account in AccountsService.accounts:
print(account.address) By default the accounts are loaded in the |
Here's a first pass at a new from eth_account import Keystore # or maybe from eth_keystore import Keystore?
locked_accounts = {}
for keydict in Keystore.load('~/.mykeystorefiles'):
locked_accounts[keydict['address']] = keydict Which means you can easily enumerate the addresses: for addr in locked_accounts:
print(addr) It's straightforward to keep a cache of unlocked accounts: import getpass
unlocked_accounts = {}
addr = ... # to unlock
unlocked_accounts[addr] = Account.decrypt(locked_accounts[addr], getpass.getpass()) Edit: just realized that this is more a response to the second comment than the OP. Will return to address OP later... |
Thank you @carver for your feedback. Yes sorry I realised I hijacked the issue. I thought it was related, but misread it. |
It's probably best to open a new issue to discuss, @AndreMiras |
Better error if bump missing in make notes/release
I see this is pretty old, but I just wound up writing a thin layer on top of this that might do what you want. It does lazy loading of json files and lazy decrypting of accounts. It also allows you to name them and associate them with different chains. I couldn't find anything that existed, but maybe I missed it. Check out https://github.com/pydefi/chained-accounts if you still have a need. |
Use case: local developer keys (for debugging on public networks with low-fund accounts)
Create an account where user provides an encrypted keystore, and
Account.decrypt
is used whenever the publicKey is required, providing a password to unlock the keystore for a 1-time sign operation. Optional functionality would be to cache this password for a given time period (similar to thepersonal_unlockAccount
API), for which the user can accept or decline using [y/N].For better user experience feedback, perhaps debug print the message or transaction to be signed before asking for the password or to use the cached password.
This may be more broadly useful setting dev experience expectations as a baseclass for hardware wallet interactions (#31), as the interactive prompt could delegate to the hardware signer instead.
The text was updated successfully, but these errors were encountered: