-
Notifications
You must be signed in to change notification settings - Fork 725
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
Extra Zeroes In Private Key In Nethereum.Hd Wallet Class #563
Comments
same issue here. string seeds = "scrub response inhale chuckle inhale olympic noise dismiss net tray grant come"; generate private key with seeds: |
Hi, private keys are big integers so sometimes the byte array equivalent will include the prefix zero to indicate the sign, or in another scenarios will be prefixed with 00s as it is a smaller number. |
sometimes the private key is invalid due to missing two zero. so how can we get the exact valid private key from the seed? index length private key |
What do yo mean by invalid? When you use the private key can you get the same address and sign? Or you mean for external usage. |
i.e.: I use this private key and import it to MetaMask or MEW online. but it does not work, the MM report invalid private key. 603, 68, 0x0093dd5b691b1c467869d4ff6783366c563d07d76e6ffa3e99142970f0bebe0253 |
Issue tracker is ONLY used for reporting bugs. New features, questions and support should be discussed on our gitter channel first. Gitter
Expected Behavior
Private Key should always be 0x followed by 64 hex characters.
Current Behavior
Private Key is usually 64 hex characters, but for some new wallet addresses or imported seed phrases, there are 66 characters and the private key string starts with '00'. In this case, the extra 00 characters cause private key to not import in Metamask.
Possible Solution
My workaround has been to remove the extra start characters if present so that the resulting substring is 64 characters long. Not sure what is causing this within the Wallet class.
Steps to Reproduce
public string GenerateSeedPhrase()
{
var mnemonic = new Mnemonic(Wordlist.English, WordCount.Twelve);
return mnemonic.IsValidChecksum ? mnemonic.ToString() : string.Empty;
}
string seedPhrase = GenerateSeedPhrase();
var wallet = new Wallet(seedPhrase, null);
var newAccount = wallet.GetAccount(0);
string privateKeyString = newAccount.PrivateKey.Substring(2); // Sometimes this is the correct length, sometimes it starts with two extraneous 0's.
Context (Environment)
Writing a Xamarin Forms app for a crypto collectible game.
Detailed Description
Possible Implementation
The text was updated successfully, but these errors were encountered: