-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
ECDSA keys derived from mnemonics don't match subkey #4467
Comments
Good catch, the derivation doesn't use the correct patch. |
Yes, you are doing it against moonbeam. Ok the addresses in Moonbeam show as "Ethereum addresses", so it will never match as-is to the ss58. And they are not the same as the Moonbeam Ethereum accounts. (Which is why is says "non-ETH compatible), Moonbeam has a specific ethereum-type and your cannot mix/match the 2 and expect the same output. Substrate edcsa is not the same as Ethereum edcsa. |
This is the issue right: polkadot-js/common#773 ? |
See this test-case added (previously was daly missing) - polkadot-js/common#850 util-crypto matches subkey Not sure how the Moonbeam keys are derived. If indeed via an Ethereum-compatible HDKey, yes, it won't match. The keys on the dev keyring are always inserted as sr25519 like in Substrate, so it may be mismatched crypto as well. (dev-keyring is not configurable with the dev-key types, it is just always sr25519) |
Anyway, going to close this one - as per the above tests, the derived keys do match Substrate 1-to-1, i.e. there is no mismatch between subkey and the derivation, see https://github.com/polkadot-js/common/pull/850/files#diff-6a57f0d7cdb19e38f51b979d37a92c636e63328129f4776dfdf382a0840b83d1R14-R20. |
@JoshOrndorff We are indeed using ethereum compatible derivation, right? So @jacogr if I solve polkadot-js/common#773, the problem will be solved, right? |
No, it won't be solved - since the dev keyring always does only sr25519 - https://github.com/polkadot-js/common/blob/master/packages/keyring/src/testing.ts#L75 It doesn't actually even derive them since that adds a (exceptionally noticable) 2-3s delay (cased by the mnemonic -> miniSecret dance), so it knows the exact sr25519 keypairs and just injects them. Well, it may be solved alongside the above if -
|
Let me try to clarify:
|
Connect to a dev node, the Alice/Bob accounts are injected. (And the dev option is available in creating accounts) |
Yes @jacogr is correct, @JoshOrndorff . |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query. |
When the Apps UI derives an ecdsa key from a mnemonic, the resulting keypair is not the same as when using the same mnemonic with
subkey
or Moonbeam. (Moonbeam and subkey agree).For example, let's consider Alice. (This output is from subkey at commit
5aae3999
from 20 January)When I derive from the same mnemonic in Apps, I get a different result.
We can confirm this by importing the account subkey generated by its private key rather than its mnemonic.
To summarize:
cc @joelamouche
The text was updated successfully, but these errors were encountered: