-
Notifications
You must be signed in to change notification settings - Fork 55
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 support for wallet import via private key #215
Comments
Hi @zees-dev, |
This seems to be quite useful functionality; hence will be revisited in ~1-2 weeks for checking progress. |
Hi @zees-dev, While passing hardcoded let hex_string = "bb01503b7133531412c7f0f7bc040d5c7ae2377dc772c2b020d010651f4a4f3a";
let private_key_bytes = hex::decode(hex_string).expect("Invalid hex string");
// Encrypt and write the wallet file.
eth_keystore::encrypt_key(
wallet_dir,
&mut rand::thread_rng(),
&private_key_bytes,
password,
Some(wallet_file_name),
)
.with_context(|| format!("failed to create keystore at {wallet_path:?}"))
.map(|_| ())
} but while accessing
NOTE: this functionality working correctly with Have any idea regarding this? |
Unfortunately don't have an answer to this at the moment since this would most likely entail changes to other parts of the codebase. When using mnemonic based account creation/import; a single mnemonic generates a master seed following BIP-39 - which can then be used to derive multiple child keys/accounts; this is the account index param you will see being used. When using private key for importing; it's not designed to be used as a seed for generating other accounts/keys. ^ Due to this; the task is most likely not a good first issue and requires additional planning to retain a good UX. |
Context
Currently
forc wallet import
only supports importing wallet(s) via mnemonic.Private keys are commonly used to more easily transfer accounts across wallets; hence it should also be supported here.
Current behaviour of
forc wallet import
:> forc wallet import Please enter your mnemonic phrase:
Proposed behaviour:
> forc wallet import Please enter your mnemonic phrase or private key:
This solution retains the simplicity of the current flow while supporting importing accounts via both mnemonic and private-key - without introducing additional flags.
The text was updated successfully, but these errors were encountered: