-
Notifications
You must be signed in to change notification settings - Fork 123
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
cosmrs: better document BIP-32 SigningKey
derivation
#300
Comments
This is the relevant method: https://docs.rs/cosmrs/latest/cosmrs/crypto/secp256k1/struct.SigningKey.html#method.derive_from_path |
Is this not the correct way to do it? let mnemonic = bip32::Mnemonic::new(chain.private_key.clone(), Language::English).unwrap();
let seed = mnemonic.to_seed("password");
let xprv = XPrv::new(&seed)?;
let signing_key: SigningKey = xprv.into(); |
@ewoolsey that's the correct way to get the seed, however you have no derivation path in your example. You can pass the seed into |
Ahhh so something like this? let mnemonic = bip32::Mnemonic::new(chain.mnemonic.clone(), Language::English).unwrap();
let seed = mnemonic.to_seed("password");
let child_path = "m/0/2147483647'/1/2147483646'";
let child_xprv = XPrv::derive_from_path(&seed, &child_path.parse()?)?;
let signing_key: SigningKey = child_xprv.into(); |
The last two lines need to be: let signing_key = cosmrs::crypto::secp256k1::SigningKey::derive_from_path(&seed, child_path.parse()?)?); |
Gotcha! Thanks for the help! Appreciate it! |
SigningKey
derivation
Is this the only place for one to be able to get this knowledge? |
@meekteek this issue is still open to track updating the documentation because it hasn't been done yet. Contributions to improve the documentation would be welcome. |
As it stands there is very little documentation surrounding the SigningKey trait and the way you are supposed to use it with Bip32. I think a very common use case would be generating this from a mnemonic string, and as it stands there is no obvious way to go about that. An example of doing that would likely be very helpful for many.
The text was updated successfully, but these errors were encountered: