Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

401
Vistas
Solana blockchain. How can i generate private key?
       const solanaWeb3 = require("@solana/web3.js");
    const solanatoken = require("@solana/spl-token");
    
      var wallet = solanaWeb3.Keypair.generate();
      console.log("public key...", wallet.publicKey);
      console.log("secret key...", wallet.secretKey);
    
      console.log("secret key...", JSON.stringify(wallet.secretKey.toString()));`enter preformatted text here`

I got

public key... PublicKey {
  _bn: <BN: b5ec974285759f4004555c6890e045a4ce857c6a056895d77dd209c054e76556>
secret key... "211,55,244,72,160,174,33,152,24,226,97,172,91,91,47,3,148,83,99,188,150,111,153,248,253,237,31,223,194,194,199,0,181,236,151,66,133,117,159,64,4,85,92,104,144,224,69,164,206,133,124,106,5,104,149,215,125,210,9,192,84,231,101,86"

how I can get private key, like

kNykCXNxgePDjFbDWjPNvXQRa8U12Ywc19dFVaQ7tebUj3m7H4sF4KKdJwM7yxxb3rqxchdjezX9Szh8bLcQAjb

for use on the phantom wallet? docs: https://solana-labs.github.io/solana-web3.js/classes/Keypair.html

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

for use on the phantom wallet you can copy and paste byte array directly.

about 4 years ago · Juan Pablo Isaza Denunciar

0

If you want the private key in base58, you'll have to do a conversion.

wallet.secretKey gives a Uint8Array: https://solana-labs.github.io/solana-web3.js/classes/Keypair.html#secretKey, so you'll have to convert from Uint8Array to a base58 string.

There are packages to do that, and Solana's web3 package uses bs58: https://github.com/cryptocoinjs/bs58#encodeinput

So you'll have to do bs58.encode(wallet.secretKey) to get the string as you're expecting.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can change UInt8Array to String like "kNykCXNxgePDjFbDWjPNvXQRa8U12Ywc19dFVaQ7tebUj3m7H4sF4KKdJwM7yxxb3rqxchdjezX9Szh8bLcQAjb" by using bs58.encode() or PublicKey.toBase58();

let secretKey = keyPair.secretKey.toBase58();
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda