I'm attempting to use the private key I generated using the Solana command-line to create a wallet in JavaScript / Node.
I want to use the web3.Keypair.fromSeed()
method.
Here are the steps I've take so far.
- created a solana wallet :
solana-keygen new -o keyfile.json
- display what is in that file -- it's a 64 byte array (this is a test key so no worries that this is the private key
[237,158,92,107,132,192,1,57,8,20,213,108,29,227,37,8,3,105,196,244,8,221,184,199,62,253,98,131,33,165,165,215,14,7,46,23,221,242,240,226,94,79,161,31,192,163,13,25,106,53,34,215,83,124,162,156,8,97,194,180,213,179,33,68]
However, the call to fromSeed()
only wants 32 bytes.
3. check the solana address so I know when everything is working properly :
> solana address -->
wm4MapPtFaUoSsyBJppVnChYMGvHzTeAL6BNZ5GmSqH
That's the public key
How do I call web3.Keypair.fromSeed()
to load that private key and get my public address (aka public key)?
Keypair.fromSecretKey(Uint8Array.from(<private_key_here>))
– Laburnum