-
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
fromMnemonic
returns a private key which shouldn't be used
#1263
fromMnemonic
returns a private key which shouldn't be used
#1263
Comments
Just to add here, that in some of the SDKs, |
One possible suggestion: Have 3 different versions of
|
Hey @alittley, we had an internal discussion and we think the best option is to leave the current method ( We think What is your opinion? |
@dikel I agree, I'm also on board with keeping the existing function, and adding Would it make sense to deprecate the existing |
One more consideration- since Ed25519 supports only hardened derivation, we need to decide whether I think my preference would be that |
@alittley I did some investigation and it turns out the Java SDK only support creating Ed25519 keys from mnemonic. And it uses the path The correct path should be |
@dikel You're correct, java doesn't support ECDSA from mnemonic. Concerning the path -
The JS SDK makes the same assumption for Ed25519 keys in
I haven't dug into the JS SDK to verify, but if you're correct that The paths you've stated are correct 👍 |
I guess this means that if we were to change Ed25519 derivation to not infer all indices are hardened, that would be a breaking change 🤔 So we probably should continue inferring all Ed25519 indices are hardened. But to get a hardened ECDSA child, it must be explicitly chosen |
Reference issue: hiero-ledger/hiero-sdk-java#1263 Note: This breaks ALL previous accounts generated. Accounts must be recreated.
This isn't a bug, but rather a way that an SDK user can easily misuse the
PrivateKey::fromMnemonic
function.By default, calling
fromMnemonic
returns the key at derivation pathm/44'/3030'/0'/0'
(A
in the figure below). If a programmer isn't familiar with derivation paths, they will probably just use the resulting private key without a further thought. This behavior seems to be enforced by the online documentation, which shows simple usage offromMnemonic
However, the private key created from
fromMnemonic
should not be used directly - the programmer ought to go one layer deeper in the derivation path, tom/44'/3030'/0'/0'/0'
,m/44'/3030'/0'/0'/1'
, etc.. (B
in the figure below). This requirement is documented, but only briefly, in the function documentationMy understanding is that receiving to
A
is out of line with expected BIP44 behavior, and doing so might result in different wallets not finding existing funds. It seems worth it to me to make it harder for a wallet developer to mistakenly receive here.The text was updated successfully, but these errors were encountered: