How do I create a wallet given a private key. #457
Unanswered
Gavin-Williams
asked this question in
Q&A
Replies: 1 comment
-
|
There is a method in the newest source code ( public static Account FromSecretKey(string secretKey)
{
var B58 = new Base58Encoder();
byte[] skeyBytes = B58.DecodeData(secretKey);
if (skeyBytes.Length != 64)
{
throw new ArgumentException("Not a secret key");
}
Account acc = new Account(skeyBytes, skeyBytes.AsSpan(32, 32).ToArray());
return acc;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is no wallet constructor for when we have a private key. I just don't know how to proceed. I searched for Keypair, but there is no utility class for generating a keypair from a private key.
I'm guessing that you call the private key the 'seed' ? Then I would need a utility function to convert a private key into a byte[] representation of the private key.
Update: I'm going to install the Solana CLI - I bet it's got all sorts of useful tools.
Beta Was this translation helpful? Give feedback.
All reactions