this is the config file:
export const wallet = Keypair.fromSecretKey(Buffer.from('<YOUR_WALLET_SECRET_KEY>'))
This is the piece of code validating the secret key:
static fromSecretKey(secretKey, options) {
if (secretKey.byteLength !== 64) {
throw new Error('bad secret key size');
}
const publicKey = secretKey.slice(32, 64);
if (!options || !options.skipValidation) {
const privateScalar = secretKey.slice(0, 32);
const computedPublicKey = getPublicKey(privateScalar);
for (let ii = 0; ii < 32; ii++) {
if (publicKey[ii] !== computedPublicKey[ii]) {
throw new Error('provided secretKey is invalid');
}
}
}
return new Keypair({
publicKey,
secretKey
});
}
putting 88 character secret key throws and error, what am I doing wrong? what encoding should I use?
I found this advice:
Hello to use the Array Keys from solrwallet type of wallets
you have to use below code
const pk= [185,123,156,123,…,]. // Note this is without quotes.
const wallet = Keypair.fromSecretKey(Uint8Array.from(pk));
But I don’t understand it at all, since when does private key look like that?
Matěj Pátek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.