trying to get my public and private key from seed Phrase on solana

127 views Asked by At

I'm trying to get my public and private key from my seed Phrase on solana but they are different and I don't understand why and can't find a solution and I really need your help please. here's my code:

import { Keypair } from '@solana/web3.js';

const SEED_STRING = "I paste my seed Phrase here";

const seed = Uint8Array.from(SEED_STRING.split(",")).slice(0, 32);

const keypair = Keypair.fromSeed(seed);

console.log("Private Key:", keypair.privateKey);
console.log("Public Key:", keypair.publicKey);

this is the error that I get: enter image description here

0

There are 0 answers